Fuel - 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: Fuel (
/showthread.php?tid=284959)
Fuel -
Trucker[UK] - 21.09.2011
Hello
Can anyone help me with this
Код:
// Refuel a vehicle when driving a vehicle and pressing the HORN key
// Check if the player presses the HORN key
if ((newkeys & KEY_CROUCH) && !(oldkeys & KEY_CROUCH))
{
// Check if the player is driving a vehicle
if (GetPlayerVehicleSeat(playerid) == 0)
{
// Loop through all ARefuelPickups
for (new i; i < sizeof(ARefuelPickups); i++)
{
// Check if the player is in range of a refuelpickup
if(IsPlayerInRangeOfPoint(playerid, 2.5, ARefuelPickups[i][pux], ARefuelPickups[i][puy], ARefuelPickups[i][puz]))
{
// Show a message that the player's vehicle is refuelling
GameTextForPlayer(playerid, TXT_Refuelling, 3000, 4);
// Don't allow the player to move again (the timer will allow it after refuelling)
TogglePlayerControllable(playerid, 0);
// Start a timer (let the player wait until the vehicle is refuelled)
SetTimerEx("RefuelVehicle", 5000, false, "i", playerid);
// Stop the search
break;
}
}
}
}
return 1;
}
To help me make it that you have to type /fill at a fuel station
Re: Fuel -
Redgie - 21.09.2011
Sorry I'm confused, you seem to be using keys to initiate the fuelling process but you want to change it to using the command /fill?
Re: Fuel -
Trucker[UK] - 21.09.2011
yh can you help please
Re: Fuel -
Fat - 21.09.2011
pawn Код:
if(strcmp(cmd,"/fill", true) == 0
{
if (GetPlayerVehicleSeat(playerid) == 0)
{
for (new i; i < sizeof(ARefuelPickups); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 2.5, ARefuelPickups[i][pux], ARefuelPickups[i][puy], ARefuelPickups[i][puz]))
{
GameTextForPlayer(playerid, TXT_Refuelling, 3000, 4);
TogglePlayerControllable(playerid, 0);
SetTimerEx("RefuelVehicle", 5000, false, "i", playerid);
break;
}
}
}
return 1;
}