01.02.2015, 13:36
Something like this
pawn Код:
enum some
{
bool:flag,
obj1,
obj2
};
new obj[MAX_PLAYERS][some];
CMD:pd1(playerid, params[])
{
if (GetFactionType(playerid) != FACTION_POLICE)
return SendErrorMessage(playerid, "You are not a police officer.");
if (!IsPlayerInAnyVehicle(playerid))
return SendErrorMessage(playerid, "You must be inside a vehicle.");
new vehicleid = GetPlayerVehicleID(playerid);
if(obj[playerid][flag] == true)
{
DestroyObject(obj[playerid][obj1]);
DestroyObject(obj[playerid][obj2]);
obj[playerid][flag] = false;
return 1;
}
obj[playerid][obj1] = CreateObject(19419, 1252.6768, -1320.4995, 13.6476, 0.0000, 0.0000, 0.0000); //police_lights01
obj[playerid][obj2] = CreateObject(19419, 1059.0290, -1580.8629, 10.8403, 0.0000, 0.0000, 0.0000); //police_lights01
//g_Vehicle = CreateVehicle(596, 1060.4080, -1576.1466, 13.0340, 84.4289, 0, 1, -1); //Police Car (LSPD)
AttachObjectToVehicle(obj[playerid][obj1], vehicleid, 0.0000, 2.4000, 0.0000, 0.0000, 0.0000, 0.0000);
AttachObjectToVehicle(obj[playerid][obj2], vehicleid, 0.0000, -2.0000, 0.0000, 0.0000, 0.0000, 0.0000);
obj[playerid][flag] = true;
return 1;
}
//under on player disconnect -
if(obj[playerid][flag] == true)
{
DestroyObject(obj[playerid][obj1]);
DestroyObject(obj[playerid][obj2]);
obj[playerid][flag] = false;
}