12.03.2015, 21:50
(
Last edited by StarPeens; 12/03/2015 at 10:30 PM.
)
I'm using a filterscript, well, he tells how many of gasoline has, and every step you walk with the car it decreases. When gasoline is over, the car stops working. Has the /refuel, to fuel, the more it sets the gasoline to 100 and the car will not start. Can anyone help? + rep
CMD:
Gasoline over
CMD:
pawn Code:
CMD:refuel(playerid,params[])
{
if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFC800FF,"You are not in an vehicle!"); //if a player isnt in a vehicle, it stops here
if (isrefuelling[playerid]) return SendClientMessage(playerid,0xFFC800FF,"You are already refuelling!"); //if a player is already refuelling, it stops here
else
{
SetCameraBehindPlayer(playerid); //Sets the camera behind the player (looks better because the player will be frozen for a few secs)
isrefuelling[playerid] = 1; //setting isrefuelling to 1 so the player cant spam /refuel
new string[125];format(string,sizeof string,"Fuel: ~r~%i~g~",fuel[playerid]);
TextDrawSetString(td_fuel[playerid],string);
GameTextForPlayer(playerid,"Your ~r~vehicle has been ~g~refueled.",2500,4);
isrefuelling[playerid]=0;
for(new i=0;i<MAX_PLAYERS;i++) {
if (isrefuelling[i]) continue;
new vid = GetPlayerVehicleID(i);
if (GetPlayerVehicleSeat(i) == 0) {
fuel[vid] = 101 -1;
if (fuel[vid]<1)
{
fuel[vid] = 0;
SetVehicleParamsEx(vid,0,0,0,0,1,1,0); //change this to watever you like
GameTextForPlayer(i,"~r~You are out of ~w~fuel~r~!",5000,4); //show text
}
}
new sstring[125];format(sstring,sizeof sstring,"Fuel: ~r~%i~g~",fuel[vid]);
TextDrawSetString(td_fuel[i],string);
TextDrawShowForPlayer(i,td_fuel[i]);
}
} //setting refueltimer
return 1;
}
pawn Code:
public timer_fuel_lower()
{
for(new i=0;i<MAX_PLAYERS;i++) {
if (isrefuelling[i]) continue;
new vid = GetPlayerVehicleID(i);
if (GetPlayerVehicleSeat(i) == 0) {
fuel[vid] = fuel[vid] -1;
if (fuel[vid]<1)
{
fuel[vid] = 0;
SetVehicleParamsEx(vid,0,0,0,0,1,1,0); //change this to watever you like
GameTextForPlayer(i,"~b~Fuel~y~ Ende~p~d",5000,4); //show text
}
}
new string[125];format(string,sizeof string,"Fuel: ~r~%i~g~",fuel[vid]);
TextDrawSetString(td_fuel[i],string);
}
return 1;
}