Refuel help!
#1

ok so my script i have on my site if you go to the gas station and refuel it SPAMS like crazy saying your cars been refule for __ amount so you have to /q to get it to stop... i dont no what to do.. this is the CMD im using maybe you can help!
PHP код:
CMD:refuel(playeridparams[])
{
    if(
IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new 
vehicleid GetPlayerVehicleID(playerid);
        new 
engine,lights,alarm,doors,bonnet,boot,objective;
        
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        if(
engine == VEHICLE_PARAMS_ON) return SendClientMessageEx(playeridCOLOR_RED"You need to shut off the engine before filling up (/vehicle engine).");
        if(!
IsAtFuelStation(playerid)) return SendClientMessageEx(playeridCOLOR_RED"You're not at a fuel station.");
        if(
GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_RED,"This vehicle doesn't need fuel.");
        if(
VehicleFuel[vehicleid] >= 100.0) return SendClientMessageEx(playeridCOLOR_RED"This vehicle's tank is already full.");
        if(
RefuelingVehicle[playerid] == 1) return SendClientMessageEx(playeridCOLOR_RED"You are refilling your vehicle's tank.");
           
SendClientMessageEx(playeridCOLOR_WHITE"Refueling your vehicle's tank, please wait.");
           
RefuelingVehicle[playerid] = 1;
           
RefuelingVehicleTimer[playerid] = SetTimerEx("ReFill"1000true"i"playerid);
    }
    return 
1;

and
PHP код:
stock StopRefueling(playerid)
{
    
GivePlayerCash(playerid, -RefuelingVehiclePrice[playerid]);
    
SendFormattedMessage(playeridCOLOR_WHITE,"Your vehicle's tank has been refilled for $%d."RefuelingVehiclePrice[playerid]);
    new 
mypoint = -1;
    for (new 
i=0i<MAX_POINTSi++)
    {
        if(
strcmp(Points[i][Name], "Fuel Company"true) == 0)
        {
            
mypoint i;
        }
    } 
Reply
#2

pawn Код:
stock StopRefueling(playerid)
{
    GivePlayerCash(playerid, -RefuelingVehiclePrice[playerid]);
    SendFormattedMessage(playerid, COLOR_WHITE,"Your vehicle's tank has been refilled for $%d.", RefuelingVehiclePrice[playerid]);

    new mypoint = -1;
    for (new i=0; i<MAX_POINTS; i++)
    {
        if(strcmp(Points[i][Name], "Fossil Fuel Company", true) == 0)
        {
            mypoint = i;
        }
    }  
    KillTimer(RefuelingVehicleTimer[playerid]);
    return 1;
}
Or set the repeat to false on your timer
Reply
#3

I left somthing out!!! sorry
Код:
	RefuelingVehicle[playerid] = 0; RefuelingVehiclePrice[playerid] = 0; KillTimer(RefuelingVehicleTimer[playerid]);
	return true;
}
Sorry for the post! i just seen the same post and fixed it!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)