SA-MP Forums Archive
Give Money instead of Taking ?(Dialog Shop) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Give Money instead of Taking ?(Dialog Shop) (/showthread.php?tid=347112)



Give Money instead of Taking ?(Dialog Shop) - [D]ry[D]esert - 31.05.2012

Hi all , The Title Explain its self
He is the Code:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 0)
    {
        if(response)
            {
                   
                    if(listitem == 0)
                    {
                            if(GetPlayerMoney(playerid) <= 4000) return SendClientMessage(playerid,-1,"No Enough Money");
                           
                           
                            GivePlayerWeapon(playerid,34,1000);
                            GivePlayerMoney(playerid,GetPlayerMoney(playerid) -4000);
                    }
                    if(listitem == 1)
                    {
                            if(GetPlayerMoney(playerid) <= 20000) return SendClientMessage(playerid,-1,"No Enough Money");
                           
                           
                            GivePlayerWeapon(playerid,16,10);
                            GivePlayerMoney(playerid,GetPlayerMoney(playerid) -7000);

                    }
                    if(listitem == 2)
                    {
                            if(GetPlayerMoney(playerid) <= 5000) return SendClientMessage(playerid,-1,"No Enough Money");
                           
                           
                            GivePlayerWeapon(playerid,24,400);
                            GivePlayerMoney(playerid,GetPlayerMoney(playerid) -5000);

                    }
                    if(listitem == 3)
                    {
                            if(GetPlayerMoney(playerid) <= 8000) return SendClientMessage(playerid,-1,"No Enough Money");
                           
                           
                            GivePlayerWeapon(playerid,26,500);
                            GivePlayerMoney(playerid,GetPlayerMoney(playerid) -8000);
                    }
                    if(listitem == 4)
                    {
                            if(GetPlayerMoney(playerid) <= 10000) return SendClientMessage(playerid,-1,"No Enough Money");
                           
                           
                            GivePlayerWeapon(playerid,27,500);
                            GivePlayerMoney(playerid,GetPlayerMoney(playerid) -10000);

                    }
                    if(listitem == 5)
                    {
                            if(GetPlayerMoney(playerid) <= 11000) return SendClientMessage(playerid,-1,"No Enough Money");
                           
                           
                            GivePlayerWeapon(playerid,28,600);
                            GivePlayerMoney(playerid,GetPlayerMoney(playerid) -11000);

                    }
                    if(listitem == 6)
                    {
                            if(GetPlayerMoney(playerid) <= 10000) return SendClientMessage(playerid,-1,"No Enough Money");
                           
                            GivePlayerWeapon(playerid,30,700);
                            GivePlayerMoney(playerid,GetPlayerMoney(playerid) -10000);

                    }
                    if(listitem == 7)
                    {
                            if(GetPlayerMoney(playerid) <= 19000) return SendClientMessage(playerid,-1,"No Enough Money");

                            GivePlayerWeapon(playerid,38,200);
                            GivePlayerMoney(playerid,GetPlayerMoney(playerid) -19000);

                    }
            }
        }
                       
    return 1;
}



Re: Give Money instead of Taking ?(Dialog Shop) - mati233 - 31.05.2012

You just need to do: GivePlayerMoney(playerid, -1000); and it will take 1000$ from that player


Re: Give Money instead of Taking ?(Dialog Shop) - pasha97 - 31.05.2012

delete GetPlayerMoney(playerid) in each function

It's not SetPlayeMoney, it's GivePlayerMoney!! Give not set


Re: Give Money instead of Taking ?(Dialog Shop) - MadeMan - 31.05.2012

pawn Код:
GivePlayerMoney(playerid,GetPlayerMoney(playerid) -4000);
should be

pawn Код:
GivePlayerMoney(playerid, -4000);
etc.


Re: Give Money instead of Taking ?(Dialog Shop) - [D]ry[D]esert - 31.05.2012

Okey Thanks Guys <3