SA-MP Forums Archive
number of arguments does not match definition - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: number of arguments does not match definition (/showthread.php?tid=129231)



number of arguments does not match definition - jamesbond007 - 21.02.2010

if(strcmp("/drunk", cmdtext, true, 9) == 0)
{
SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) + 2000);
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRI NK_BEER);
ApplyAnimation(playerid,"PED","WALK_DRUNK",4.1,1,1 ,1,1,1);
GameTextForPlayer(playerid,"~W~Drunk Mode Is ~g~On!",3000,5);
SendClientMessage(playerid, 0xFF641AFF, "SERVER: Type /drunk off to Stop being Drunk.");
SetPlayerHealth(playerid, GetPlayerHealth(playerid) + 20);
return 1;
}

can someone fix it for me ?

edit : the error showed when i added setplayerhealth; whats wrong with it ?


Re: number of arguments does not match definition - VonLeeuwen - 21.02.2010

https://sampwiki.blast.hk/wiki/GetPlayerHealth

Two parameters, you used one:
'GetPlayerHealth(playerid)'

Make it like this:

pawn Код:
if(strcmp("/drunk", cmdtext, true, 9) == 0)
  {
   new pHealth;
   GetPlayerHealth(playerid, pHealth);
   SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) + 2000);
   SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_BEER);
   ApplyAnimation(playerid,"PED","WALK_DRUNK",4.1,1,1,1,1,1);
   GameTextForPlayer(playerid,"~W~Drunk Mode Is ~g~On!",3000,5);
   SendClientMessage(playerid, 0xFF641AFF, "SERVER: Type /drunk off to Stop being Drunk.");
   SetPlayerHealth(playerid, pHealth =+ 20);
    return 1;
  }



Re: number of arguments does not match definition - jamesbond007 - 21.02.2010

Quote:
Originally Posted by VonLeeuwen
https://sampwiki.blast.hk/wiki/GetPlayerHealth

Two parameters, you used one:
'GetPlayerHealth(playerid)'

Make it like this:

pawn Код:
if(strcmp("/drunk", cmdtext, true, 9) == 0)
  {
   new pHealth;
   GetPlayerHealth(playerid, pHealth);
   SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) + 2000);
   SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_BEER);
   ApplyAnimation(playerid,"PED","WALK_DRUNK",4.1,1,1,1,1,1);
   GameTextForPlayer(playerid,"~W~Drunk Mode Is ~g~On!",3000,5);
   SendClientMessage(playerid, 0xFF641AFF, "SERVER: Type /drunk off to Stop being Drunk.");
   SetPlayerHealth(playerid, pHealth =+ 20);
    return 1;
  }
C:\Users\Max\Documents\Server\gamemodes\lvgangwar. pwn(1082) : warning 213: tag mismatch
C:\Users\Max\Documents\Server\gamemodes\lvgangwar. pwn(108 : error 029: invalid expression, assumed zero
C:\Users\Max\Documents\Server\gamemodes\lvgangwar. pwn(108 : warning 215: expression has no effect
C:\Users\Max\Documents\Server\gamemodes\lvgangwar. pwn(108 : error 001: expected token: ";", but found ")"
C:\Users\Max\Documents\Server\gamemodes\lvgangwar. pwn(108 : error 029: invalid expression, assumed zero
C:\Users\Max\Documents\Server\gamemodes\lvgangwar. pwn(108 : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: number of arguments does not match definition - jamesbond007 - 21.02.2010

no body knows? everyone is lazy? bump


Re: number of arguments does not match definition - Donny_k - 21.02.2010

Quote:
Originally Posted by jamesbond007
no body knows? everyone is lazy? bump
How about you stop being "lazy" and look on the Wiki.


Re: number of arguments does not match definition - jamesbond007 - 21.02.2010

Quote:
Originally Posted by Donny
Quote:
Originally Posted by jamesbond007
no body knows? everyone is lazy? bump
How about you stop being "lazy" and look on the Wiki.
wiki doesnt say much about this...


Re: number of arguments does not match definition - Donny_k - 21.02.2010

It has an example on the page, what more do you want ?

Compare the variables and function usage with yours, you should see the difference.


Re: number of arguments does not match definition - jamesbond007 - 22.02.2010

i dont want it like its on wiki whati m trying to do is when a person types /drunk and clicks the left mouse button to drink so his health goes up by around 30 percent i dont know whats your problem dude. i have errors on both lines wtf is tag mismatch its suppose to be working why doesnt it


Re: number of arguments does not match definition - MisterTickle - 22.02.2010

Код:
if(strcmp("/drunk", cmdtext, true, 9) == 0)
  {
   new Float:pHealth; // You had to define this as a float - That was the tag mismatch error
   GetPlayerHealth(playerid, pHealth);
   SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) + 2000);
   SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_BEER);
   ApplyAnimation(playerid,"PED","WALK_DRUNK",4.1,1,1,1,1,1);
   GameTextForPlayer(playerid,"~W~Drunk Mode Is ~g~On!",3000,5);
   SendClientMessage(playerid, 0xFF641AFF, "SERVER: Type /drunk off to Stop being Drunk.");
   SetPlayerHealth(playerid, pHealth + 20); // not sure what the =+ was for but this works fine
   return 1;
  }
   return 0; // Has to move this over a space due to loose indentation warning
}



Re: number of arguments does not match definition - Donny_k - 22.02.2010

Quote:
Originally Posted by jamesbond007
i dont want it like its on wiki whati m trying to do is when a person types /drunk and clicks the left mouse button to drink so his health goes up by around 30 percent i dont know whats your problem dude. i have errors on both lines wtf is tag mismatch its suppose to be working why doesnt it
You missed my point, you call people lazy but you are too lazy to open the manual and do a little research into what "tag mismatch" means. You shoud of like I said compared the variables in your code to the code on the Wiki, the Wiki one has a "Float:" tag and your doesn't hence the mismatch.

Also I have no problem dude, it's all good but put a little more effort in before you start calling people lazy and breaking rules (bumping before twelve hours has passed).


Re: number of arguments does not match definition - jamesbond007 - 22.02.2010

Quote:
Originally Posted by MisterTickle
Код:
if(strcmp("/drunk", cmdtext, true, 9) == 0)
  {
   new Float:pHealth; // You had to define this as a float - That was the tag mismatch error
   GetPlayerHealth(playerid, pHealth);
   SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) + 2000);
   SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_BEER);
   ApplyAnimation(playerid,"PED","WALK_DRUNK",4.1,1,1,1,1,1);
   GameTextForPlayer(playerid,"~W~Drunk Mode Is ~g~On!",3000,5);
   SendClientMessage(playerid, 0xFF641AFF, "SERVER: Type /drunk off to Stop being Drunk.");
   SetPlayerHealth(playerid, pHealth + 20); // not sure what the =+ was for but this works fine
   return 1;
  }
   return 0; // Has to move this over a space due to loose indentation warning
}
thanks just what with the two return?


Re: number of arguments does not match definition - MisterTickle - 23.02.2010

From my understanding Return 0; is always at the end of onplayercommandtext, Return 1; will close off each of your commands so it doesn't do some clusterfuck and keeps them seperate - In non complicated scripting terms.