bosslorenz Posted July 26, 2016 Share Posted July 26, 2016 How can I make player who hit LSJob_in with (wanted > 5) will not warp in setElementPosition(player, 1727, -1640.53, 20.2) instead they will spawn on my desired location. LSJob_in = createMarker(1727, -1637, 20.5, "arrow", 1, 0, 255, 0, 255) LSJob_out = createMarker (1727, -1637.7, 20.5, "arrow", 1, 0, 255, 0, 255) function LSJobWarp(player) if (source == LSJob_in and getElementType(player) == "player") then setElementPosition(player, 1727, -1640.53, 20.2) setElementFrozen(player, false) setTimer(setElementFrozen, 1000, 1, player, false) elseif (source == LSJob_out and getElementType(player) == "player") then setElementPosition(player, 1727, -1635, 20.2) setTimer(setElementFrozen, 2500, 1, player, true) outputChatBox("Come back again!", 0, 255, 0) end end addEventHandler("onMarkerHit", root, LSJobWarp) Link to comment
Walid Posted July 26, 2016 Share Posted July 26, 2016 Try this local LSJob_in = createMarker(1727, -1637, 20.5, "arrow", 1, 0, 255, 0, 255) local LSJob_out = createMarker (1727, -1637.7, 20.5, "arrow", 1, 0, 255, 0, 255) function LSJobWarp(player) if (player and isElement(player) and getElementType(player) == "player") then if (source == LSJob_in) then local watedLevel = getPlayerWantedLevel (player) if watedLevel > 5 then return end setElementPosition(player, 1727, -1640.53, 20.2) setElementFrozen(player, false) setTimer(setElementFrozen, 1000, 1, player, false) elseif (source == LSJob_out) then setElementPosition(player, 1727, -1635, 20.2) setTimer(setElementFrozen, 2500, 1, player, true) outputChatBox("Come back again!", 0, 255, 0) end end end addEventHandler("onMarkerHit", root, LSJobWarp) Link to comment
bosslorenz Posted July 26, 2016 Author Share Posted July 26, 2016 function LSJobWarp(player) if (player and isElement(player) and getElementType(player) == "player") then if (source == LSJob_in) then local watedLevel = getPlayerWantedLevel (player) if watedLevel > 5 then outputChatBox("You have been caught escaping, you are jailed!", 255, 0, 0) return end setElementPosition(player, 1727, -1640.53, 20.2) setElementInterior(player, 18) setTimer(setElementFrozen, 3000, 1, player, false) elseif (source == LSJob_out) then setElementPosition(player, 1727, -1635, 20.2) setElementInterior(player,0) setTimer(setElementFrozen, 3000, 1, player, false) outputChatBox("Come back again!", 0, 255, 0) end end end addEventHandler("onMarkerHit", root, LSJobWarp) Why is that I added outputChatBox after wantedLevel > 5 it doesnt work Link to comment
Walid Posted July 26, 2016 Share Posted July 26, 2016 Bump added player here it's server side code. outputChatBox("You have been caught escaping, you are jailed!",player, 255, 0, 0) Link to comment
bosslorenz Posted July 27, 2016 Author Share Posted July 27, 2016 Thanks @Walid. Also I forgot the the player on elseif code. FIXED. Link to comment
Walid Posted July 27, 2016 Share Posted July 27, 2016 Thanks @Walid. Also I forgot the the player on elseif code. FIXED. You are welcome 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