SA-MP Forums Archive
Help with /kick command. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with /kick command. (/showthread.php?tid=299719)



Help with /kick command. - Vic1990 - 27.11.2011

Here is my command:
Код:
COMMAND:kick(playerid, params[]) //using ZCMD this is how your command will start off looking like.
{
    if(PlayerInfo[playerid][pAdmin] <= 2)
    {
        new otherplayerid, reason[128];
        if(sscanf(params, "uz", otherplayerid, reason)) // split input string and check level value 0 to 5
            SendClientMessage(playerid, 0xFFFFFFFF, "/kick [playerid/name] [reason]");
        else if(otherplayerid == INVALID_PLAYER_ID) // Check player connected
            SendClientMessage(playerid, 0xFFFFFFFF, "This player is not connected");
        else
        {
            new string[32];
            format(string, sizeof(string), "Admin %s kicked %s | Reason: %s", GetPlayerNameEx(playerid), GetPlayerNameEx(otherplayerid), reason);
            SendClientMessageToAll(0xFFFFFFFF,string);
            Kick(otherplayerid);
        }
    }
    else
    {
        SendClientMessage(playerid, 0xAAAAAAAA, "You are not admin or the required level.");
    }
    return 1;
}
I get this error:
Код:
C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(884) : error 017: undefined symbol "GetPlayerNameEx"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
When I remove the Ex at the end of 'GetPlayerNameEx' I get these warnings:
Код:
C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(884) : warning 202: number of arguments does not match definition
C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(884) : warning 202: number of arguments does not match definition
C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(884) : warning 202: number of arguments does not match definition
C:\Users\admin\Desktop\Server\gamemodes\Server.pwn(884) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Warnings.



Re: Help with /kick command. - GAMER_PS2 - 27.11.2011

Here you go its fixed

pawn Код:
COMMAND:kick(playerid, params[]) //using ZCMD this is how your command will start off looking like.
{
    if(PlayerInfo[playerid][pAdmin] <= 2)
    {
        new adminname[MAX_PLAYER_NAME],pname[MAX_PLAYER_NAME],otherplayerid, reason[128];
        GetPlayerName(otherplayerid,pname,sizeof(pname));
        GetPlayerName(playerid,adminname,sizeof(adminname));
        if(sscanf(params, "uz", otherplayerid, reason))
            SendClientMessage(playerid, 0xFFFFFFFF, "/kick [playerid/name] [reason]");
        else if(otherplayerid == INVALID_PLAYER_ID)
            SendClientMessage(playerid, 0xFFFFFFFF, "This player is not connected");
        else
        {
            new string[32];
            format(string, sizeof(string), "Admin %s kicked %s | Reason: %s",adminname,pname, reason);
            SendClientMessageToAll(0xFFFFFFFF,string);
            Kick(otherplayerid);
        }
    }
    else
    {
        SendClientMessage(playerid, 0xAAAAAAAA, "You are not admin or the required level.");
    }
    return 1;
}



Re: Help with /kick command. - Vic1990 - 27.11.2011

Thankyou heaps. Really appreciated. Rep +1


Re: Help with /kick command. - GAMER_PS2 - 27.11.2011

No problem