Strange bug, wierd characters
#1

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)
Reply
#2

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

Код:
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
Reply
#4

PHP код:
    format(stringsizeof(string), "Jucatorul %s (ID: %i) a fost omorat de adminul %s[ID:%d] (Motiv: %s)"pName(id), idpName(playerid), playeridreason); 
Test it.
Reply
#5

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
PHP код:
    format(stringsizeof(string), "Jucatorul %s (ID: %i) a fost omorat de adminul %s[ID:%d] (Motiv: %s)"pName(id), idpName(playerid), playeridreason); 
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
Reply
#6

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

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

It was more to do with mixing up integers and strings in the format than too many variables...

That alone gives messed characters.
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)