SA-MP Forums Archive
1 error. - 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)
+--- Thread: 1 error. (/showthread.php?tid=515711)



1 error. - Johnson_Brooks - 27.05.2014

Код:
: error 035: argument type mismatch (argument 3)
pawn Код:
COMMAND:mystats(playerid,params[])
{
    new str[600];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    strcat(str,"{00FFFF}Username{EEEEEE}:%s\n\n",pName); // error line
    strcat(str,"{00FFFF}Cash{EEEEEE}:%s\n\n",PlayerInfo[playerid][pCash]);
    strcat(str,"{00FFFF}Score{EEEEEE}:%s\n\n",PlayerInfo[playerid][pScore]);
    strcat(str,"{00FFFF}Kills{EEEEEE}:%s\n\n",PlayerInfo[playerid][pKills]);
    strcat(str,"{00FFFF}Deaths{EEEEE}:%s\n\n,",PlayerInfo[playerid][pDeaths]);
    strcat(str,"{00FFFF}Admin Level{EEEEEE}:%s\n\n",PlayerInfo[playerid][pAdmin]);
    strcat(str,"{00FFFF}VIP Level{EEEEEE}:%s\n\n",PlayerInfo[playerid][pVIP]);
    ShowPlayerDialog(playerid,1909,DIALOG_STYLE_MSGBOX,"{00FFFF}Statistics",str,"OK","");
    return 1;
}
Why ?


Re: 1 error. - rumen98 - 27.05.2014

i think strcat can not use Params you must add it in Format like this:
PHP код:
new stats[256];
new 
thestats[256];
strcat(thestats,"{00FFFF}Username{EEEEEE}:%s\n\n");
strcat(thestats,"{00FFFF}Cash{EEEEEE}:%s\n\n");
format(statssizeof(stats), thetitle  ,pName,PlayerInfo[playerid][pCash]); 



Re: 1 error. - Konstantinos - 27.05.2014

strcat is not format. The 3rd argument is strcat is the size of the array (which is 1st argument):
pawn Код:
format(str, sizeof (str),
    "{00FFFF}Username{EEEEEE}:%s\n\n{00FFFF}Cash{EEEEEE}:%s\n\n{00FFFF}Score{EEEEEE}:%s\n\n{00FFFF}Kills{EEEEEE}:%s\n\n",
    pName, PlayerInfo[playerid][pCash], PlayerInfo[playerid][pScore], PlayerInfo[playerid][pKills]);
format(str, sizeof (str),
    "%s{00FFFF}Deaths{EEEEE}:%s\n\n{00FFFF}Admin Level{EEEEEE}:%s\n\n{00FFFF}VIP Level{EEEEEE}:%s\n\n",
    str, PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pVIP]);
I used format twice and splitted the arguments because I've got the patch of Zeex and I won't get the error about long line.


Re: 1 error. - R0 - 27.05.2014

Use this for the others ,the same as this example
pawn Код:
format(str, sizeof(str), "%s", name);



Re: 1 error. - Johnson_Brooks - 27.05.2014

Thanks re kosta