status command,messed up after adding a new var
#1

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;
}
Reply
#2

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

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

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.
Reply
#4

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]
Reply
#5

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
Reply
#6

Change 'XP: %s' to 'XP: %d'
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)