ID 0 Bug
#4

You didn't open or close that if(!IsPlayerConnected(PID)).

Get used to open and close those if with { and }.

To sum up what you wrote:
if player is not conected then show the message with his name on it. (Not actually possible to retrieve the name of someone who does not exist).

Fix:

Код:
CMD:kick(playerid, params[])
    {
        if(PlayerInfo[playerid][pAdmin] > 0) 
		{
            new PID; //define the playerid we wanna kick
            new reason[64]; //the reason, put into a string
            new str[128]; //a new message string
            new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
            GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
            GetPlayerName(PID, Playername, sizeof(Playername));
            if(sscanf(params, "us[64]", PID,reason))
			{
				return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
			}
			else
			{
	            if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
				{
	                return SendClientMessage(playerid, COLOR_GREY, "That player is not connected.");
				}
				else
				{
					format(str, sizeof(str), "%s has been kicked by administrator %s for reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
					SendClientMessageToAll(COLOR_RED, str); //send that message to all
					Kick(PID); //kick the playerid we've defined
				}
			}
		}
        else //if he has not got the permissions
        {
            SendClientMessage(playerid, COLOR_GREY, "You have to be level 1 to use that command."); //return this message
        }
        return 1;
    }
This should be enough to fix that. I used Notepad++ to check that all brackets are opened and closed.

Greetings.
Reply


Messages In This Thread
ID 0 Bug - by NoahF - 30.06.2013, 13:11
Re: ID 0 Bug - by Red_Dragon. - 30.06.2013, 13:18
Re: ID 0 Bug - by tyler12 - 30.06.2013, 13:25
Re: ID 0 Bug - by 6Dragon6 - 30.06.2013, 13:27
Re: ID 0 Bug - by -=Dar[K]Lord=- - 30.06.2013, 13:29
Re: ID 0 Bug - by NoahF - 30.06.2013, 13:34
Re: ID 0 Bug - by -=Dar[K]Lord=- - 30.06.2013, 13:36
Re: ID 0 Bug - by NoahF - 30.06.2013, 13:38
Re: ID 0 Bug - by -=Dar[K]Lord=- - 30.06.2013, 13:38
Re: ID 0 Bug - by NoahF - 30.06.2013, 13:40

Forum Jump:


Users browsing this thread: 1 Guest(s)