wtf is wrong with that code :2
#1

pawn Код:
if(strcmp(cmd, "/stats", true) == 0||strcmp(cmd, "/sts", true) ==0)
   {
   new string[41];
   new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
   format(string, sizeof(string),"%s Statistic's~n~NBTDM~n~Health:%d~n~Skin:%d~n~Money:%d~n~Class:%d",name,GetPlayerHealth,GetPlayerSkin,GetPlayerMoney,GetPlayerTeam);
   TextDrawSetString(stats, string);
   TextDrawShowForPlayer(playerid, stats);
   return 1;
   }
error:
pawn Код:
error 076: syntax error in the expression, or invalid function call
whats wrong with that code please help me
Reply
#2

EDIT try this out
pawn Код:
if(strcmp(cmd, "/stats", true) == 0||strcmp(cmd, "/sts", true) ==0)
   {
   new string[41];
   new name[MAX_PLAYER_NAME];
   GetPlayerName(playerid, name, MAX_PLAYER_NAME);
   new Float:health;GetPlayerHealth(playerid,health);
   format(string, sizeof(string),"%s Statistic's~n~NBTDM~n~Health:%d~n~Skin:%d~n~Money:%d~n~Class:%d",name,health,GetPlayerSkin(playerid),GetPlayerMoney(playerid),GetPlayerTeam(playerid));
   TextDrawSetString(stats, string);
   TextDrawShowForPlayer(playerid, stats);
   return 1;
   }
Reply
#3

Quote:
pawn Код:
format(string, sizeof(string),"%s Statistic's~n~NBTDM~n~Health:%d~n~Skin:%d~n~Money:%d~n~Class:%d",name,GetPlayerHealth,GetPlayerSkin,GetPlayerMoney,GetPlayerTeam);
You can't just use GetPlayerHealth, GetPlayerSkin, GetPlayerMoney and GetPlayerTeam with no parameters. Try this instead:

pawn Код:
new Float:Health;
GetPlayerHealth(playerid, Health);
format(string, sizeof(string),"%s Statistic's~n~NBTDM~n~Health:%d~n~Skin:%d~n~Money:%d~n~Class:%d",name,Health,GetPlayerSkin(playerid),GetPlayerMoney(playerid),GetPlayerTeam(playerid));
EDIT:
Quote:
Originally Posted by park4bmx
Посмотреть сообщение
which one is line 076 ?
That's error 076, tho, not the line
Reply
#4

its not the line 076 the line that the error is is the line: 2360
which means that:
pawn Код:
format(string, sizeof(string),"%s Statistic's~n~NBTDM~n~Health:%d~n~Skin:%d~n~Money:%d~n~Class:%d",name,GetPlayerHealth,GetPlayerSkin,GetPlayerMoney,GetPlayerTeam);
Reply
#5

pawn Код:
GetPlayerHealth,GetPlayerSkin,GetPlayerMoney,GetPlayerTeam);
Those functions need parameters to work:
https://sampwiki.blast.hk/wiki/GetPlayerHealth
https://sampwiki.blast.hk/wiki/GetPlayerMoney
https://sampwiki.blast.hk/wiki/GetPlayerTeam
https://sampwiki.blast.hk/wiki/GetPlayerSkin

so you code would look like:
pawn Код:
new Float:xxx;
GetPlayerHealth(playerid,xxx);
   format(string, sizeof(string),"%s Statistic's~n~NBTDM~n~Health:%f~n~Skin:%d~n~Money:%d~n~Class:%d",name,xxx,GetPlayerSkin(playerid),GetPlayerMoney(playerid),GetPlayerTeam(playerid));
Note that health is a float value, not decimal.


Edit:
@up.. you guys were faster ~.~
I miss the old SMF feature which said that somebody has posted before you....

@Gustavob, you made a mistake with GetPlayer[strike]Healt[/strike] -> Health*!
Reply
#6

oh i forgot the parameters :X thx man
Reply
#7

Quote:
Originally Posted by Gamer_Z
Посмотреть сообщение
@Gustavob, you made a mistake with GetPlayerHealt!
My mistake, pardon.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)