Givecash command not working
#4

Quote:
Originally Posted by Bleach79
Посмотреть сообщение
Try This




Or

Code:

if(strcmp(cmd, "/givecash", true) == 0) { new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]"); return 1; } giveplayerid = strval(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]"); return 1; } moneys = strval(tmp); if (IsPlayerConnected(giveplayerid)) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); playermoney = GetPlayerMoney(playerid); if (moneys > 0 && playermoney >= moneys) { GivePlayerMoney(playerid, (0 - moneys)); GivePlayerMoney(giveplayerid, moneys); format(string, sizeof(string), "You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys); SendClientMessage(playerid, COLOR_YELLOW, string); format(string, sizeof(string), "You have recieved $%d from %s(player: %d).", moneys, sendername, playerid); SendClientMessage(giveplayerid, COLOR_YELLOW, string); } else { SendClientMessage(playerid, COLOR_YELLOW, "Invalid amount."); } } else { format(string, sizeof(string), "%d is not an active player.", giveplayerid); SendClientMessage(playerid, COLOR_YELLOW, string); } return 1; }
Are you for real?


Quote:
Originally Posted by Allu
Посмотреть сообщение
pawn Код:
new giveplayerid, moneys, idx;
new playermoney;
pawn Код:
if(strcmp(cmd, "/givecash", true) == 0) {
        new tmp[256];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
            return 1;
        }
        giveplayerid = strval(tmp);
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
            return 1;
        }
        moneys = strval(tmp);
        if (IsPlayerConnected(giveplayerid))
        {
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            playermoney = GetPlayerMoney(playerid);
            if (moneys > 0 && playermoney >= moneys)
            {
                GivePlayerMoney(playerid, (0 - moneys));
                GivePlayerMoney(giveplayerid, moneys);
                format(string, sizeof(string), "You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
                SendClientMessage(playerid, COLOR_YELLOW, string);
                format(string, sizeof(string), "You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
                SendClientMessage(giveplayerid, COLOR_YELLOW, string);
            }
            else
            {
                SendClientMessage(playerid, COLOR_YELLOW, "Invalid amount.");
            }
        }
        else
        {
            format(string, sizeof(string), "%d is not an active player.", giveplayerid);
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }
        return 1;
    }
NOTE:This is copied off from lvdm script
I use my commands like this tho.


pawn Код:
if (strcmp("/gc", cmdtext, true, 10) == 0)
    {
Reply


Messages In This Thread
Givecash command not working - by captainjohn - 10.04.2012, 19:18
Re: Givecash command not working - by Allu - 10.04.2012, 19:37
Re: Givecash command not working - by Bleach79 - 10.04.2012, 19:38
Re: Givecash command not working - by captainjohn - 10.04.2012, 20:02

Forum Jump:


Users browsing this thread: 1 Guest(s)