Taking money
#1

I don't get it, why does this not work?
pawn Код:
if(GetPlayerMoney(playerid) >= 20000)
{
GivePlayerMoney(playerid,- 20000);
//other stuff here
}
Reply
#2

How does it not work? It works fine for me.
Reply
#3

I'm pretty sure that a space is not allowed between -20000.
Reply
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
I'm pretty sure that a space is not allowed between -20000.
I tested it and it works fine with the space
Reply
#5

pawn Код:
switch(listitem)
            {
                case 0:
                {
                    if(GetPlayerMoney(playerid) >= 20000)
                    {
                        ShowPlayerDialog(playerid,windsorshop,0,"Windsor","Do you want to buy this vehicle for \n$20 000 ?","Yes","No");
                        GivePlayerMoney(playerid,- 20000);
                        return 1;
                    }
                    else if(GetPlayerMoney(playerid) < 20000)
                    {
                        ShowPlayerDialog(playerid,windsorshop,0,"Windsor","Do you want to buy this vehicle for \n$20 000 ?","Yes","No");
                        SendClientMessage(playerid,0xFF0000FF,"You don't have enough money");
                        return 1;
                    }
                }
            }
Reply
#6

Quote:
Originally Posted by RedFusion
Посмотреть сообщение
pawn Код:
switch(listitem)
            {
                case 0:
                {
                    if(GetPlayerMoney(playerid) >= 20000)
                    {
                        ShowPlayerDialog(playerid,windsorshop,0,"Windsor","Do you want to buy this vehicle for \n$20 000 ?","Yes","No");
                        GivePlayerMoney(playerid,- 20000);
                        return 1;
                    }
                    else if(GetPlayerMoney(playerid) < 20000)
                    {
                        ShowPlayerDialog(playerid,windsorshop,0,"Windsor","Do you want to buy this vehicle for \n$20 000 ?","Yes","No");
                        SendClientMessage(playerid,0xFF0000FF,"You don't have enough money");
                        return 1;
                    }
                }
            }
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext [ ])
{
    switch(dialogid)
    {
        case 25:
            {
            switch(listitem)
                {
                    case 0:
                    {
                        if(!response) return 0;
                        if(response)
                        {
                            if(GetPlayerMoney(playerid) >= 20000)
                            {
                                ShowPlayerDialog(playerid, 28,0,"Windsor","Do you want to buy this vehicle for \n$20 000 ?","Yes","No");
                                return 1;
                            }
                            else if(GetPlayerMoney(playerid) < 20000)
                            {
                                ShowPlayerDialog(playerid, 27, 0,"Windsor","Do you want to buy this vehicle for \n$20 000 ?","Yes","No");
                                SendClientMessage(playerid,0xFF0000FF,"You don't have enough money");
                                return 1;
                            }
                        }
                    }
                }
            }
            case 28:
            {
                if(!response) return 0;
                if(response)
                {
                    GivePlayerMoney(playerid,- 20000);
                }
            }
        }
    return 0;
}
Replace the IDs accordingly.

The solution is pretty self-explanatory.
Reply
#7

Maybe you have a server-sided stat that constantly keeps setting the player money?
Those systems are used to prevent money hackers ..
Reply
#8

I'll try DBan's first and if it doesnt work then i'll check for anticheat scripts, thanks for the help!
EDIT: Dban's suggestion worked out. Thanks both of you
Reply
#9

He's not trying to get rid of someone's money once it surpasses 20,000. He's trying to make the server take away 20,000 after he has accepted to purchase a vehicle. Which he hasn't done very efficiently, seeing as it is taking the money before the player has even accepted, however Derek's solution should work.

EDIT:
pawn Код:
else if(GetPlayerMoney(playerid) < 20000)
                            {
                                ShowPlayerDialog(playerid, 27, 0,"Windsor","Do you want to buy this vehicle for \n$20 000 ?","Yes","No");
                                SendClientMessage(playerid,0xFF0000FF,"You don't have enough money");
                                return 1;
                            }
Shouldn't the dialog NOT be displayed if they don't have enough money?
Reply
#10

Quote:
Originally Posted by clarencecuzz
Посмотреть сообщение
He's not trying to get rid of someone's money once it surpasses 20,000. He's trying to make the server take away 20,000 after he has accepted to purchase a vehicle. Which he hasn't done very efficiently, seeing as it is taking the money before the player has even accepted, however Derek's solution should work.

EDIT:
pawn Код:
else if(GetPlayerMoney(playerid) < 20000)
                            {
                                ShowPlayerDialog(playerid, 27, 0,"Windsor","Do you want to buy this vehicle for \n$20 000 ?","Yes","No");
                                SendClientMessage(playerid,0xFF0000FF,"You don't have enough money");
                                return 1;
                            }
Shouldn't the dialog NOT be displayed if they don't have enough money?
HAHAHA, now I know why I recognized your name, you were on NVCNR? lol

And yes, I noticed that but left it for him to remove.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)