Strange bug, wierd characters -
Banditul18 - 28.01.2017
Hello, i have a command /akill
Код:
CMD:akill(playerid, params[])
{
LoginCheck(playerid);
LevelCheck(playerid, 6);
new
string[400],
reason[128],
id
;
if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "Use:/akill [playerid] [reason]");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Player not connected.");
if(APlayerData[playerid][PlayerLevel] < APlayerData[id][PlayerLevel]) return SendClientMessage(playerid, COLOR_RED, "You cannot use this command on higher admin.");
SetPlayerHealth(id, 0.0);
format(string, sizeof(string), "Jucatorul %s a fost omorat de adminul %s[ID:%d] (Motiv: %s)", pName(id), id, pName(playerid), playerid, reason);
SendClientMessageToAll(-1, string);
return 1;
}
Until now works perfect, but after i change a color have a bug
Screenshot:
http://imgur.com/lqct2Wq
I dont understand, the code seems perfect(ignor size of string, i make to be sure)
Re: Strange bug, wierd characters -
Sew_Sumi - 28.01.2017
What's the line saying in English, and what part of your code is that coming from as it's most likely a script error with another part of your script.
On a side note, rather than running other functions off the command to check for user login, and admin level, you'd be better off simply checking directly from in the command it's variables, and if they aren't allowed, then return 0.
Re: Strange bug, wierd characters -
Banditul18 - 28.01.2017
Код:
format(string, sizeof(string), "Player %s was killed by admin %s[ID:%d] (Reason: %s)", pName(id), id, pName(playerid), playerid, reason);
That functions work perfect in another commands/publics etc
That problem is the format , i mean its saying the player was killed by admin[ID:66] and no resaon, and sometimes the reason is full of weird characters
Re: Strange bug, wierd characters -
Dayrion - 28.01.2017
PHP код:
format(string, sizeof(string), "Jucatorul %s (ID: %i) a fost omorat de adminul %s[ID:%d] (Motiv: %s)", pName(id), id, pName(playerid), playerid, reason);
Test it.
Re: Strange bug, wierd characters -
Banditul18 - 28.01.2017
Quote:
Originally Posted by Dayrion
PHP код:
format(string, sizeof(string), "Jucatorul %s (ID: %i) a fost omorat de adminul %s[ID:%d] (Motiv: %s)", pName(id), id, pName(playerid), playerid, reason);
Test it.
|
I don't get it at all, its work , but how? lol
Edit: Such a noob, forget about id of player , nvm, thanks
Re: Strange bug, wierd characters -
Sew_Sumi - 28.01.2017
Here I was thinking that once you'd done the command that when you respawned you seemed to be frozen and having an odd message turn up...
That was just looking at the screenshot.
Re: Strange bug, wierd characters -
edyun - 28.01.2017
You had too many variables at the end of the format, the id variable was not necessary as it was not meant to be used,all he did was to add a place where he used the id variable,that s how it worked
Re: Strange bug, wierd characters -
Sew_Sumi - 28.01.2017
It was more to do with mixing up integers and strings in the format than too many variables...
That alone gives messed characters.
Re: Strange bug, wierd characters -
JaydenJason - 28.01.2017
Don't know if it's fixed yet but
Код:
"Jucatorul %s a fost omorat de adminul %s[ID:%d] (Motiv: %s)"
Код:
pName(id), id, pName(playerid), playerid, reason
Re: Strange bug, wierd characters -
Sew_Sumi - 29.01.2017
nvm, you posted up his code and simply colorized it with no explanation... That's not helping especially seeing as Dayrion posted up fixed code, and the OP even acknowledged it as fixed.