|
| 02 Nov 2016 11:49 PM |
Is it bad to use only one RemoteEvent and RemoteFunction in the game.
I was looking at Phantom Forces code and He used two remote events and 1 remote function.
I currently am only using 1 of each. What would be the pros/cons of doing this.
Also what would be the pros/cons of using multiple remote events/functions for various tasks.
|
|
|
| Report Abuse |
|
|
Salinas23
|
  |
| Joined: 28 Dec 2008 |
| Total Posts: 37141 |
|
|
| 02 Nov 2016 11:50 PM |
lolwhat
I use a remote event for every function I have
so far... like10+ remote events xd I have a spider on my back. |
|
|
| Report Abuse |
|
|
|
| 02 Nov 2016 11:52 PM |
I have a function table.
I send the name of the function as a argument.
The main function pulls the function name and calls it with the (...) parameter. (forgot what thats called)
I mean it works but I just want to know if it's a bad thing to do.
|
|
|
| Report Abuse |
|
|
Salinas23
|
  |
| Joined: 28 Dec 2008 |
| Total Posts: 37141 |
|
|
| 02 Nov 2016 11:54 PM |
a function table?
so like... a module script? I have a spider on my back. |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 02 Nov 2016 11:56 PM |
called a tuple. and no, it's not inherently bad to do that, do what you want.
its a free country
|
|
|
| Report Abuse |
|
|
|
| 02 Nov 2016 11:58 PM |
| I mean yeah I could use a module but not really needed. local func={} function func.bla(player,...) return 1 end function #################### return "K" end local function event(player,name,...) func[name](player,...) end re.OnServerEvent:connect(event)--they all fall under one event this is how I am using it. but yeah not really the point lol |
|
|
| Report Abuse |
|
|
|
| 02 Nov 2016 11:59 PM |
I mean yeah I could use a module but not really needed.
local func={} function func.bla(player,...) return 1 end function func.rea(player,...) return "K" end local function event(player,name,...) func[name](player,...) end re.OnServerEvent:connect(event)--they all fall under one event this is how I am using it.
|
|
|
| Report Abuse |
|
|
|
| 03 Nov 2016 12:00 AM |
thanks kodran. :)
and I thought i read somewhere it was called a varadiac parameter lmao whatever that means
|
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 03 Nov 2016 12:03 AM |
yeah, variadic function is a function which takes a variable number of arguments. The actual (...) is called a tuple.
|
|
|
| Report Abuse |
|
|
|
| 03 Nov 2016 12:04 AM |
Ah thanks. Makes sense lol
|
|
|
| Report Abuse |
|
|
|
| 03 Nov 2016 04:15 AM |
Yes it's good. You should also put all your code in one script |
|
|
| Report Abuse |
|
|
| |
|
|
| 03 Nov 2016 09:52 AM |
It depends how intesive all your functions are
Stuff like damage / heal / blind from flash bangs will be fine But you don't want one script doing a ton of intensive things at once. |
|
|
| Report Abuse |
|
|