SA-MP Forums Archive
how to make /ban command with this variable - 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: how to make /ban command with this variable (/showthread.php?tid=442225)



how to make /ban command with this variable - xFirex - 06.06.2013

hello, can you show the code how to make /ban command for this variable,tnx

pawn Код:
public OnPlayerConnect(playerid)
{
    if(PlayerInfo[playerid][GuVipBanned] == 1)
    {
    Kick(playerid);
    }



Re: how to make /ban command with this variable - MA_proking - 06.06.2013

Quote:
Originally Posted by xFirex
Посмотреть сообщение
hello, can you show the code how to make /ban command for this variable,tnx

pawn Код:
public OnPlayerConnect(playerid)
{
    if(PlayerInfo[playerid][GuVipBanned] == 1)
    {
    Kick(playerid);
    }
pawn Код:
CMD:ban(playerid,params[])
{
    new id;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You are not Admin");
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /ban [id]");
    PlayerInfo[id][GuVipBanned] = 1;
    new str[128];
    new name[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
    GetPlayerName(playerid, name, sizeof(name));
    format(str,sizeof(str),"You have been banned by %s [%d]", name, playerid);
    SendClientMessage(id, -1, str);
    Kick(id);
    return 1;
}



Re: how to make /ban command with this variable - xFirex - 06.06.2013

how to make with reason ?


Re: how to make /ban command with this variable - MA_proking - 06.06.2013

Quote:
Originally Posted by xFirex
Посмотреть сообщение
how to make with reason ?
pawn Код:
CMD:ban(playerid,params[])
{
    new id,reason[30];
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You are not Admin");
    if(sscanf(params, "us[30]", id,reason)) return SendClientMessage(playerid, -1, "USAGE: /ban [id] [reason]");
    PlayerInfo[id][GuVipBanned] = 1;
    new str[128];
    new name[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
    GetPlayerName(playerid, name, sizeof(name));
    format(str,sizeof(str),"You have been banned by %s [%d] Reason: %s", name, playerid, reason);
    SendClientMessage(id, -1, str);
    Kick(id);
    return 1;
}
I think this will work...