16.11.2013, 13:50
pawn Код:
new IsBootOpen[MAX_PLAYERS] = 0;
if(strcmp(cmd, "/boot", true) == 0)
{
new vid = GetPlayerVehicleID(playerid);
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GRAD2, "You must be in a car before you can do this!");
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_GRAD2, "Only the driver can do this!");
if(IsBootOpen[playerid] == 0)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "> %s Presses on the trunk button and opens it.", RemoveUnderScore(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, VEHICLE_PARAMS_ON, objective);
IsBootOpen[playerid] = 1;
}
else if(IsBootOpen[playerid] == 1)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "> %s Presses on the trunk button and closes it.", RemoveUnderScore(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, VEHICLE_PARAMS_OFF, objective);
IsBootOpen[playerid] = 0;
}
return 1;
}