/warn and /deletewarns Commands +REP
#1

can anyone tell me how to make /warn and /deletewarns commands please? and explain to me how to make one.

I use this variable:
pawn Код:
PlayerInfo[playerid][pAdmin]
For admin levels.
Reply
#2

comment deleted..
Reply
#3

pawn Код:
if(strcmp(cmd, "/warn", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /warn [id] [reason]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if (PlayerInfo[playerid][pAdmin] >= AdminLevel)
            {
Reply
#4

well i know the basics,but i need someone give me an example of warn command and deletewarns and explain
Reply
#5

Give player warn.
pawn Код:
PlayerInfo[giveplayerid][pWarned] = 1;
So admins doesn't do this on higher level.
pawn Код:
new targetlevel = PlayerInfo[giveplayerid][pAdmin];
                        new playerlevel = PlayerInfo[playerid][pAdmin];
                        if(targetlevel > playerlevel) return SendClientMessage(playerid, COLOR_GREY, "* You can not ban People that is higher Than You!");
Reply
#6

thanks clad for helping me
Reply
#7

Quote:
Originally Posted by Youssef214
Посмотреть сообщение
thanks clad for helping me
You're welcome .
Reply
#8

Simple command of warning with kick able.
pawn Код:
new Warnings[MAX_PLAYERS]; //on top of your script

CMD:warn(playerid, params[])
{
    new targetid, reason[128], string[128];
    if(PlayerInfo[playerid][pAdmin] == 0) return 0;
    if(sscanf(params, "us[128]", targetid, reason)) return SendClientMessage(playerid, -1, "/warn [playerid/name] [reason]");
    if(!IsPlayerConnected(targetid))return SendClientMessage(playerid, -1, "This player is not connected.");
    if(targetid == playerid) return SendClientMessage(playerid,-1,"You cannot use this command on yourself.");

    if(Warnings[targetid] < 4)
    {
        Warnings[targetid] ++;
        format(string, sizeof(string), "%s(%d) has been Warned by an Administrator, reason: %s", GetName(targetid), targetid, reason);
        SendClientMessageToAll(-1, string);
    }
    else //if warning = 5 it will kick player id
    {
        format(string, sizeof(string), "%s(%d) Has Been Kicked From The Server,t reason: so much warnings", GetName(targetid), targetid);
        SendClientMessageToAll(-1, string);
        Kick(targetid);
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by Juvanii
Посмотреть сообщение
Simple command of warning with kick able.
pawn Код:
new Warnings[MAX_PLAYERS]; //on top of your script

CMD:warn(playerid, params[])
{
    new targetid, reason[128], string[128];
    if(PlayerInfo[playerid][pAdmin] == 0) return 0;
    if(sscanf(params, "us[128]", targetid, reason)) return SendClientMessage(playerid, -1, "/warn [playerid/name] [reason]");
    if(!IsPlayerConnected(targetid))return SendClientMessage(playerid, -1, "This player is not connected.");
    if(targetid == playerid) return SendClientMessage(playerid,-1,"You cannot use this command on yourself.");

    if(Warnings[targetid] < 4)
    {
        Warnings[targetid] ++;
        format(string, sizeof(string), "%s(%d) has been Warned by an Administrator, reason: %s", GetName(targetid), targetid, reason);
        SendClientMessageToAll(-1, string);
    }
    else //if warning = 5 it will kick player id
    {
        format(string, sizeof(string), "%s(%d) Has Been Kicked From The Server,t reason: so much warnings", GetName(targetid), targetid);
        SendClientMessageToAll(-1, string);
        Kick(targetid);
    }
    return 1;
}
First of all he got his help and you don't need to re-bump it, You could answer to others.
Second, Copying a cmd from a gamemode you have downloaded won't help him to learn at all.
Reply
#10

Quote:
Originally Posted by Clad
Посмотреть сообщение
First of all he got his help and you don't need to re-bump it, You could answer to others.
Second, Copying a cmd from a gamemode you have downloaded won't help him to learn at all.
1. If he got a help, it doesn't mean that no one can help him more.
2. I made this command by myself and i use it in my server. i'm scripter since 2012 and haven't downloaded any gamemodes in my life.
3. If it's from a gamemode, i would put the credits for people whom made this command.
4. Why are you so mad like this? go and have a beer.
Reply


Forum Jump:


Users browsing this thread: