DarkLink Posted June 12, 2011 Share Posted June 12, 2011 Hey guys, i have some problem here. Everytime i start to look for functions that i need to use on my script, i always wonder which ones i should look? Server Side or Client Side? Like u should know there are many functions with nearly the same name on client and server side, i dont know which to chose for what situations.. Did u guys understand, my question here? Sorry my bad english Thanks alot in advance. I think i must know the differences, and when to use which.. so i can start doing scripts with my head. Thanks again Link to comment
Castillo Posted June 12, 2011 Share Posted June 12, 2011 Well, if you didn't notice, there are functions/events that only work in the client or the server side, and some times you may need something that's only in the client or server side, then you'll know what to should use. Link to comment
CowTurbo Posted June 12, 2011 Share Posted June 12, 2011 (edited) server side functions you can use for all players, lets chose event bindKey. In server side, you can do this function onJoin ( ) bindKey ( source, "N", "down", functionName ) end addEventHandler ( "onPlayerJoin", getRootElement(), onJoin ) So, this will bind N key for some function, when player joins. If you are using client side , then you dont need to add player argument, because its only for one player, who's using client side ( everyone can use ...) function onJoin ( ) bindKey ( "N", "down", functionName ) end addEventHandler ( "onClientResourceStart", getRootElement(), onJoin ) I hope you can understand me,.. Edited June 12, 2011 by Guest Link to comment
Castillo Posted June 12, 2011 Share Posted June 12, 2011 client side example is wrong, onClientPlayerJoin is triggered for all but the client, so it should use onClientResourceStart instead. Link to comment
CowTurbo Posted June 12, 2011 Share Posted June 12, 2011 Yeah, was copy paste Fixed, thx Link to comment
Dark Dragon Posted June 12, 2011 Share Posted June 12, 2011 client side code is executed by the computer of the player while server side code is executed by the machine the server runs on. this has a huge impact on the usability of functions. for example setWeather can be used to set the current weather for everyone (server side) or just for a single person (client side). in some cases it doesn't really matter what you choose. as all client side files are downloaded by everyone you can also use setWeather client side for everyone. but keep in mind that client side code needs this procedure of downloading and client side code is easy to access for everyone on your server, so they might take the code, steal it or grab important information from it. Link to comment
DarkLink Posted June 12, 2011 Author Share Posted June 12, 2011 thanks alot for the answers guys, I understand much better now!! Its about who i want to run the script everyone or one single player (the client). And is about security too like dragon said. Thanks Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now