SA-MP Forums Archive
status command,messed up after adding a new var - 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: status command,messed up after adding a new var (/showthread.php?tid=409827)



status command,messed up after adding a new var - Tamer - 23.01.2013

Hello,I have recently added a new player info to my server,it is "XP" the script gives the XP so that works pretty fine,but when it comes to the status command,the XP area is usually blank. (Bugged)

I don't know much aboout strings,so here's the code.


pawn Код:
CMD:status(playerid,params[])
{
    new string[768]; //I think the problem is here.
    format(string, sizeof(string), "||Stats||:Kills: %d | Deaths: %d | Score: %d | Admin: %d | VIP: %d | Rank: %s | | XP Point: %s |" ,PlayerInfo[playerid][pKills],PlayerInfo[playerid][pDeaths],GetPlayerScore(playerid),PlayerInfo[playerid][pAdmin],PlayerInfo[playerid][pVip],Rank(playerid),PlayerInfo[playerid][pXp]);
    SendClientMessage(playerid,ORANGE,string);
    return 1;
}



Re: status command,messed up after adding a new var - Goldino - 23.01.2013

Woah... 700 for a string? Change it to this,

pawn Код:
new string[128];
Hope I helped you


Re: status command,messed up after adding a new var - park4bmx - 23.01.2013

Why do you format the XP,Rank as a string when ther are integers ?
Also string size is too big, a SendClientMessage can't hold that long string.


Re: status command,messed up after adding a new var - Goldino - 23.01.2013

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
Why do you format the XP,Rank as a stein when ther are integers ?
Didn't u read my post? It was supposed to be [128] not [768]


Re: status command,messed up after adding a new var - park4bmx - 23.01.2013

Quote:
Originally Posted by Goldino
Посмотреть сообщение
Didn't u read my post? It was supposed to be [128] not [768]
Look, I posted at the same time as u can see!
Also that is not a solution for a variable not to showing(becouse the string was too big) please where do you get these aides from.

Yes the string is too big but that will not be the solution to the current problem


Re: status command,messed up after adding a new var - RajatPawar - 23.01.2013

Change 'XP: %s' to 'XP: %d'


Re: status command,messed up after adding a new var - antonio112 - 23.01.2013

Quote:
Originally Posted by Goldino
Посмотреть сообщение
Didn't u read my post? It was supposed to be [128] not [768]
You have no clue of what you're talking about ... You just saw in other posts that max string size 'output' can be 128 and now you just post it everywhere. park4bmx tried to give the solution and explain what he did wrong. It's better to explain to someone what he did wrong, than just posting the correct answer.

That's just my two cents opinion.