11.05.2014, 08:14
Alright, as you can see, the problem is somewhere between 2 and 3. To get the exact location, we can place debug prints after each function. I'll make it easy for you and do it for you.
For bigger codes this solution wouldn't be fast enough, but I think that for this command it's alright to do it like this, since you'll find the exact crash location.
Now do the same as you did first, and I hope we get the exact crash location.
In advance, if it's the colors that cause the problem, do they work in other messages? If not, you might want to have a look at the color defines and redo it.
EDIT:
LOL, good point. I didn't even notice. I'll try and add it to the wiki.
pawn Код:
CMD:stats(playerid, params[])
{
GetPlayerName(playerid, pName, sizeof(pName));
if(IsPlayerConnected(playerid))
{
print("DEBUG: CMDSTART");
new
string[ 128 ],
Age = PlayerInfo[ playerid ][ pAge ],
Money = GetPlayerCash( playerid )
;
print("DEBUG: 1");
new Sex[20];
if(PlayerInfo[ playerid ][ pSex ] == 1) { Sex = "Male"; }
else if(PlayerInfo[ playerid ][ pSex ] == 2) { Sex = "Female"; }
print("DEBUG: 2");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "_________________________STATISTICS OF %s_________________________, pName");
print("DEBUG: 2.1");
SendClientMessage(playerid, -1, "");
print("DEBUG: 2.2");
format(string, sizeof(string), "Name: {FFFFFF}%s {6FDD96}| Money: {FFFFFF}%d {6FDD96}| Age: {FFFFFF}%d {6FDD96}| Sex: {FFFFFF}%s", pName, Money, Age, Sex);
print("DEBUG: 2.3");
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
print("DEBUG: 2.4");
SendClientMessage(playerid, -1, "");
print("DEBUG: 2.5");
SendClientMessage(playerid, COLOR_LIGHTBLUE,"____________________________________________________________________");
print("DEBUG:3");
}
return 1;
}
Now do the same as you did first, and I hope we get the exact crash location.
In advance, if it's the colors that cause the problem, do they work in other messages? If not, you might want to have a look at the color defines and redo it.
EDIT:
Quote:
do not use %s in SendClientMessage
pawn Код:
just do it like this pawn Код:
|