/text <ID> help needed

First of all i wish u guys a really really great day around here! :slight_smile:

I really like to know how i can script lets say something like /weapon or something.
What i mean is how can i make a command that uses /text and then a identifier after it.
Im not new at scripting at all, but lua is kinda new to me.

I hope you guys help me out soon.
J.Molenaar. :smile:

Check some resources here, it is pretty easy to understand it.

I checked some resources already, but the main thing is they all are server sided scripted. is there a way to got it only client sided?

anyway thanks for the help man! i really appreciate it! :smiley:

If you want to use the chat (something like /command) you have to create a serversided script. But you can Trigger a client event with it.

You could check my resource for example. There you will see what I mean:

Thanks haha thats more what i need!
Now i understand the way of scripting between client side and server side.
But is there a way like to make the command with use of an player id or something?

Thanks for your’e help man!

yeah it is

I try to make a little example

Message in this example:
/weapon 2


AddEventHandler('chatMessage', function(source, n, msg)
	local Message = string.lower(msg)
	local MessageParts = stringsplit(Message, " ") --The Seperator Is A Blank Space 
	if (MessageParts[1] == "/weapon") then
		TriggerClientEvent('Weapon', source, MessageParts[2]) --I added the second Argument, the **2** from the message

function stringsplit(inputstr, sep)
	if sep == nil then
			sep = "%s"
	local t={} ; i=1
	for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
			t[i] = str
			i = i + 1
	return t
-- Register a network event

AddEventHandler('Weapon', function(number) --I also added the argument here
	--do stuff here with the arguments, for example outputting it

function drawNotification(text) --Just Don't Edit!
	DrawNotification(false, false)

Well i really need to thank you, this helped me out alot! :smiley:
Thanks man!

J.Molenaar. :slight_smile:

1 Like