Gamemode: Money Bug/Error
#1

Well, recently, I've been working on my own gamemode and I created a gun store also I've got a command that allows you to give a player cash /givecash. The annoying thing is that.. lets say you had $10,000 and a M4A1 cost $5,000.. right so after you've bought one you'd should have $5,000 left, right? well on my server it gives you an actual -$5,000 which sucks. Also /givecash same thing, it gives you the actual amount and not just adding the selected amount.

GIVE CASH
http://pastebin.com/uFdzqBXp

GUN STORE
http://pastebin.com/krfvcdFf
Reply
#2

You have ResetPlayerMoney(playa); in your code and GivePlayerMoney with the price of thing which you buy, the solution is you have to delete ResetPlayerMoney.
Reply
#3

well

PHP код:
if(strcmp(cmd"/givecash"true) == 0)
{
    if(
IsPlayerConnected(playerid))
    {
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))
        {
            
SendClientMessage(playeridCOLOR_GREY"USAGE: /givecash [player id/name] [money]");
            return 
1;
        }
        new 
playa;
        new 
money;
        
playa ReturnUser(tmp);
        
tmp strtok(cmdtextidx);
        
money strval(tmp);
        if (
PlayerInfo[playerid][pAdmin] >= 5)
        {
             if(
IsPlayerConnected(playa))
               {
                 if(
playa != INVALID_PLAYER_ID)
                   {
                     
GetPlayerName(playagiveplayersizeof(giveplayer));
                    
GetPlayerName(playeridsendernamesizeof(sendername));
                    
ConsumingMoney[playa] = 1;
                    
GivePlayerMoney(playamoney);
                }
            }
        }
        else
        {
            
SendClientMessage(playeridCOLOR_GREY"You are not a admin!");
        }
    }
    return 
1;

Reply
#4

why not giving him - money ?
Like
GivePlayerMoney(playerid, -5000);
Reply
#5

Alright, thanks guys!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)