Scommer Posted November 4, 2009 Share Posted November 4, 2009 I'm trying to make that when player hit the marker and press "f" button he will be teleported to interior,but i doing something wrong cuz when i hit marker it teleports me to interior,but i wanna make that if i press "f" button only then marker teleport me to interior. local enterLSPD = createMarker ( 1554.7901611328, -1675.5651855469, 15.116052627563, "cylinder", 1.1, 0, 255, 0, 175 ) function MarkerHit ( player, hitPlayer, matchingDimensio, key, keyState ) if bindKey ( player, "f", "down", MarkerHit ) and getElementType(hitPlayer)=="player" and source == enterLSPD then setElementInterior( hitPlayer, 6, 246.78932189941 , 62.632732391357, 1002.6146240234 ) setElementPosition(hitPlayer,247.78932189941,65.632732391357,1004.6146240234) setPedRotation(hitPlayer,90) end end function bindKeyLSPD ( player, commandName ) bindKey ( player, "f", "down", MarkerHit ) end addEventHandler ( "onPlayerJoin", getRootElement(), bindKeyLSPD ) Link to comment
DakiLLa Posted November 4, 2009 Share Posted November 4, 2009 thats my way of a code like your, should work i think you need to bind your key when you hit marker so i did a function for that and also function to unbind key, when you leave marker. local enterLSPD = createMarker ( 1554.7901611328, -1675.5651855469, 15.116052627563, "cylinder", 1.1, 0, 255, 0, 175 ) function markerHit( player ) if getElementType( player ) == "player" and source == enterLSPD then bindKey( player, "f", "down", teleport ) outputChatBox( "Press 'f' button to teleport somewhere..", player, 0, 255, 0 ) end end addEventHandler( "onMarkerHit", getRootElement(), markerHit ) function markerLeave( player ) if getElementType( player ) == "player" and source == enterLSPD then unbindKey( player, "f", "down", teleport ) end end addEventHandler( "onMarkerLeave", getRootElement(), markerLeave ) function teleport( player, key, keyState ) setElementInterior( player, 6, 246.78932189941 , 62.632732391357, 1002.6146240234 ) setElementPosition( player, 247.78932189941, 65.632732391357, 1004.6146240234 ) setPedRotation( player, 90 ) end Link to comment
MOH Posted November 5, 2009 Share Posted November 5, 2009 Hmm, what interior may that be? Link to comment
Scommer Posted November 5, 2009 Author Share Posted November 5, 2009 In DaK script unbindkey doesn't work so i made it working after long time thinking local enterLSPD = createMarker ( 1554.7901611328, -1675.5651855469, 15.116052627563, "cylinder", 1.1, 0, 255, 0, 175 ) function markerHit( player ) if getElementType( player ) == "player" and source == enterLSPD then bindKey( player, "f", "down", teleport ) end end addEventHandler( "onMarkerHit", getRootElement(), markerHit ) function teleport( player, key, keyState ) setElementInterior( player, 6, 246.78932189941 , 62.632732391357, 1002.6146240234 ) setElementPosition( player, 247.78932189941, 65.632732391357, 1004.6146240234 ) setPedRotation( player, 90 ) unbindKey ( player, "f", "down", teleport ) end Link to comment
DakiLLa Posted November 5, 2009 Share Posted November 5, 2009 ahh, yee, agree with you to unbind it when you teleporting Link to comment
Wojak Posted November 6, 2009 Share Posted November 6, 2009 Hmm… but if you have your mind (don’t enter the building) and go back for example to your car, it will teleport you to interior, when you will try to enter the car by pressing ‘f’ 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