13.03.2012, 23:36
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
if(vehEngine[vehicleid] == 0)
{
if(newkeys == KEY_JUMP)
{
new str[128], Name[MAX_PLAYER_NAME], pPos[3];
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
GetPlayerName(playerid, Name, sizeof Name);
format(str, sizeof str, "%s started the vehicle engine.", Name);
for (new i = 0; i<MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 20, Pos[0], Pos[1], Pos[2]))
SendClientMessage(i, 0xF9B7FFAA, str);
}
vehEngine[vehicleid] = 2;
SetTimerEx("StartEngine", 3000, 0, "i", playerid);
SendClientMessage(playerid, 0x33AA33AA, "Vehicle engine starting");
return 1;
}
}
if(newkeys == KEY_SECONDARY_ATTACK)
{
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
}
}
return 1;
}