Id 0 always getting kicked/banned/warned instead of correct id.
#1

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.

Код:
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);
}
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
Reply
#2

Show DelayedBan public
public DelayedKick(playerid, kickedid) should be public DelayedKick(kickedid) because kickedid is always ID 0
Reply
#3

DelayedBan is the same, but Ban(bannedid)
Nope, nevermind. I tested using id 0, it still doesn't work. BUMP
Reply
#4

and this is wrong because bannedid is always 0, remove playerid part from public DelayedBan and DelayedKick
Reply
#5

No, I did it, still doesn't work. I didn't use a good player to test. It had id 0 ... Please help.
Reply
#6

Try

Код:
public DelayedBan(playerid, reason[])
{
    BanEx(playerid, reason);
}
Reply
#7

I deleted my sscanf, reinstalled, and now it seems to work. Looks like my sscanf was corrupted, but I did nothing to it. Its good now, thanks for everyone and sorry for this post, kind of worthless.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)