SA-MP Forums Archive
/refuel help - 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: /refuel help (/showthread.php?tid=421673)



/refuel help - Godzilla8957 - 10.03.2013

hey i have a problem

when people buy fuel in my server they get it for free and i have no idea why.. it was working a while ago but it doesn't want to work now

PHP Code:
    if(strcmp(cmd"/refuel"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
IsAtGasStation(playerid))
            {
                if(
Gas[idcar] <= 99)
                {
                    
TogglePlayerControllable(playerid0);
                    
GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~Re-Fueling Vehicle, please wait",2000,3);
                    
SetTimer("Fillup",RefuelWait,0);
                    
Refueling[playerid] = 1;
                }
                else
                {
                    
GameTextForPlayer(playerid,"~r~~n~~n~~n~~n~~n~~n~~n~~n~~n~Gas can is full",2000,3);
                }
            }
            else
            {
                
SendClientMessage(playerid,COLOR_GREY,"** You're not at a Gas Station!");
            }
        }
        return 
1;
    } 



Re: /refuel help - Threshold - 10.03.2013

Because there's no code in here taking any money from anyone??
https://sampwiki.blast.hk/wiki/GivePlayerMoney


Re: /refuel help - Gingster - 10.03.2013

You have to add: GivePlayerMoney(playerid, -100); (you can change the -100 to whatever)


PHP Code:
if(strcmp(cmd"/refuel"true) == 0)
{
    if(
IsPlayerConnected(playerid))
    {
        if(
IsAtGasStation(playerid))
        {
            if(
Gas[idcar] <= 99)
            {    
                
TogglePlayerControllable(playerid0);
                
GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~Re-Fueling Vehicle, please wait",2000,3);
                
SetTimer("Fillup",RefuelWait,0);
                
Refueling[playerid] = 1;
                
//Using GivePlayerMoney(); is to give someone money, but if you put a - in it, it will decrease the money
                //GivePlayerMoney(playerid, 100); will give you 100$, GivePlayerMoney(playerid, -100); will take from you 100$
                
GivePlayerMoney(playerid, -100);    
            }
            else
            {
                
                
GameTextForPlayer(playerid,"~r~~n~~n~~n~~n~~n~~n~~n~~n~~n~Gas can is full",2000,3);    
            }
        }
        else
        {
            
SendClientMessage(playerid,COLOR_GREY,"** You're not at a Gas Station!");    
        }    
    }
    return 
1;
    




Re: /refuel help - thegreathom - 10.03.2013

pawn Code:
GivePlayerMoney(playerid, -255); // Edit 255$ by your.. But don't remove -



Re: /refuel help - Don_Cage - 10.03.2013

PHP Code:
    if(strcmp(cmd"/refuel"true) == 0
    { 
        if(
IsPlayerConnected(playerid)) 
        { 
            if(
IsAtGasStation(playerid)) 
            { 
                if(
Gas[idcar] <= 99
                { 
                    
TogglePlayerControllable(playerid0); 
                    
GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~Re-Fueling Vehicle, please wait",2000,3); 
                    
SetTimer("Fillup",RefuelWait,0); 
                    
Refueling[playerid] = 1;
                    
GivePlayerMoney(playerid, -100); //Change the 100 to what you want the price for gas to be
                

                else 
                { 
                    
GameTextForPlayer(playerid,"~r~~n~~n~~n~~n~~n~~n~~n~~n~~n~Gas can is full",2000,3); 
                } 
            } 
            else 
            { 
                
SendClientMessage(playerid,COLOR_GREY,"** You're not at a Gas Station!"); 
            } 
        } 
        return 
1
    }