Why the ban is not loading
#1

So i made a ban command and i set it that when a player gets banned it should set pInfo[playerid][banned] = 1; , which it does and save successfully but when the player connects and i check under onplayerreqestclass if the player is banned = 1; it doesnt kick the player it still spawn them..

Код:
CMD:ban(playerid, params[])
{
    new targetid, reason[24];
    if(sscanf(params, "us[24]", targetid, reason)) return SendClientMessage(playerid,error, "[USAGE]: /ban [PlayerName/Playerid] [reason]");
    if(strlen(reason) < 1 || strlen(reason) > 100) return SendClientMessage(playerid, error, "Your reason can only contain 1-100 characters.");
    if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, error, "Player not found.");
    {
        pInfo[targetid][Banned] = 1;
        format(astring, sizeof(astring), "AdmCmd: %s [%d] has been Banned by an Administrator.[Reason: %s]",GetName(targetid), targetid, reason);
        SendClientMessageToAll(red, astring);
        GameTextForPlayer(targetid, "~r~Banned", 5000, 5);
        format(astring, sizeof(astring), "AdmCmd: You have been banned from the server. You were banned by Administrator %s.", GetName(playerid));
        SendClientMessage(targetid, red, astring);
        SendClientMessage(targetid, red, "AdmCmd: If you think this ban is unfair post an appeal on our forums and take a screen shot of this message.");
        SetTimerEx("BanPlayer",200,false,"ud", targetid,2);

    }
    return true;
}
// onplayerrequestclass
if(pInfo[playerid][Banned] == 1)
    {
		SendClientMessage(playerid,red, "AdmCmd: This Account has been banned from the server.");
        SetTimerEx("KickPlayer",200,false,"u", playerid);
        format(astring, sizeof(astring),"AdmCmd: %s has been automatically kicked | reason: Account Banned", GetName(playerid));
        SendToAdmins(orange,astring);
        format(astring,sizeof(astring),"AdmCmd: %s has been kicked | Reason: Account Banned",GetName(playerid));
		WriteToLog(astring,"AccKickLog");
    }
I used this tutorial for how to check if the player is banned.
https://sampforum.blast.hk/showthread.php?tid=388612
Reply


Messages In This Thread
Why the ban is not loading - by 1fret - 28.12.2016, 03:28
Re: Why the ban is not loading - by coool - 28.12.2016, 04:16
Re: Why the ban is not loading - by 1fret - 28.12.2016, 05:10
Re: Why the ban is not loading - by coool - 28.12.2016, 05:16
Re: Why the ban is not loading - by RedRex - 28.12.2016, 07:04
Re: Why the ban is not loading - by 1fret - 28.12.2016, 12:38

Forum Jump:


Users browsing this thread: 2 Guest(s)