/fine admin command.
#1

I have been searching for 30 minutes, and could only find it for cops, but basically I want this.

/fine [playerid] [amount] [reason]

I would make my own, but through just looking at commands like /kick, I didn't understand it.
Reply
#2

lol i made a cmd for my old server a while back with that cmd lol but when i get in ill make it into a FS or just post it here for you mate a i cba to write it all out lol
Reply
#3

use dcmd + sscanf with 3 values with this format: "uis" if reason is not optional and "uiz" if it is.
Reply
#4

This should work mate

pawn Код:
new FineMoney[MAX_PLAYERS];
pawn Код:
}
if(strcmp(cmd, "/fine", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] >= 5)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /fine [playerid/PartOfName] [price] [reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /fine [playerid/PartOfName] [price] [reason]");
return 1;
}
moneys = strval(tmp);
if(moneys < 1 || moneys > 99999 ) { SendClientMessage(playerid, COLOR_GREY, "  fine price can't be below 1 or higher then 99999 !"); return 1; }
if(IsPlayerConnected(giveplayerid))
{
 if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[64];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        if(!strlen(result))
                        {
                            SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /fine [playerid/PartOfName] [price] [reason]");
                            return 1;
                        }
                        format(string, sizeof(string), "* You gave %s a fine costing $%d, reason: %s", giveplayer, moneys, (result));
                        SendClientMessage(playerid,COLOR_LIGHTRED, string);
                        format(string, sizeof(string), "* ADMIN: %s has given you a fine costing $%d, reason: %s", sendername, moneys, (result));
                        SendClientMessageToAll(COLOR_LIGHTRED, string);
                        FineMoney[giveplayerid] = moneys;
                        SafeGivePlayerMoney(giveplayerid, - moneys);
                        return 1;
                                    }
            }
            else
            {
              SendClientMessage(playerid, COLOR_GREY, "  That player is Offline !");
              return 1;
            }
        }
        return 1;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)