SA-MP Forums Archive
This command didn't kick me - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: This command didn't kick me (/showthread.php?tid=199343)



This command didn't kick me - Basicz - 15.12.2010

Okay, I've logged in to RCON, and typed /kick 0 testreason ( 0 is the player ID ).

pawn Код:
COMMAND:kick( playerid, params[ ] )
{
    if ( IsPlayerAdmin( playerid ) )
    {
        new
            toplayerid,
            reason;

        if ( sscanf( params, "us[128]", toplayerid, reason ) )
        {
            SendClientMessage( playerid, 0xFFFFFF, "Syntax Error: /Kick < Playerid > < Reason >" );
            return 1;
        }

        if ( toplayerid == INVALID_PLAYER_ID )
        {
            SendClientMessage( playerid, 0xFFFFFF, "Input Error: Player is not connected or it is yourself." );
            return 1;
        }
       
        new
            kickString[ 128 ],
            adminName[ 24 ],
            kickedName[ 24 ];

        GetPlayerName( playerid, adminName, 24 );
        GetPlayerName( toplayerid, kickedName, 24 );

        format( kickString, 128, "{EE5555}Admin Command {FFFFFF}: Player %s was kicked by Administrator %s with the reason : %s.",
        kickedName, adminName, reason );

        SendClientMessageToAll( 0xFFFFFF, kickString );

        Kick( toplayerid );
    }
    return 1;
}
EDIT: Also, vehicle will create more.
The X Y position is same, but the Z is higher.


Re: This command didn't kick me - Benjo - 15.12.2010

You just need to declare your variable "reason" as an array:

pawn Код:
COMMAND:kick( playerid, params[ ] )
{
    if ( IsPlayerAdmin( playerid ) )
    {
        new
            toplayerid,
            reason[ 128 ]; // <------------- CHANGED THIS BIT HERE <----------------

        if ( sscanf( params, "us[128]", toplayerid, reason ) )
        {
            SendClientMessage( playerid, 0xFFFFFF, "Syntax Error: /Kick < Playerid > < Reason >" );
            return 1;
        }

        if ( toplayerid == INVALID_PLAYER_ID )
        {
            SendClientMessage( playerid, 0xFFFFFF, "Input Error: Player is not connected or it is yourself." );
            return 1;
        }
       
        new
            kickString[ 128 ],
            adminName[ 24 ],
            kickedName[ 24 ];

        GetPlayerName( playerid, adminName, 24 );
        GetPlayerName( toplayerid, kickedName, 24 );

        format( kickString, 128, "{EE5555}Admin Command {FFFFFF}: Player %s was kicked by Administrator %s with the reason : %s.",
        kickedName, adminName, reason );

        SendClientMessageToAll( 0xFFFFFF, kickString );

        Kick( toplayerid );
    }
    return 1;
}



Re: This command didn't kick me - Basicz - 15.12.2010

Thanks Benjo!
Trying it right now.

EDIT:
The command you showed works Benjo, thanks for fixing it.
And also thanks for the information.


Re: This command didn't kick me - Benjo - 15.12.2010

No problem Things like this are always easier to catch with an extra set of eyes! Nice looking code btw, very neat and tidy