14.04.2013, 02:04
How to make dis as a command:
Код:
// 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;
}
Код:
error 010: invalid function or declaration Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
Код:
COMMAND:refill(playerid, params[])
{
// 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;
}

