14.03.2015, 03:48
Alright so the current /siren command allows me to attach the siren to a vehicle but once I step out the vehicle it turns off I need help making it stay on the vehicle unless /siren command is done again.
PHP код:
CMD:siren(playerid, params[])
{
if(IsACop(playerid) || IsAHitman(playerid) || IsAGovernment(playerid) || IsAMedic(playerid))
{
if(GetPVarType(playerid, "Siren"))
{
if(IsPlayerAttachedObjectSlotUsed(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 2)) RemovePlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 2);
if(IsPlayerAttachedObjectSlotUsed(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 1)) RemovePlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 1);
DeletePVar(playerid, "Siren");
SendClientMessageEx(playerid, COLOR_WHITE, "Siren disabled.");
return 1;
}
else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 2)) RemovePlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 2);
if(IsPlayerAttachedObjectSlotUsed(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 1)) RemovePlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 1);
switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
{
case 415:
{
SetPlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 2, 18646, 10, -0.20, 0.30, 0.3, -90, -30, 0);
SetPlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 1, 18646, 10, -0.20, 0.30, 0.3, -90, -30, 0);
}
case 402:
{
SetPlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 2, 18646, 10, -0.20, 0.5, 0.4, -90, -50, 0);
SetPlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 1, 18646, 10, -0.20, 0.5, 0.4, -90, -50, 0);
}
case 541, 411:
{
SetPlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 2, 18646, 10, 0.0, 0.2, 0.4, -90, -30, 0);
SetPlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 1, 18646, 10, 0.0, 0.2, 0.4, -90, -30, 0);
}
case 451: {
SetPlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 2, 18646, 10, -0.30, 0.4, 0.6, -90, -50, 0);
SetPlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 1, 18646, 10, -0.30, 0.4, 0.6, -90, -50, 0);
}
default:
{
SetPlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 2, 18646, 10, -0.30, 0.4, 0.4, -90, -50, 0);
SetPlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 1, 18646, 10, -0.30, 0.4, 0.4, -90, -50, 0);
}
}
SetPVarInt(playerid, "Siren", 1);
SendClientMessageEx(playerid, COLOR_WHITE, "Siren enabled.");
return 1;
}
SendClientMessage(playerid, COLOR_GRAD2, "This vehicle does not support mounted sirens.");
}
return 1;
}