[HELP] Need help making a walkie-talie script

So pretty much what the title says, im new to scripting in FiveM.
I’d love if someone could help me on this, i just want to learn how to do such a thing so i dont have to spend my time on looking at a tutorial every time i wanted to change something on a script.

Or if someone could just help me on how to create scripts in general because right now i just cant learn how to make my own.

1 Like

Have you seen the FiveM docs site yet? Here is some support for getting used to creating scripts/resources.

There’s a lot more you can learn from that site around how to script in general but this would be a good starting point.

Once you have some code written you can post here to get some more help with what you’re trying to do.

Idk if this is the radio script you are looking for. But here you go.

I already have that one, im not new in getting others resources, but i really dont like that my server is just like any other server because i simply dont know much about lua and i cant create my own stuff, also already checked that page and wrote something, wich is the tutorial code from the page but i dont know how to make such a complex thing like a walkie talkie script i know it could be done modifying esx_alphone system but i dont want to modify i want to create and i dont know where to start with my code

(i want to create it myself dont get me wrong, i just need someone to tell me where to start)

What I usually do is start with a client.lua file and server.lua file. Then I will add commented lines to each that represent the set of steps in logical order that the script would need to run. Comments are just sentences that I understand. From there you can start to finish understand if and when a client will need to talk to the server and add comments to that file. Once the set of steps make sense to you then start to write the code that makes them work. Others use a flowchart program for this, to each thier own.

ok thanks ill start making it.
Thanks for your help ^^

No problem, lots of folks will pitch in and help if you get stuck anywhere and are willing to share snippets or the whole script. You might also start out by writing down questions for yourself to answer that will help you define the set of logical steps. For example:

-- Where do I get a walkin talkie?
-- These usually come pairs, do I need a give one of the pair to another player or does this act like a radio where I need to change channels to communicate with others?
-- Are the walkin talkies a voice system or a chat addon?

Answering your questions early will shape the direction of your steps and form the basis of your resource.

ok so basically what i have for now (no code written yet) is a walkie talkie that works with frequencyes(channels) and that can be used with voice. You would press a button, it would pop up and you would have to put a number beetwen 1-30 to join a frequency (channel) and i want it to work that if there are multiple people on the same frequency they can all talk with each other and hear what everyone says.

That’s a good start, more of a description. Start to picture yourself using it in game from start to finish. List all steps you would need to take. I suggest you start with a command they can type in, this makes it easier for you to test its workers by and start playing with natives to change voice channels. Sounds like you want a GUI at end game, leave that for later, learn along the way first. Post here on progress / questions or PM me if you want :slight_smile:

ok so im realyzing im pretty bad at this XD i dont know how to make this simple thing to work.

RegisterCommand('radio', function()
	TriggerEvent('chat:addMessge', {
		args = { 'You are talking via radio' }
})
end)

i just want the message to appear in the chat but i dont know how to make so that when i use the command /radio , it does the chat message.

I think you just misspelled Message.

RegisterCommand('radio', function(source, args, raw)
	TriggerEvent('chat:addMessage', {
		args = { 'You are talking via radio' }
})
end, false)

These’ll pretty much be your go to resources when it comes to coding in Lua with FiveM. I’d also advise learning C# instead if you have extra time.


https://docs.fivem.net/
http://www.dev-c.com/nativedb/
https://runtime.fivem.net/doc/reference.html#_n_CFX
https://paste.ubuntu.com/24355443/ – List of Weapons
https://alexguirre.github.io/animations-list/ – List of Animations

https://www.lua.org/