Jump to content

Two questions


Controlled

Recommended Posts

How would I transfer information that someone placed onto a GUI(Like a text or number) to server side?

And how can I run something multiple times without spamming the script. For example

removeElementData(thePlayer, "hello")*2 

Would run that twice.

Bit of a a bad example but I think you get the idea. That would run that removeElementData twice and save the space/time

Link to comment
How would I transfer information that someone placed onto a GUI(Like a text or number) to server side?
addEvent 
addEventHandler 
triggerServerEvent 
--or 
setElementData -- element data is synced if you set it for server-side elements unless you explicitly specify not to sync it 

And how can I run something multiple times without spamming the script. For example
removeElementData(thePlayer, "hello")*2 

Would run that twice.

Bit of a a bad example but I think you get the idea. That would run that removeElementData twice and save the space/time

Use loops

for i = 1, 5 do 
    outputChatBox(tostring(i)) 
end 

Outputs:

1 
2 
3 
4 
5 

The code inside the loop block (therefore 'outputChatBox' too) will be executed 5 times, with different 'i' value every time.

Link to comment

Alright so thanks for the help so far, my question about the GUI is answered.

But I don't understand how I could get something like this to run a certain number of times.

        exports.global:giveItem(source, 115, weapon..":"..mySerial..":"..getWeaponNameFromID(weapon)) 

So for example that would run once, twice, or 3 times based on the number you put in the GUI.

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...