So i want to make a command so if i type like : /kill 2 it kills player with id 2 (im new to scripting) + do i need client side or server side script?
JaGv
2
So for your case, it may be good to have both a client & server script.
FiveM resources use a client-server model of programming, and you have access to certain native functions based on which scope you are in. Client only deals with things registered by the player while server handles other things.
The RegisterCommand native is shared, meaning commands can be registered in either the client or the server. From there, you would probably want to trigger a server event that takes the target players ID as an argument. Then, call a client event to that player with the SetEntityHealth function setting their health to zero.
1 Like
and how do i take the target id? + how do i use them both?
JaGv
4
You can define client and server scripts in your manifest. I would recommend reading the FiveM documentation, as it’ll give answers for most questions you may have.
So i dont know if its hard to code for a beginner. But what im trying to make is a command : /js [ID of player] then every 45 seconds there is gonna be a blip on the map for all the players where the player with the id is any tips?
JaGv
8
As long as you go at your own pace and take the time to read up on the docs - I know you’ll be able to get it, no matter the difficulty. Completely spitballing here, but you could register the command client-side. Then have the server trigger a client event specifically to the player whose ID you are targeting, find the nearby players (there’s examples for how to get nearby player(s) online if you search it up), and draw publicly viewable blips at the coordinates of those nearby players.
Ok Thank you for helping me, i have a question i made a while loop that sets a blip on map after the time you choose but i need so right before the other spawns the one that already spawned needs to be removed heres my code :

JaGv
10
You definitely have the right idea, a while loop for creating/deleting the blip with strategically placed Waits could be the way to go based on how you have things set up.
For the sake of not making this thread too crazy, feel free to DM me and I can help you out some more.