SA-MP Forums Archive
[HELP]Withdraw problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]Withdraw problem (/showthread.php?tid=196382)



[HELP]Withdraw problem - [Aka]Dragonu - 05.12.2010

I want the withdraw money command to be accesible from 2 areas so i made this :

pawn Код:
if(strcmp(cmd, "/withdraw", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_GREY, "USAGE: /withdraw [amount]");
            return 1;
        }
        giveplayerid = strval(tmp);
        if (PlayerToPoint(8, playerid,364.1431,173.7478,1008.3828)) || PlayerToPoint(10, playerid, -25.6093,-137.7065,1003.5469)
        {
            if(giveplayerid <= PlayerInfo[playerid][pBank] && giveplayerid >= 0)
            {
                format(string, sizeof(string), "You have withdrawed %d$ money from your bank account.",giveplayerid);
                SendClientMessage(playerid, COLOR_GREEN, string);
                GivePlayerMoney(playerid, giveplayerid);
                PlayerInfo[playerid][pBank] = PlayerInfo[playerid][pBank]-giveplayerid;
                CreateBankMoneyTextDraw(playerid);
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED,"You do not have that money on your bank, type /balance to view your bank money.");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED,"You must be at the bank to do this command.");
        }
        return 1;
    }
But if i compile i get these errors :

pawn Код:
D:\Games\GTA San Andreas\server\gamemodes\slrpg.pwn(9365) : error 029: invalid expression, assumed zero
D:\Games\GTA San Andreas\server\gamemodes\slrpg.pwn(9366) : error 001: expected token: ";", but found "{"
D:\Games\GTA San Andreas\server\gamemodes\slrpg.pwn(9380) : error 029: invalid expression, assumed zero



Re: [HELP]Withdraw problem - JaTochNietDan - 05.12.2010

You have an extra bracket here which is ending the if statement too early.

This is the fixed one:

pawn Код:
if (PlayerToPoint(8, playerid,364.1431,173.7478,1008.3828) || PlayerToPoint(10, playerid, -25.6093,-137.7065,1003.5469))



Re: [HELP]Withdraw problem - [Aka]Dragonu - 05.12.2010

And if i want to add 1 more player to point how it would look ?


Re: [HELP]Withdraw problem - JaTochNietDan - 05.12.2010

Just continue what you were doing, like so:

pawn Код:
if (PlayerToPoint(8, playerid,364.1431,173.7478,1008.3828) || PlayerToPoint(10, playerid, -25.6093,-137.7065,1003.5469) || PlayerToPoint(10,playerid,0.0,0.0,0.0))



Re: [HELP]Withdraw problem - [Aka]Dragonu - 05.12.2010

Ok ty and 10 is the distance ? So 10 is a far distance from that point that i can use the command ?


Re: [HELP]Withdraw problem - JaTochNietDan - 05.12.2010

Yes 10 is the distance in that example I showed you, you can specify any distance you want


Re: [HELP]Withdraw problem - [Aka]Dragonu - 05.12.2010

And if i put 1 , that player needs to be exactly in that coord ?


Re: [HELP]Withdraw problem - JaTochNietDan - 05.12.2010

Well it means he has to be within 1 range of it, so yes, pretty close. But you can also use decimal, such as 0.2, but you don't want it to be extremely close either, because you want to make sure people don't have to be standing in an EXACT spot, give them a little space to move


Re: [HELP]Withdraw problem - [Aka]Dragonu - 05.12.2010

Ok thank you a lot . Really helped ! But this command i want to add to withdraw in front of an atm. So yes they have to be pretty close :P . Thanks man !