SA-MP Forums Archive
Need Help [+repp] - 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: Need Help [+repp] (/showthread.php?tid=524027)



Need Help [+repp] - Frankin - 04.07.2014

Greetings ,
I followed Tutorial on how to create Simple Admin System
And This is the final result : http://pastebin.com/F0N5G0uu
i didn't know to to add banned to player info at user.ini
and didn't know how to create the command

Could Somebody make them for me Please ?

and i will +repp him


Re: Need Help [+repp] - Frankin - 04.07.2014

Bump :$


Re: Need Help [+repp] - Max5 - 04.07.2014

If this what you mean:

pawn Код:
stock AddBan(ip[])
{
    if (CheckBan(ip) == 0)
    {
        new File: file = fopen("ban.cfg", io_append);
        new string[20];
        format(string, sizeof(string), "\n%s", ip);
        fwrite(file, string);
        fclose(file);
        foreach(Player, playerid)
        {
            new playerIP[16];
            GetPlayerIp(playerid, playerIP, sizeof(playerIP));
            if (strcmp(playerIP, ip) == 0)
            {
                SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are banned from this server.");
                Kick(playerid);
            }
        }
        return 1;
    }
    return 0;
}
Ban command:

pawn Код:
CMD:ban(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 2)
    {
        new string[128], giveplayerid, reason[64];
        if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /ban [playerid] [reason]");

        if(IsPlayerConnected(giveplayerid))
        {
            if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
            {
                format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /ban a higher admin.", GetPlayerNameEx(playerid));
                ABroadCast(COLOR_YELLOW,string,2);
                PlayerInfo[playerid][pBanned] = 1;
                new ip[32];
                GetPlayerIp(playerid,ip,sizeof(ip));
                AddBan(ip);
                Kick(playerid);
                return 1;
            }
            else
            {
                new year, month,day;
                getdate(year, month, day);
                new playerip[32];
                GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
                format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year);
                Log("logs/ban.log", string);
                format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
                SendClientMessageToAllEx(COLOR_LIGHTRED, string);
                PlayerInfo[giveplayerid][pBanned] = 1;
                format(PlayerInfo[giveplayerid][pFlag], 128, "");
                new ip[32];
                GetPlayerIp(giveplayerid,ip,sizeof(ip));
                AddBan(ip);
                Kick(giveplayerid);
                return 1;
            }

        }
    }
    else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
    return 1;
}



Re: Need Help [+repp] - Frankin - 05.07.2014

thanks
i'll test it