27.08.2015, 01:28
(
Последний раз редактировалось hydravink; 27.08.2015 в 02:00.
)
I made some admin commands, some working good, like /jail, /freeze. These apply to the corect player id.
However I got these commands: /ban /kick /warn /mute which don't work good.
I looked for this bug and its common, but I still couldn't find a fix. ID 0 always gets kicked banned etc instead of the id I put. Also, when a player reaches 3/3 warns, for example id 5 reaches 3/3 warns, id 0 is kicked. When id 5 mute time expires, id 0 is being unmuted. I don't get what is wrong. Sscanf is updated.
Here is some code, just a command so you can see what I'm talking about.
What is strange is that some commands work, they are the same format at this... No problems. But kick and ban are a little bit special, with this Delay function... I guess here is the problem...
Please help, thanks
However I got these commands: /ban /kick /warn /mute which don't work good.
I looked for this bug and its common, but I still couldn't find a fix. ID 0 always gets kicked banned etc instead of the id I put. Also, when a player reaches 3/3 warns, for example id 5 reaches 3/3 warns, id 0 is kicked. When id 5 mute time expires, id 0 is being unmuted. I don't get what is wrong. Sscanf is updated.
Here is some code, just a command so you can see what I'm talking about.
Код:
CMD:ban(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] > 4) { new bannedid, reason[128], adminName[MAX_PLAYER_NAME], playerName[MAX_PLAYER_NAME], string[256]; if(sscanf(params, "us[128]", bannedid, reason)) return SendClientMessage(playerid, COLOR_ORANGE, "** Syntax: /ban <playerid/name> <reason>"); if(!IsPlayerConnected(bannedid)) return SendClientMessage(playerid, COLOR_ERROR, "** The playerid/name you have typed isn't connected."); if(PlayerInfo[bannedid][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_ERROR, "** The playerid/name you have typed has a bigger level than you."); GetPlayerName(bannedid, playerName, sizeof(playerName)); GetPlayerName(playerid, adminName, sizeof(adminName)); format(string, sizeof(string), "** Admin %s has banned %s for: %s", adminName, playerName, reason); SendClientMessageToAll(COLOR_ERROR, string); SetTimerEx("DelayedBan", 500, false, "d", bannedid); }else{ SendClientMessage(playerid, COLOR_ERROR, "** Only level 5 admins can use this command."); } return 1; } public DelayedBan(playerid, bannedid, reason[]) { BanEx(bannedid, reason); }
Please help, thanks