SA-MP Forums Archive
Kick and ban - 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: Kick and ban (/showthread.php?tid=142539)



Kick and ban - Dolph - 18.04.2010

pawn Код:
dcmd_ban(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    new reason, pid;
    if(sscanf(params,"u",pid)) SendClientMessage(playerid, 0xF60000AA, "USAGE: /ban [playerid][reason](optional)");
    else
    {
        new name[MAX_PLAYER_NAME],string[128];
        GetPlayerName(pid,name,sizeof(name));
        format(string,sizeof(string),"%s has been banned. Reason: %i",name,reason);
        SendClientMessageToAll(0xF60000AA,string);
        Ban(pid);
        return 1;
    }
    return 1;
}

dcmd_kick(playerid, params[])
{  
    if(!IsPlayerAdmin(playerid)) return 0;
    new reason, pid;
    if(sscanf(params,"u",pid)) SendClientMessage(playerid, 0xF60000AA, "USAGE: /kick [playerid][reason](optional)");
    else
    {
        new name[MAX_PLAYER_NAME],string[128];
        GetPlayerName(pid,name,sizeof(name));
        format(string,sizeof(string),"%s has been kicked. Reason: %i",name,reason);
        SendClientMessageToAll(0xF60000AA,string);
        Kick(pid);
        return 1;
    }
    return 1;
}
It bans the player and all that, the problem is that when I type in the reason, it only comes: "Player is banned. Reason: 0"



Re: Kick and ban - Correlli - 18.04.2010

Because you forgot to add a reason array and type at the sscanf-check.