28.09.2014, 12:46
Hey, my kick command isn't kicking the player it's meant to kick, it keeps kicking me (the player using kick). Not sure what I'm doing wrong? Here's the command:
EDIT: It seems my ID 0 is bugged. I don't know what's going on. Whenever ID 0 tries to use a command, it uses it on himself. What am I doing wrong? I am not using sscanf at all.
Also, when it formats the strings, how do I get rid of the underscore when it says "was kicked by John_Doe"? I would like it to be "was kicked by John Doe" with a space instead of an underscore. In the normal chat, I've gotten rid of the underscores using
I've already created the stock for the above ^^
Whenever a string comes up, I'd rather a space display instead of the underscore.
Any help would be greatly appreciated. Thanks in advanced!
pawn Код:
if(listitem == 2)
{
new id;
new string[128];
new name[MAX_PLAYERS];
new name2[MAX_PLAYERS];
GetPlayerName(id, name2, sizeof(name2));
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "You have kicked %s from the server", name2);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "%s was kicked from the server by %s", name2, name);
SendClientMessageToAll(COLOR_WHITE, string);
Kick(id); // <-------- It's not kicking "id", it's kicking playerid
return 1;
}
Also, when it formats the strings, how do I get rid of the underscore when it says "was kicked by John_Doe"? I would like it to be "was kicked by John Doe" with a space instead of an underscore. In the normal chat, I've gotten rid of the underscores using
pawn Код:
public OnPlayerText(playerid, text[])
{
new string[128];
format(string,sizeof(string),"%s says: %s",RemoveUnderScore(playerid),text);
SendClientMessageToAll(COLOR_WHITE,string);
return 0;
}
pawn Код:
stock RemoveUnderScore(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if(name[i] == '_') name[i] = ' ';
}
return name;
}
Any help would be greatly appreciated. Thanks in advanced!



But I'm not sure how to add a value to my ID variable. How can I do that haha