/siren help
#1

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(playeridparams[])
{
    if(
IsACop(playerid) || IsAHitman(playerid) || IsAGovernment(playerid) || IsAMedic(playerid))
    {
        if(
GetPVarType(playerid"Siren"))
        {
              if(
IsPlayerAttachedObjectSlotUsed(playeridMAX_PLAYER_ATTACHED_OBJECTS 2)) RemovePlayerAttachedObject(playeridMAX_PLAYER_ATTACHED_OBJECTS 2);
            if(
IsPlayerAttachedObjectSlotUsed(playeridMAX_PLAYER_ATTACHED_OBJECTS 1)) RemovePlayerAttachedObject(playeridMAX_PLAYER_ATTACHED_OBJECTS 1);
              
DeletePVar(playerid"Siren");
              
SendClientMessageEx(playeridCOLOR_WHITE"Siren disabled.");
            return 
1;
        }
        else if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            if(
IsPlayerAttachedObjectSlotUsed(playeridMAX_PLAYER_ATTACHED_OBJECTS 2)) RemovePlayerAttachedObject(playeridMAX_PLAYER_ATTACHED_OBJECTS 2);
            if(
IsPlayerAttachedObjectSlotUsed(playeridMAX_PLAYER_ATTACHED_OBJECTS 1)) RemovePlayerAttachedObject(playeridMAX_PLAYER_ATTACHED_OBJECTS 1);
            switch(
GetVehicleModel(GetPlayerVehicleID(playerid)))
            {
                case 
415:
                {
                    
SetPlayerAttachedObject(playeridMAX_PLAYER_ATTACHED_OBJECTS 21864610, -0.200.300.3, -90, -300);
                    
SetPlayerAttachedObject(playeridMAX_PLAYER_ATTACHED_OBJECTS 11864610, -0.200.300.3, -90, -300);
                }
                case 
402:
                {
                    
SetPlayerAttachedObject(playeridMAX_PLAYER_ATTACHED_OBJECTS 21864610, -0.200.50.4, -90, -500);
                    
SetPlayerAttachedObject(playeridMAX_PLAYER_ATTACHED_OBJECTS 11864610, -0.200.50.4, -90, -500);
                }
                case 
541411:
                {
                    
SetPlayerAttachedObject(playeridMAX_PLAYER_ATTACHED_OBJECTS 218646100.00.20.4, -90, -300);
                    
SetPlayerAttachedObject(playeridMAX_PLAYER_ATTACHED_OBJECTS 118646100.00.20.4, -90, -300);
                }
                case 
451: {
                    
SetPlayerAttachedObject(playeridMAX_PLAYER_ATTACHED_OBJECTS 21864610, -0.300.40.6, -90, -500);
                    
SetPlayerAttachedObject(playeridMAX_PLAYER_ATTACHED_OBJECTS 11864610, -0.300.40.6, -90, -500);
                }
                default:
                {
                    
SetPlayerAttachedObject(playeridMAX_PLAYER_ATTACHED_OBJECTS 21864610, -0.300.40.4, -90, -500);
                    
SetPlayerAttachedObject(playeridMAX_PLAYER_ATTACHED_OBJECTS 11864610, -0.300.40.4, -90, -500);
                }
            }
            
SetPVarInt(playerid"Siren"1);
            
SendClientMessageEx(playeridCOLOR_WHITE"Siren enabled.");
            return 
1;
        }
        
SendClientMessage(playeridCOLOR_GRAD2"This vehicle does not support mounted sirens.");
    }
    return 
1;

Reply
#2

You're attaching the siren to the player, not to the vehicle.
Reply
#3

How can I attach it to the vehicle?
Reply
#4

Quote:
Originally Posted by SkilledMaster
Посмотреть сообщение
How can I attach it to the vehicle?
https://sampwiki.blast.hk/wiki/AttachObjectToVehicle
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)