SA-MP Forums Archive
[Help] Made this little /fine command, help please - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] Made this little /fine command, help please (/showthread.php?tid=254462)



[Help] Made this little /fine command, help please - Sid_Alexander - 10.05.2011

i got this little /fine command, but the problem is whenever i /fine someone, they ask me the reaso after it, i was thinking to edit it and add something so i can fine and people can also see the reason
Example : USAGE: /fine [playerid] [amount] [reason]
Right now its : USAGEL /fine [playerid] [amount]

Here is my code

pawn Код:
if(strcmp(cmd, "/fine", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /fine [playerid/PartOfName] [amount]");
                return 1;
            }
            new playa;
            new money;
            playa = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            money = strval(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 1337)
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        SafeResetPlayerMoney(playa);
                        SafeGivePlayerMoney(playa, -money);
                        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, 256, "AdmCmd: %s has Fined %s  [Amount: $%d]", sendername,giveplayer,money);
                        SendClientMessageToAll(COLOR_LIGHTRED,string);
                    }
                }
   }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
            }
        }
        return 1;
    }



Re: [Help] Made this little /fine command, help please - dannyk0ed - 10.05.2011

That Ravens? Wonder why.


Re: [Help] Made this little /fine command, help please - Sid_Alexander - 10.05.2011

Quote:
Originally Posted by dannyk0ed
Посмотреть сообщение
That Ravens? Wonder why.
, Nope, my complete script and commands are made by me,Lucky & Steve

We not COPY CATS!


Re: [Help] Made this little /fine command, help please - dannyk0ed - 10.05.2011

I dont see what the problem is with Command :/ Sorry


Re: [Help] Made this little /fine command, help please - Sid_Alexander - 10.05.2011

Quote:
Originally Posted by dannyk0ed
Посмотреть сообщение
I dont see what the problem is with Command :/ Sorry
The problem is, we cant directly provide the reason with the command

The command is right now in this method : USAGE: /fine [playerid] [amount]
We Want to provide the reason so people can see and wont ask example : USAGE: /fine [playerid] [amount] [reason]

Difference we want : USAGE: /fine [playerid] [amount] "TO GET CHANGED INTO" : USAGE: /fine [playerid] [amount] [reason]


Re: [Help] Made this little /fine command, help please - Steven82 - 10.05.2011

Well you copy the coding style of ravens then...

Anyways, what i think you should do, is switch to ZCMD and sscanf, since well they are better in many reasons. And they just overall destroy strcmp commands.


Re: [Help] Made this little /fine command, help please - Sid_Alexander - 10.05.2011

Quote:
Originally Posted by Steven82
Посмотреть сообщение
Well you copy the coding style of ravens then...

Anyways, what i think you should do, is switch to ZCMD and sscanf, since well they are better in many reasons. And they just overall destroy strcmp commands.
About Ravens: We never saw that Script, And if you are talking about USAGE: Than we saw this in other roleplay servers, So we thought we'd keep the same

AGAIN WE NOT COPY CATS!


Re: [Help] Made this little /fine command, help please - Sid_Alexander - 10.05.2011

C'mon guys! Someone convert it to DCMD


Re: [Help] Made this little /fine command, help please - Laronic - 10.05.2011

Should work

Using sscanf and dcmd
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(fine, 4, cmdtext);
    return 0;
}

dcmd_fine(playerid, params[])
{
    new targetid, amount, reason[128];
    if(sscanf(params, "uus[128]", targetid, amount, reason)) return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /fine [playerid/name] [amount] [reason]");
    else if(PlayerInfo[playerid][pAdmin] != 1337) return SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
    else if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GRAD1, "Error: That player is not connected");
    {
        GetPlayerName(targetid, targetname, sizeof(targetname));
        GetPlayerName(playerid, playername, sizeof(playername));
        format(string, sizeof(string), "AdmCmd: %s has Fined %s  [Amount: $%d] because: %s", playername, targetname, amount, reason);
        SendClientMessageToAll(COLOR_LIGHTRED,string);
        SafeGivePlayerMoney(targetid, -amount);
    }
    return 1;
}



Re: [Help] Made this little /fine command, help please - Sid_Alexander - 10.05.2011

Maybe you should paste it without /pawn confusing paste it as /code