/GC OR /GiveCash Command
#1

Hey! I need to fix this to where I can send give the player cash (not set it) like i can /gc [id] [100000] but it doesnt take money from the person that types it. (this is for my admin system so i can give players money).

This is the script



pawn Код:
dcmd_setcash(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 3) {
        new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
        if(!strlen(tmp) || !strlen(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setcash [playerid] [amount]");
        new player1 = strval(tmp), cash = strval(tmp2), string[128];
        if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
            CMDMessageToAdmins(playerid,"SETCASH");
            format(string, sizeof(string), "You have set \"%s's\" cash to '$%d", pName(player1), cash); SendClientMessage(playerid,PINK,string);
            if(player1 != playerid) { format(string,sizeof(string),"Your cash been set to'$%d'", cash); SendClientMessage(player1,PINK,string); }
            ResetPlayerMoney(player1);
            return GivePlayerMoney(player1, cash);
        } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
Reply
#2

Simply add
pawn Код:
GivePlayerMoney( playerid, -( cash )) //giving negative cash is the same as subtracting.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)