xeon17 Posted January 25, 2014 Share Posted January 25, 2014 I'm wanna make a gate who open when player get in contact with the Gate, and close when player is away from Gate. this is my frist time , so i ask is this code correct ? local gate = createObject(id, x, y, z, rx, ry, rz) local marker = createMarker(x, y, z, "cylinder", 2, 0, 200, 255) function openGate (hitPlayer, matchingDimension) moveObject(gate, x, y, z) end addEventHandler("onClientMarkerHit", marker, openGate) function closeGate(leavingPlayer, matchingDimension) moveObject(gate, x, y, z) end addEventHandler("onClientMarkerLeave", marker, closeGate) Link to comment
TAPL Posted January 25, 2014 Share Posted January 25, 2014 The second argument of moveObject is the time to the object to arrive. Link to comment
xeon17 Posted January 25, 2014 Author Share Posted January 25, 2014 [2014-01-25 12:35:28] SCRIPT ERROR: Gate\Garagem.lua:17: unfinished long comment near '' Link to comment
xeon17 Posted January 25, 2014 Author Share Posted January 25, 2014 Ahh Sorry , there was writed an author i copyed only the script. local gate = createObject(id, x, y, z, rx, ry, rz) local marker = createMarker(x, y, z, "cylinder", 2, 0, 200, 255) function openGate (hitPlayer, matchingDimension) moveObject(gate, x, y, z) end addEventHandler("onClientMarkerHit", marker, openGate) function closeGate(leavingPlayer, matchingDimension) moveObject(gate, x, y, z) end addEventHandler("onClientMarkerLeave", marker, closeGate) Now i get this bugs , wtf [2014-01-25 12:47:50] Resource 'Gate' changed, reloading and starting [2014-01-25 12:47:50] Starting Gate [2014-01-25 12:47:50] WARNING: Gate\Garagem.lua:1: Bad argument @ 'createObject' [Expected number at argument 1, got nil] [2014-01-25 12:47:50] WARNING: Gate\Garagem.lua:2: Bad argument @ 'createMarker' [2014-01-25 12:47:50] WARNING: Gate\Garagem.lua:6: Bad argument @ 'addEventHandler' [Expected element at argument 2, got boolean] [2014-01-25 12:47:50] WARNING: Gate\Garagem.lua:11: Bad argument @ 'addEventHandler' [Expected element at argument 2, got boolean] [2014-01-25 12:47:50] Gate restarted successfully Link to comment
TAPL Posted January 25, 2014 Share Posted January 25, 2014 wtf, you must replace x, y, z, rx, ry, rz with the positions. And as i said: The second argument of moveObject is the time to the object to arrive. Link to comment
xeon17 Posted January 25, 2014 Author Share Posted January 25, 2014 I know calm , i not started working yet i thank later i got a problem with my other script what i crated before 2 minutes , when player join server if he have team it should give him outchatbox '-' but nothing happen function Check ( player ) local playerTeam = getPlayerTeam ( player ) if ( playerTeam ) then outputChatBox ( "#F4A460[GANG]#F08080 Bem vido a gang " .. getTeamFromName ( PlayerTeam ).." ! ", player, 255, 255, 255, true ) end end addEventHandler ( "onPlayerLogin", root, Check ) i Tryed OnPlayerLogin too , idk what wrong , help TAPL Link to comment
TAPL Posted January 25, 2014 Share Posted January 25, 2014 Use source as this event doesn't have player parameter. And getTeamName instead of getTeamFromName. Link to comment
xeon17 Posted January 25, 2014 Author Share Posted January 25, 2014 function Check ( source ) local playerTeam = getPlayerTeam ( source ) if ( playerTeam ) then outputChatBox ( "#F4A460[GANG]#F08080 Bem vido a gang " .. getTeamName ( "PlayerTeam" ).." ! ", source, 255, 255, 255, true ) end end addEventHandler ( "onPlayerLogin", root, Check ) no work Link to comment
TAPL Posted January 25, 2014 Share Posted January 25, 2014 Why you put this "PlayerTeam"? Also remove source from here: function Check ( source ) 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