08.12.2014, 19:28
pawn Код:
CMD:engine(playerid, params[])
{
new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid, string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!PlayerInfo[playerid][pVeh] && !PlayerInfo[playerid][pVVeh] && !PlayerInfo[playerid][pBVeh]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a vehicle.");
if(GetPlayerVehicleID(playerid) != PlayerInfo[playerid][pVeh] && GetPlayerVehicleID(playerid) != PlayerInfo[playerid][pVVeh] && GetPlayerVehicleID(playerid) != PlayerInfo[playerid][pBVeh]) return SendClientMessage(playerid, COLOR_GREY, "You dont have the keys for this vehicle.");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You are not driving a vehicle.");
if(vehicleid == 509 || vehicleid == 481 || vehicleid == 510) return SendClientMessage(playerid, COLOR_GREY, "Bicycles have no engine.");
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(!engine)
{
SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVeh])
{SetVehicleParamsEx(vehicleid, 1, lights, alarm, PlayerInfo[playerid][vLocked], bonnet, boot, objective);}
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVVeh])
{SetVehicleParamsEx(vehicleid, 1, lights, alarm, PlayerInfo[playerid][vVLocked], bonnet, boot, objective);}
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pBVeh])
{SetVehicleParamsEx(vehicleid, 1, lights, alarm, PlayerInfo[playerid][vBLocked], bonnet, boot, objective);}
format(string, sizeof(string), "* %s turns the key's engine on.", RPN(playerid));
if(PlayerInfo[playerid][pMaskOn] == 1)
{
format(string, sizeof(string), "* Stranger puts their key in the ignition and turns it.");
}
else
{
format(string, sizeof(string), "* %s puts their key in the ignition and turns it.", RPN(playerid));
}
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
}
else
{
SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVeh])
{SetVehicleParamsEx(vehicleid, 0, lights, alarm, PlayerInfo[playerid][vLocked], bonnet, boot, objective);}
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVVeh])
{SetVehicleParamsEx(vehicleid, 0, lights, alarm, PlayerInfo[playerid][vVLocked], bonnet, boot, objective);}
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pBVeh])
{SetVehicleParamsEx(vehicleid, 0, lights, alarm, PlayerInfo[playerid][vBLocked], bonnet, boot, objective);}
format(string, sizeof(string), "* %s turns the vehicle's engine off.", RPN(playerid));
if(PlayerInfo[playerid][pMaskOn] == 1)
{
format(string, sizeof(string), "* Stranger turns the key in the ignition and takes it out.");
}
else
{
format(string, sizeof(string), "* %s turns the key in the ignition and takes it out.", RPN(playerid));
}
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
}
return 1;
}