ResetPlayerMoney
#1

Hello, i am new to the community and i am beggining to script.

I am tryign to make a command to reset someones money, like /resetmoney [playerid]
This is what i came up with but it will not work.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(IsPlayerAdmin(playerid))
    {
        if(!strcmp(cmdtext, "/resetmoney", true))
        {
            ResetPlayerMoney(playerid);
                        SendClientMessage(playerid, COLOR_NORMAL_PLAYER, "An admin has reset your money.");
                        print("You have set this players money.");
            return 1
}
PS:
pawn Код:
#define COLOR_NORMAL_PLAYER 0xFF4444FF
This is in the script.

Sorry for my newbieness...

/DaRealz
Reply
#2

Well.. first of all, you will need to be admin to use -every- command.
Second, you missing a bracket.
And third, playerid is the player who performs the command. To perform commands on other players use sscanf.

Why you don't learn the basics before making an admin system!?
Reply
#3

If you are beginning to script, I don't recommend starting with the old method of doing commands. Search for "zcmd", download it ( follow install instructions on that same thread ).

Now, once you got that file ready to use. We can do our commands faster than ever:
pawn Код:
#include <a_samp>
#include <zcmd>

// Rest of code

CMD:resetcash(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not admin!");
    if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Usage: /ResetCash < Player ID >");

    new
       ToPlayer = strval(params);

    if(!IsPlayerConnected(ToPlayer)) return SendClientMessage(playerid, COLOR_RED, "That user is not connected!");

    ResetPlayerMoney(ToPlayer);
    SendClientMessage(ToPlayer, COLOR_RED, "An admin has removed your cash!");
    return 1;
}

// Rest of code
That's way easier than the method you are doing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)