#1

hello, i've been working on a stats command and I don't seem to be able to have Money nor anything to load

Код:
CMD:stats(playerid, params[])
{
	new sstr[300], sstr1[1000];
	format(sstr, sizeof(sstr), "Money %d" GetPlayerMoney(playerid));
	strcat(sstr1, sstr);
	format(sstr, sizeof(sstr), "Kills %d");
	strcat(sstr1, sstr);
	format(sstr, sizeof(sstr), "Deaths %d");
	strcat(sstr1, sstr);
	format(sstr, sizeof(sstr), "Credits %d");
	strcat(sstr1, sstr);
 	SPD(playerid, stats, DIALOG_STYLE_MSGBOX, "Stats", " sstr", "Close","");
	return 1;
}
I keep getting errors on that GetPlayerMoney line, i don't get why.

Код:
C:\Users\BLACK\Desktop\Test\filterscripts\Accounts0.4.pwn(537) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\BLACK\Desktop\Test\filterscripts\Accounts0.4.pwn(537) : error 001: expected token: ";", but found ")"
C:\Users\BLACK\Desktop\Test\filterscripts\Accounts0.4.pwn(537) : error 029: invalid expression, assumed zero
C:\Users\BLACK\Desktop\Test\filterscripts\Accounts0.4.pwn(537) : fatal error 107: too many error messages on one line
If you're able to help that would be great
Reply
#2

Quote:
Originally Posted by LeXuZ
Посмотреть сообщение
hello, i've been working on a stats command and I don't seem to be able to have Money nor anything to load

Код:
CMD:stats(playerid, params[])
{
	new sstr[300], sstr1[1000];
	format(sstr, sizeof(sstr), "Money %d" GetPlayerMoney(playerid));
	strcat(sstr1, sstr);
	format(sstr, sizeof(sstr), "Kills %d");
	strcat(sstr1, sstr);
	format(sstr, sizeof(sstr), "Deaths %d");
	strcat(sstr1, sstr);
	format(sstr, sizeof(sstr), "Credits %d");
	strcat(sstr1, sstr);
 	SPD(playerid, stats, DIALOG_STYLE_MSGBOX, "Stats", " sstr", "Close","");
	return 1;
}
I keep getting errors on that GetPlayerMoney line, i don't get why.

Код:
C:\Users\BLACK\Desktop\Test\filterscripts\Accounts0.4.pwn(537) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\BLACK\Desktop\Test\filterscripts\Accounts0.4.pwn(537) : error 001: expected token: ";", but found ")"
C:\Users\BLACK\Desktop\Test\filterscripts\Accounts0.4.pwn(537) : error 029: invalid expression, assumed zero
C:\Users\BLACK\Desktop\Test\filterscripts\Accounts0.4.pwn(537) : fatal error 107: too many error messages on one line
If you're able to help that would be great
Код:
 expected token: "-string end-", but found "-identifier-"
here:
pawn Код:
format(sstr, sizeof(sstr), "Money %d" GetPlayerMoney(playerid));
you forgot the comma after the 3th argument

pawn Код:
format(sstr, sizeof(sstr), "Money %d", GetPlayerMoney(playerid));
Reply
#3

Ah, how stupid of me to forget that. thanks for point that out!
Reply
#4

Wired... It works but when i do /stats in-game it shows up with on Credits, I can not see where i've gone wrong
pawn Код:
CMD:stats(playerid, params[])
{
    new sstr[300], sstr1[1000];
    format(sstr, sizeof(sstr), "Money %d", GetPlayerCash(playerid));
    strcat(sstr1, sstr);
    format(sstr, sizeof(sstr), "Kills %d", pInfo[playerid][Kills]);
    strcat(sstr1, sstr);
    format(sstr, sizeof(sstr), "Deaths %d", pInfo[playerid][Deaths]);
    strcat(sstr1, sstr);
    format(sstr, sizeof(sstr), "Credits %d", pInfo[playerid][Credits]);
    strcat(sstr1, sstr);
    SPD(playerid, stats, DIALOG_STYLE_MSGBOX, "Stats", sstr , "Close","");
    return 1;
}
Reply
#5

Add \n in every single edge of your messages.

Like "Kills %d\n" "Money %d\n"
Reply
#6

Ah, that's the problem I will test it when I'm on my computer, thanks for replying
Reply
#7

Hmm, done what you said,
pawn Код:
CMD:stats(playerid, params[])
{
    new sstr[300], sstr1[1000];
    format(sstr, sizeof(sstr), "Money %d\n", GetPlayerCash(playerid));
    strcat(sstr1, sstr);
    format(sstr, sizeof(sstr), "Kills %d\n", pInfo[playerid][Kills]);
    strcat(sstr1, sstr);
    format(sstr, sizeof(sstr), "Deaths %d\n", pInfo[playerid][Deaths]);
    strcat(sstr1, sstr);
    format(sstr, sizeof(sstr), "Credits %d", pInfo[playerid][Credits]);
    strcat(sstr1, sstr);
    SPD(playerid, stats, DIALOG_STYLE_MSGBOX, "Stats", sstr , "Close","");
    return 1;
}
but this is what i am getting:
Reply
#8

PHP код:
        new sstr1[50];
        new 
sstr2[50];
        new 
sstr3[50];
        new 
sstr4[50];
         new 
str[350]
    
format(sstr1sizeof(sstr1), "Money %d\n"GetPlayerCash(playerid));
    
format(sstr2sizeof(sstr2), "Credits %d"pInfo[playerid][Credits]);
    
format(sstr3sizeof(sstr3), "Deaths %d\n"pInfo[playerid][Deaths]);
    
format(sstr4sizeof(sstr4), "Kills %d\n"pInfo[playerid][Kills]);
    
strcat(strsstr1);
    
strcat(strsstr2);
    
strcat(strsstr3);
    
strcat(strsstr4);
    
SPD(playeridstatsDIALOG_STYLE_MSGBOX"Stats"str "Close",""); 
Reply
#9

Is that the only way?

Well it works, thank you
Reply
#10

Quote:
Originally Posted by LeXuZ
Посмотреть сообщение
Hmm, done what you said,

but this is what i am getting:
This should work (not using strcat, though).

pawn Код:
format(sstr, sizeof(sstr), "Money %d\n", GetPlayerCash(playerid));
    format(sstr, sizeof(sstr), "%sKills %d\n", sstr, pInfo[playerid][Kills]);
    format(sstr, sizeof(sstr), "%sDeaths %d\n", sstr, pInfo[playerid][Deaths]);
    format(sstr, sizeof(sstr), "%sCredits %d", sstr, pInfo[playerid][Credits]);
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)