baruffa123 Posted February 10, 2013 Share Posted February 10, 2013 Hi everybody, i want to link 2 servers but i never scripted before, so i need help to create a script that for example when passing thru a marker, send me to other server. I Need help from 0 couse i dont know anything about lua and meta and all that stuff. Please help!!!!!!!!!!!! Thanks! Link to comment
Castillo Posted February 10, 2013 Share Posted February 10, 2013 Well, you'll need basic knowledge to make this. I'll show you the functions/events you need: Functions: createMarker redirectPlayer Event: onMarkerHit Click each one and read their syntax, they all have examples. Link to comment
baruffa123 Posted February 10, 2013 Author Share Posted February 10, 2013 ok thanks a lot ill try to do my first script :3 Link to comment
PaiN^ Posted February 10, 2013 Share Posted February 10, 2013 Here you go, Try this one The Script : marker = createMarker( X, Y, Z, "cylinder", 1.5, 210, 0, 0, 255 ) IP = Port = addEventHandler( "onMarkerHit", marker function ( player ) if ( getElementType ( player ) == "player" ) then redirectPlayer( player, IP, Port ) end end ) And the meta.xml : "redirect" author="baruffa123" version="1.0"/> Here is what to do : At the first line, Replace X, Y, Z by the marker coordinates ( You can get it from the Admin Panel in the game ) Place your server IP after ( IP = ) at line 2 And place you server port after ( Port = ) at line 3 And it should work P.S. : The Script name MUST BE Redirect ( Like in the meta.xml code ), Or else it wont work . Link to comment
iPrestege Posted February 10, 2013 Share Posted February 10, 2013 ^^ You forgot the comma in the event and you have some simple mistakes should to be : -- Server Side : marker = createMarker( X, Y, Z, "cylinder", 1.5, 210, 0, 0, 255 ) IP = "You,re IP" Port = "You,re Port" addEventHandler( "onMarkerHit", marker , function (player) if ( getElementType (player) == "player" ) then redirectPlayer (player,IP,tonumber(Port)) end end ) Should Have Admin Rights . Link to comment
Anderl Posted February 10, 2013 Share Posted February 10, 2013 I would like to know why do you create a variable called "Port" with string type and then you convert it to number. Simply write the number as an integer variable in "Port". Link to comment
iPrestege Posted February 10, 2013 Share Posted February 10, 2013 I would like to know why do you create a variable called "Port" with string type and then you convert it to number. Simply write the number as an integer variable in "Port". Thanks Next Time Will Do It . Link to comment
Baseplate Posted February 10, 2013 Share Posted February 10, 2013 And please, stop using Bold BBCode in LUA scripts Link to comment
iPrestege Posted February 10, 2013 Share Posted February 10, 2013 And please, stop using Bold BBCode in LUA scripts What is the problem in using it? Link to comment
Baseplate Posted February 10, 2013 Share Posted February 10, 2013 I just fucking got blind. Link to comment
baruffa123 Posted February 10, 2013 Author Share Posted February 10, 2013 thanks a lot everybody really thenks ;D Link to comment
baruffa123 Posted February 10, 2013 Author Share Posted February 10, 2013 marker creates, but when going thru it nothing happens! My lua. -- Server Side : marker = createMarker( 2504.8000488281, -1669.9000244141, 13.39999961853, "cylinder", 1.5, 210, 0, 0, 255 ) IP = "190.194.32.159" Port = "22003" addEventHandler( "onMarkerHit", marker , function (player) if ( getElementType (player) == "player" ) then redirectPlayer (player, "88.198.11.8", tonumber("31338")) end end ) my meta: <meta> <info name="redirect" author="baruffa123" version="1.0"/> <script src="Redirect.lua" type="server"/> <object name="resource.admin"></object> </meta> whats wrong? thanks! Edit: when going thru marker console says: redirect\redirect.lua:9: access denied @ redirectPlayer. why is this? Link to comment
Castillo Posted February 10, 2013 Share Posted February 10, 2013 Add the resource to the acl group "Admin" at "acl.xml". P.S: Remove: "resource.admin"> from meta.xml. Link to comment
baruffa123 Posted February 10, 2013 Author Share Posted February 10, 2013 ok ill try thanks Link to comment
baruffa123 Posted February 10, 2013 Author Share Posted February 10, 2013 Thanks a lot it works perfect, thanks a lot to everybody! Link to comment
Anderl Posted February 10, 2013 Share Posted February 10, 2013 Your code is completely messed up. 1st. Use local variables whenever you can; 2nd. Why is this: Port = "22003" ..needed if you are doing this? tonumber ( "31338" ) It doesn't even make sense. Either use the variable or write the port number directly in the function, without tonumber or as string. redirectPlayer ( player, "88.198.11.8", 31338 ); Link to comment
baruffa123 Posted February 11, 2013 Author Share Posted February 11, 2013 thanks it worked 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