Wanted System For Ped

Hi, I wanted to do a script mainly for client side, but wanted it so say a ped is fighting, then star 1 is applied and so on, with possible ai police attending…

Is this something we can impliment? Can anyone advise me please? Will this be client or server end or both?

Thanks

Hi.

Yeah you can definitely do that. You will have to use both client and server side.

You’ll be able to use SetPlayerWantedLevel (SetPlayerWantedLevel - Natives @ Cfx.re Docs) and SetPlayerWantedLevelNow (SetPlayerWantedLevelNow - Natives @ Cfx.re Docs) on the server side to set wanted stars.
And on the client, it’s here that you would be able to detect if the player is in a fight with IsPedInMeleeCombat (IsPedInMeleeCombat - Natives @ Cfx.re Docs) for example.

1 Like

Ok I am new to scripting but not sure how I would write that?? Sorry just want to get my head around it. I can do commands and spawn stuff but thats about my limit at the moment.

Thanks in advance (PS may be a template or something? Thanks)

I won’t give you a template because it won’t help you to think like a programmer. Before going into programming, you must learn this type of thinking. I found this video How To Think Like A Programmer - Learn To Solve Problems! - YouTube which should help you understand that.

I can however give you indications.

To check if the player is in melee combat you need a loop which is going to verify every X seconds with the native IsPedInMeleeCombat. This loop while be in a thread to create parallelism (I encourage you to learn it, this is very common in programming)
If the native returns true then you send a message to your server-side in order to call your function SetPlayerWanteLevel and SetPlayerWanteLevelNow and create the logic that you want.

This is the basic stuff, you need to adjust what I said to whatever you want to do.

1 Like

Ok I get that I give it a go. I keep ya informed.