Jump to content

Manipulate ELS through code?


Rich

Recommended Posts

Is it possible to manipulate ELS through code?  Specifically to turn on and off the different sirens?  The IsSirenSilent and IsSirenOn vehicle properties are only affected by stage 3 lights, not sirens.  The native "SET_VEHICLE_SIREN" will turn siren tone 1 on if lights are off, blip if stage 1 or stage 2 lights are on, and do nothing if stage 3 lights are on.  The native "_IS_VEHICLE_SIREN_SOUND_ON" will either crash RPH or GTA V depending on if it's used when stage 3 lights are on or off.

Released plugins

Automatic Siren Cutout | Rich's Police EnhancementsScene Manager | Rich Ambiance

Retired - No more updates

Link to comment
Share on other sites

On 7/4/2019 at 12:41 PM, Rich said:

The native "_IS_VEHICLE_SIREN_SOUND_ON" will either crash

Are you calling _IS_VEHICLE_SIREN_SOUND_ON or it's hash?

Link to comment
Share on other sites

2 hours ago, NoNameSet said:

Are you calling _IS_VEHICLE_SIREN_SOUND_ON or it's hash?

I was calling it just like every other functional native:

Rage.Native.NativeFunction.CallByName<bool>("_IS_VEHICLE_SIREN_SOUND_ON", playerVehicle);

 

Released plugins

Automatic Siren Cutout | Rich's Police EnhancementsScene Manager | Rich Ambiance

Retired - No more updates

Link to comment
Share on other sites

natives with a underscore in front of them are guess names so you have to use the hash. In this case xB5CC40FBCB586380.

 

You should also use NativeFunction.Natives as CallByName and others are deprecated.

Capture.thumb.PNG.1443fd03484707124a280153c5e167d0.PNG

Link to comment
Share on other sites

Thanks for the info, I wasn't aware of that.  After implementing that native as suggested, it no longer crashes, but it doesn't seem to be affected by lights or sirens.  Am I doing this wrong?

if (Rage.Native.NativeFunction.Natives.xB5CC40FBCB586380<bool>(playerVehicle) == true)
{
  Game.DisplaySubtitle("Siren sound is on");
}
else
{
  Game.DisplaySubtitle("Siren sound is off");
}

It never returns true.  I've found that if I check if a player is in a vehicle, then execute 

(Rage.Native.NativeFunction.Natives.SetVehicleSiren(playerVehicle, true))

The siren will play until the player exits the vehicle.  This is close to what I'm trying to do, but I do not want to always have the siren set while the player is in the vehicle.  If I instead try to execute that line of code as false if the player is no longer in the vehicle (after the player turned the siren on themselves) the siren will not turn off.

Edited by Rich

Released plugins

Automatic Siren Cutout | Rich's Police EnhancementsScene Manager | Rich Ambiance

Retired - No more updates

Link to comment
Share on other sites

On 7/6/2019 at 12:13 PM, Rich said:

Thanks for the info, I wasn't aware of that.  After implementing that native as suggested, it no longer crashes, but it doesn't seem to be affected by lights or sirens.  Am I doing this wrong?


if (Rage.Native.NativeFunction.Natives.xB5CC40FBCB586380<bool>(playerVehicle) == true)
{
  Game.DisplaySubtitle("Siren sound is on");
}
else
{
  Game.DisplaySubtitle("Siren sound is off");
}

It never returns true.  I've found that if I check if a player is in a vehicle, then execute 


(Rage.Native.NativeFunction.Natives.SetVehicleSiren(playerVehicle, true))

The siren will play until the player exits the vehicle.  This is close to what I'm trying to do, but I do not want to always have the siren set while the player is in the vehicle.  If I instead try to execute that line of code as false if the player is no longer in the vehicle (after the player turned the siren on themselves) the siren will not turn off.

 

 

try this:

 

if (Rage.Native.NativeFunction.CallByHash<bool>(xB5CC40FBCB586380, playerVehicle) == true)
{
  Game.DisplaySubtitle("Siren sound is on");
}
else
{
  Game.DisplaySubtitle("Siren sound is off");
}

and I don't think we can control the ELS sound through the Native API.

we can turn on/off lights but not the sound.

sound will always follow the lights.. if lights on, then the siren sound will be forced on.

(e.g. we can't have lights on and sound off)

 

Edited by Pazzi
Link to comment
Share on other sites

17 hours ago, Pazzi said:

I don't think we can control the ELS sound through the Native API.

we can turn on/off lights but not the sound.

sound will always follow the lights.. if lights on, then the siren sound will be forced on.

(e.g. we can't have lights on and sound off)

 

I appreciate you taking the time to help.

Released plugins

Automatic Siren Cutout | Rich's Police EnhancementsScene Manager | Rich Ambiance

Retired - No more updates

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...