waqaarali Posted May 17, 2014 Share Posted May 17, 2014 Well i took advice to give a script a try and don't give up i actually got to somewhere ;D but i have a few errors now i tried to solve it but i could'nt here it is, --- Server Side --- local busMarker = createMarker(1813.21045, -1900.71777, 12.57342, "cylinder", 1, 255, 255, 255) local busBlip = createBlip(1778.73706, -1907.69165, 13.38839,56) local busTeam = createTeam("Bus Drivers", 0, 255, 0) function onMarkerHit(source) if source == busMarker then setPlayerTeam ( source, busTeam ) end end addEventHandler( "onMarkerHit", busMarker, onMarkerHit ) When i walk to the marker i don't be set to the team for some reason and another thing if i make client side script and server side script how can i like other scripters do and connect both scripts somehow like getRootElement client side or something if you understand. Link to comment
xeon17 Posted May 17, 2014 Share Posted May 17, 2014 (edited) busMarker = createMarker(1813.21045, -1900.71777, 12.57342, "cylinder", 1, 255, 255, 255) busBlip = createBlip(1778.73706, -1907.69165, 13.38839,56) local busTeam = createTeam("Bus Drivers", 0, 255, 0) addEventHandler("onMarkerHit", busMarker, function (player) if getPlayerTeam(player) ~= busTeam then setPlayerTeam ( player, busTeam ) end end ) Edited May 17, 2014 by Guest Link to comment
waqaarali Posted May 17, 2014 Author Share Posted May 17, 2014 Can you explain to me why it's like this ~= and why it's player and not source and what''s the difference between them. Link to comment
xXMADEXx Posted May 17, 2014 Share Posted May 17, 2014 go head and try this local busMarker = createMarker(1813.21045, -1900.71777, 12.57342, "cylinder", 1, 255, 255, 255) local busBlip = createBlip(1778.73706, -1907.69165, 13.38839,56) local busTeam = createTeam("Bus Drivers", 0, 255, 0) function onMarkerHit( player ) if source == busMarker then setPlayerTeam ( player, busTeam ) end end addEventHandler( "onMarkerHit", busMarker, onMarkerHit ) Can you explain to me why it's like this ~= and why it's player and not source and what''s the difference between them. "~=" is the exact opposite of "==". It means if they are not equal then continue. Link to comment
waqaarali Posted May 17, 2014 Author Share Posted May 17, 2014 I tried it, don't work Link to comment
.:HyPeX:. Posted May 17, 2014 Share Posted May 17, 2014 Could you show us the meta.xml? maybe you're not setting the script server-side. There's no reason why that code shouldnt work. Link to comment
.:HyPeX:. Posted May 17, 2014 Share Posted May 17, 2014 (edited) Well that is weird. BTW, the blip if its supposed to be on marker its pretty bad, use this instead: local busMarker = createMarker(1813.21045, -1900.71777, 12.57342, "cylinder", 1, 255, 255, 255) local busBlip = createBlipAttachedTo(busMarker,56) local busTeam = createTeam("Bus Drivers", 0, 255, 0) function onMyMarkerHit( element ) if source == busMarker then if getElementType(element) == "vehicle" then player = getVehicleController(element) else player = element end setPlayerTeam ( player, busTeam ) end end addEventHandler( "onMarkerHit", root, onMyMarkerHit ) Edited May 17, 2014 by Guest Link to comment
waqaarali Posted May 17, 2014 Author Share Posted May 17, 2014 So what shall i do ? It don't work Link to comment
.:HyPeX:. Posted May 17, 2014 Share Posted May 17, 2014 So what shall i do ? It don't work I've edited my post, copy and try my code again, i added a check if the hit element was by case, a vehicle. (driving one) 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