25.08.2012, 12:24
Hello everybody, this is my first thread here so both good critics and bad are accepted. However, Iґve been working with PAWN for several years. In this topic you will learn how to do a /ban and /kick command easily.
First include this files on top of your script:
Then we can proceed to creating the commands:
The ban command:
The kick command:
Please comment if it didnґt work for you or if you have any request to be added, because iґm more than happy to help you.
First include this files on top of your script:
Code:
#include <a_samp> #include <zcmd> #include <sscanf2>
The ban command:
Code:
CMD:ban(playerid,params[]) { new targetid; if(!sscanf(params, "u", targetid)) { if(IsPlayerAdmin(playerid)) //Checks if player is RCON. Can also change it to PlayerInfo[playerid][pAdmin] { if(IsPlayerConnected(targetid)) //Checks if the player to be banned is connected { SendClientMessage(playerid,-1,"SERVER: You have been banned from the server.");//Sends the banned a message Ban(targetid); //Bans him } } } return 1; }
Code:
CMD:kick(playerid,params[]) { new targetid; if(!sscanf(params, "u", targetid)) { if(IsPlayerAdmin(playerid)) //Checks if player is RCON. Can also change it to PlayerInfo[playerid][pAdmin] { if(IsPlayerConnected(targetid)) //Checks if the player to be kicked is connected { SendClientMessage(playerid,-1,"SERVER: You have been kicked from the server.");//Sends the kicked a message Kick(targetid); //Kicks him } } } return 1; }