Jump to content
RAGE Multiplayer Community

/heal Befehl


Lucarelli1337
 Share

Recommended Posts

mp.events.addCommand("heal",(player,target)=>{
    parseInt(target);
    let newTarget = mp.players.at(target);
    if(!target || isNaN(target)) return player.outputChatBox("Benutze /heal <ID>");
    if(newTarget === nullreturn player.outputChatBox("Unbekannter Spieler");
    newTarget.outputChatBox(`[ADMIN] ${player.name} hat dich geheilt.`);
    newTarget.armour = 100;
    player.notify('~g~Erfolgreich');
    return;
});
 

    "message": "Das Argument vom Typ \"string\" kann dem Parameter vom Typ \"number\" nicht zugewiesen werden.",
Wie kann ich den Fehler behben?
 
Link to comment
Share on other sites

vor 5 Minuten schrieb fl1k:

target = parseInt(target);

mp.events.addCommand("heal",(player,target)=>{
    target = parseInt(target);
    let newTarget = mp.players.at(target);
    if(!target || isNaN(target)) return player.outputChatBox("Benutze /heal <ID>");
    if(newTarget === nullreturn player.outputChatBox("Unbekannter Spieler");
    newTarget.outputChatBox(`[ADMIN] ${player.name} hat dich geheilt.`);
    newTarget.armour = 100;
    player.notify('~g~Erfolgreich');
    return;
});
 
Error Message still exists .. :(
Link to comment
Share on other sites

vor 31 Minuten schrieb fl1k:

try 

id parseInt(target);

and replace target with id everywhere

if it doesn't work post error message in english

mp.events.addCommand("heal",(player,target)=>{
    let id = parseInt(target);
    let newTarget = mp.players.at(id);
    if(!id || isNaN(id)) return player.outputChatBox("Benutze /heal <ID>");
    if(newTarget === null ) return player.outputChatBox("Unbekannter Spieler");
    newTarget.outputChatBox(`[ADMIN] ${player.name} hat dich geheilt.`);
    newTarget.armour = 100;
    player.notify('~g~Erfolgreich');
    console.log("Heal erfolgt");
    return;
});
 
This is what the console says. 
TypeError: Cannot read property 'outputChatBox' of undefined
    newTarget.outputChatBox(`[ADMIN] ${player.name} hat dich geheilt.`); 
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...