24.03.2013, 12:04
try now
edit:Misiur bit me by seconds
pawn Код:
CMD:hotwire(playerid, params[])
{
new string[128], Float:playerHealth;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
new playerstate = GetPlayerState(playerid), vehmodel = GetVehicleModel(GetPlayerVehicleID(playerid)), vehid = GetPlayerVehicleID(playerid), rnd = random(2);
if(vehmodel == 481 || vehmodel == 509 || vehmodel == 510) return SendClientMessage(playerid, COLOR_GREY, "You can't hotwire a bicycle.");
if(playerstate != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You are not driving a vehicle");
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehid, engine, lights, alarm, doors, bonnet, boot, objective);
if(engine) return SendClientMessage(playerid, COLOR_GREY, "The vehicle's engine is already on.");
if(rnd == 0)
{
format(string, sizeof(string), "* %s has tried to hotwire the vehicle's engine, but got shocked.");
GetPlayerHealth(playerid, playerHealth);
SetPlayerHealth(playerid, playerHealth - 15);
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
}
if(rnd == 1)
{
format(string, sizeof(string), "* %s has tried to hotwire the vehicle, and the engine started.");
SetVehicleParamsEx(vehid, 1, lights, 1, doors, bonnet, boot, objective);
SetTimerEx("AlarmOff", 7500, 0, "i", vehid);
}
return 1;
}