Stats Error
#1

PHP код:
      if (strcmp("/stats"cmdtext,true,10) == 0)
      {
          
SendClientMessage(playerid,COLOR_WHITE,"-------------------------%s's Stats-------------------------",GetPlayerName(playerid));
          
SendClientMessage(playerid,COLOR_WHITE,"Hand[%s] Bank[%s] Iron[%s] Wood[%s] Car1[%s] Car2[%s] AdminLevel[%s] Kills[%s]",PlayerInfo[playerid][pCash],PlayerInfo[playerid][pBank],PlayerInfo[playerid][pIron],PlayerInfo[playerid][pWood],PlayerInfo[playerid][pCarKey],PlayerInfo[playerid][pCarKey2],PlayerInfo[playerid][pAdmin],PlayerInfo[playerid][pKills]);
          
SendClientMessage(playerid,COLOR_WHITE,"Deaths[%s] Faction[%s]",PlayerInfo[playerid][pDeaths],PlayerInfo[playerid][pTeam]);
          } 
Well, I'm working on a stats system, and i have this irritating warnings!
Anybody help plz

Код:
C:\Users\Eigenaar\Documents\Erdem\2\gamemodes\DayZ.pwn(323) : warning 202: number of arguments does not match definition
C:\Users\Eigenaar\Documents\Erdem\2\gamemodes\DayZ.pwn(323) : warning 202: number of arguments does not match definition
C:\Users\Eigenaar\Documents\Erdem\2\gamemodes\DayZ.pwn(323) : warning 202: number of arguments does not match definition
C:\Users\Eigenaar\Documents\Erdem\2\gamemodes\DayZ.pwn(324) : warning 202: number of arguments does not match definition
C:\Users\Eigenaar\Documents\Erdem\2\gamemodes\DayZ.pwn(324) : warning 202: number of arguments does not match definition
C:\Users\Eigenaar\Documents\Erdem\2\gamemodes\DayZ.pwn(324) : warning 202: number of arguments does not match definition
C:\Users\Eigenaar\Documents\Erdem\2\gamemodes\DayZ.pwn(324) : warning 202: number of arguments does not match definition
C:\Users\Eigenaar\Documents\Erdem\2\gamemodes\DayZ.pwn(324) : warning 202: number of arguments does not match definition
C:\Users\Eigenaar\Documents\Erdem\2\gamemodes\DayZ.pwn(324) : warning 202: number of arguments does not match definition
C:\Users\Eigenaar\Documents\Erdem\2\gamemodes\DayZ.pwn(324) : warning 202: number of arguments does not match definition
C:\Users\Eigenaar\Documents\Erdem\2\gamemodes\DayZ.pwn(324) : warning 202: number of arguments does not match definition
C:\Users\Eigenaar\Documents\Erdem\2\gamemodes\DayZ.pwn(325) : warning 202: number of arguments does not match definition
C:\Users\Eigenaar\Documents\Erdem\2\gamemodes\DayZ.pwn(325) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


13 Warnings.
Reply
#2

SendClientMessage has 3 arguments: playerid, color, const message[]
what you need is a formated message

example from wiki: https://sampwiki.blast.hk/wiki/Format

PHP код:
new string[64];
format(string,sizeof(string),"Your score is: %d",GetPlayerScore(playerid));
SendClientMessage(playerid,0xFFFFFFAA,string); 
Reply
#3

How to do it?
I mean, I dont know how i can do that:l im new at scripting
Could you do it in my case of my script plz?
Reply
#4

Quote:
Originally Posted by R4mpage
Посмотреть сообщение
How to do it?
I mean, I dont know how i can do that:l im new at scripting
it's really not that difficult

PHP код:
if (strcmp("/stats"cmdtext,true,10) == 0)
{
    new 
str[130],PN[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,PN,sizeof PN);
    
SendClientMessage(playerid,COLOR_WHITE,"-------------------------%s's Stats-------------------------",PN);
    
    
format(str,sizeof str"Hand[%d] Bank[%d] Iron[%d] Wood[%d] Car1[%s] Car2[%s] AdminLevel[%d] Kills[%d]",\
    
PlayerInfo[playerid][pCash],PlayerInfo[playerid][pBank],PlayerInfo[playerid][pIron],PlayerInfo[playerid][pWood],\
    
PlayerInfo[playerid][pCarKey],PlayerInfo[playerid][pCarKey2],PlayerInfo[playerid][pAdmin],PlayerInfo[playerid][pKills]);
    
    
SendClientMessage(playerid,COLOR_WHITE,str);
    
    
format(str,sizeof str"Deaths[%d] Faction[%s]",PlayerInfo[playerid][pDeaths],PlayerInfo[playerid][pTeam]);
    
SendClientMessage(playerid,COLOR_WHITE,str);

Keep in mind that i don't know which of your player-infos is a string or an int,
if, for example, Car1 is a value, just change it to %d or %i
Reply
#5

Ok, I learned it lol, thanks man!
Reply
#6

Код:
if (strcmp("/stats", cmdtext,true,10) == 0)
{
	new Msg[128], Name[24];

	GetPlayerName(playerid, Name, 24);

	format(Msg, 128, "-------------------------%s's Stats-------------------------", Name);
	SendClientMessage(playerid,COLOR_WHITE, Msg);
	format(Msg, 128, "Hand[%s] Bank[%s] Iron[%s] Wood[%s] Car1[%s] Car2[%s] AdminLevel[%s] Kills[%s]", PlayerInfo[playerid][pCash], PlayerInfo[playerid][pBank], PlayerInfo[playerid][pIron], PlayerInfo[playerid][pWood], PlayerInfo[playerid][pCarKey], PlayerInfo[playerid][pCarKey2], PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pKills]);
	SendClientMessage(playerid,COLOR_WHITE, Msg);
	format(Msg, 128, "Deaths[%s] Faction[%s]", PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pTeam]);
	SendClientMessage(playerid,COLOR_WHITE, Msg);
}
Since you didn't state what variable is an integer, float or string, replace "%s" by "%i" or "%f" accordingly.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)