Hello all, I am releasing this script because it was well needed for roleplay. This is a edited version of LanceGood’s Flamethrower Script. Unfortunately as of right now there is no sound for the spray and it also does not do anything to peds unlike the flamethrower. It is just a Pepper Spray can with the effects. So when you Spray somebody they need to manually rp it out. Feel free to edit this and make it better!
Update: @xander1998 added some stuff, we should now have effects and what not!
I know very little about scripting actually which is why it is edited from another script. Somebody else would need to set up the code and what not and send it to me. Which is why I said in the post “Feel free to edit this and make it better!”
Nice work! If you want I have a solution for making the pepperspray incapacitate players.
You should use a ragdoll method that is performed on the person that is within the range of the spray (maybe a yard?) and make it run for three or so seconds.
It would most likely need to be executed on the person from the server.
I might do it myself if thats okay, but right now I need to restudy FiveM Lua Coding since there have been many changes that have even broke my old scripts from March 2018 (which is alright).
Ah. Would be nice to actually add an effect to this that way you can get around players not RPing it out.
1. When you press the fire button you draw a raycast from the model to a position in front of the player.
2. If it hits a ped check if it is a player. If it is a player grab their server ID.
3. Trigger a server event that triggers a client event on that stored player ID.
4. Add the visual effects / effects in general to that client you sprayed.