[FilterScript] SoulLedgers Custom Kick/Ban System
#1

SoulLedgers Custom Kick/Ban System

Hello all, this is my custom kick/ban system, this is for new scripters who aren't used to making systems, its a simple one but even a simple system can help a new scripter figure out how everything works.

What does this system do?
What this system does is every time you kick someone it will send the user who is being kicked/banned a message on why they have gotten kicked/banned. It set on timers so when an admin kicks/bans a player is will set the target on a 1 second timer before kicking/banning them so that the target receives the message!

Code
pawn Код:
// SoulLedgers kick/ban system
// Created by Soulledger

#include <a_samp>
#include <zcmd>
#include <sscanf2>

#define SERVER_NAME         "CHANGE ME ON LINE 6"

forward KickPublic(playerid);
forward BanPublic(playerid);

public OnFilterScriptInit()
{
    print("SoulLedgers kick/ban system");
    print("Loaded succesfuly!");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnPlayerConnect(playerid)
{
    new string[168];
    format(string, sizeof(string), "SERVER: %s uses {F81414}SoulLedgers {FFAF00}Kick/Ban System!", SERVER_NAME);
    SendClientMessage(playerid, 0xFFFFFFFF, string);
    return 1;
}

CMD:kick(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))
    {
        new targetid, reason[64], string[128];
        if(sscanf(params, "uz", targetid, reason)) return SendClientMessage(playerid, 0x33CCFFAA, "[SYNTAX]: /kick [PlayerID/PartOfName] [Reason]");
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFF3300AA, "[ERROR]: Player not connected!");
            new pTargetName[24], pName[24];
            GetPlayerName(playerid,pName,24);
            GetPlayerName(targetid,pTargetName,24);
            format(string, sizeof(string), "SERVER: Administrator %s has kicked %s, Reason: %s", pName, pTargetName, reason);
            SendClientMessageToAll(0xFFFFFFFF, string);
            format(string, sizeof(string),  "-------------------------------------------------------------------------------------------------");
            KickMessage(targetid, 0xAFAFAFAA, string);
            format(string, sizeof(string), "%s Administration Team", SERVER_NAME);
            KickMessage(targetid, 0xFF3300AA, string);
            format(string, sizeof(string), "You have been kicked by administrator %s for the following reason,", pName);
            KickMessage(targetid, 0xAFAFAFAA, string);
            format(string, sizeof(string), "%s.", reason);
            KickMessage(targetid, 0xAFAFAFAA, string);
            format(string, sizeof(string), "Please make sure you do not do this again. If you do this again you will have a chance of being");
            KickMessage(targetid, 0xAFAFAFAA, string);
            format(string, sizeof(string), "banned!");
            KickMessage(targetid, 0xAFAFAFAA, string);
            format(string, sizeof(string), "-------------------------------------------------------------------------------------------------");
            KickMessage(targetid, 0xAFAFAFAA, string);
    }
    return SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: You are not authorized to use this command!");
}

CMD:ban(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))
    {
        new targetid, reason[64], string[128];
        if(sscanf(params, "uz", targetid, reason)) return SendClientMessage(playerid, 0x33CCFFAA, "[SYNTAX]: /ban [PlayerID/PartOfName] [Reason]");
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFF3300AA, "[ERROR]: Player not connected!");
            new pTargetName[24], pName[24];
            GetPlayerName(playerid,pName,24);
            GetPlayerName(targetid,pTargetName,24);
            format(string, sizeof(string), "SERVER: Administrator %s has kicked %s, Reason: %s", pName, pTargetName, reason);
            SendClientMessageToAll(0xFFFFFFFF, string);
            format(string, sizeof(string),  "-------------------------------------------------------------------------------------------------");
            BanMessage(targetid, 0xAFAFAFAA, string);
            format(string, sizeof(string), "%s Administration Team", SERVER_NAME);
            BanMessage(targetid, 0xFF3300AA, string);
            format(string, sizeof(string), "You have been kicked by administrator %s for the following reason,", pName);
            BanMessage(targetid, 0xAFAFAFAA, string);
            format(string, sizeof(string), "%s.", reason);
            BanMessage(targetid, 0xAFAFAFAA, string);
            format(string, sizeof(string), "Please make sure you do not do this again. If you do this again you will have a chance of being");
            BanMessage(targetid, 0xAFAFAFAA, string);
            format(string, sizeof(string), "banned!");
            BanMessage(targetid, 0xAFAFAFAA, string);
            format(string, sizeof(string), "-------------------------------------------------------------------------------------------------");
            BanMessage(targetid, 0xAFAFAFAA, string);
    }
    return SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: You are not authorized to use this command!");
}

public KickPublic(playerid)
{
    Kick(playerid);
}

public BanPublic(playerid)
{
    Ban(playerid);
}

stock KickMessage(playerid, color, message[])
{
    SendClientMessage(playerid, color, message);
    SetTimerEx("KickPublic", 1000, 0, "d", playerid);
}

stock BanMessage(playerid, color, message[])
{
    SendClientMessage(playerid, color, message);
    SetTimerEx("BanPublic", 1000, 0, "d", playerid);
}
Reply
#2

Good job
Reply
#3

Useful..
Reply
#4

awesome +repped

you can also use mine code for kicking / banning

pawn Код:
stock Wait(time)
{
    new stamp = tickcount();
    while (tickcount() - stamp < time)
    {
    }
    return 1;
}
pawn Код:
public OnPlayerDoSomething(playerid, action)
{
   new str[256];
   Wait(5000);
   format(str, sizeof(str), "u got kicked for the following reason : %d", action);
   SendClientMessage(playerid, COLOR_DANGER, str);
   Kick(playerid);
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)