OrbTanT Posted August 3, 2014 Share Posted August 3, 2014 How can I set for as soon as the player typing /skip, create a marker and a blip in the position of the marker, which will be the place where the player will have to go down with the parachute local Marker = createMarker ( -2235.21, -1736.60, 479.80, "cylinder", 2.5, 0, 0, 255, 170 ) function paraquedismo ( thePlayer, matchingDimension ) if isElementWithinMarker( thePlayer, Marker) then outputChatBox("Para pular de paraquedas digite /pular!", thePlayer, 255, 0, 0) end end addEventHandler ("onMarkerHit", Marker, paraquedismo) function pular ( playerSource ) setElementPosition( playerSource, -2235.21, -1736.60, 1000.80 ) end addCommandHandler ( "pular", pular ) Link to comment
OrbTanT Posted August 4, 2014 Author Share Posted August 4, 2014 Is occurring error marker, somebody could help, should give money when the player enter within the Marker1. error: WARNING: paraquedismo\server.lua:34: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil] server: local Marker = createMarker ( -2235.21, -1736.60, 479.80, "cylinder", 2.5, 0, 0, 255, 170 ) function paraquedismo ( thePlayer, matchingDimension ) if isElementWithinMarker( thePlayer, Marker) then outputChatBox("Para pular de paraquedas digite /pular!", thePlayer, 255, 0, 0) end end addEventHandler ("onMarkerHit", Marker, paraquedismo) function pular ( playerSource, matchingDimension ) if isElementWithinMarker( playerSource, Marker) then setElementPosition( playerSource, -2235.21, -1736.60, 1300.80 ) giveWeapon ( playerSource, 46 ) setPedWeaponSlot(playerSource, getSlotFromWeapon(46)) outputChatBox("Caia no Alvo para ganhar 5000$!", thePlayer, 255, 0, 0) local Marker1 = createMarker ( -2407.97, -596.58, 131.80, "cylinder", 7.0, 0, 0, 255, 170 ) local blip1 = createBlip( -2407.97, -596.58, 132.64, 0, 0, 0, 255, 255 ) setBlipSize ( blip1, 5 ) else outputChatBox("Você não está na área de Paraquedismo!", thePlayer, 255, 0, 0) end end addCommandHandler ( "pular", pular ) function cairmarker ( thePlayer, matchingDimension ) if isElementWithinMarker( thePlayer, Marker1) then setPlayerMoney(thePlayer, 5000) outputChatBox("Você ganhou 5000$ por cair no alvo!", thePlayer, 255, 0, 0) else outputChatBox("Você não conseguiu cair no Alvo!", thePlayer, 255, 0, 0) end end addEventHandler ("onMarkerHit", Marker1, cairmarker) Link to comment
Anubhav Posted August 4, 2014 Share Posted August 4, 2014 local Marker = createMarker ( -2235.21, -1736.60, 479.80, "cylinder", 2.5, 0, 0, 255, 170 ) function paraquedismo ( thePlayer, matchingDimension ) if isElementWithinMarker( thePlayer, Marker) then outputChatBox("Para pular de paraquedas digite /pular!", thePlayer, 255, 0, 0) end end addEventHandler ("onMarkerHit", Marker, paraquedismo) function pular ( playerSource, matchingDimension ) if isElementWithinMarker( playerSource, Marker) then setElementPosition( playerSource, -2235.21, -1736.60, 1300.80 ) giveWeapon ( playerSource, 46 ) setPedWeaponSlot(playerSource, getSlotFromWeapon(46)) outputChatBox("Caia no Alvo para ganhar 5000$!", thePlayer, 255, 0, 0) local Marker1 = createMarker ( -2407.97, -596.58, 131.80, "cylinder", 7.0, 0, 0, 255, 170 ) local blip1 = createBlip( -2407.97, -596.58, 132.64, 0, 0, 0, 255, 255 ) setBlipSize ( blip1, 5 ) else outputChatBox("Você não está na área de Paraquedismo!", thePlayer, 255, 0, 0) end end addCommandHandler ( "pular", pular ) function cairmarker ( thePlayer, matchingDimension ) if isElementWithinMarker( thePlayer, Marker) then setPlayerMoney(thePlayer, 5000) outputChatBox("Você ganhou 5000$ por cair no alvo!", thePlayer, 255, 0, 0) else outputChatBox("Você não conseguiu cair no Alvo!", thePlayer, 255, 0, 0) end end addEventHandler ("onMarkerHit", Marker, cairmarker) Link to comment
OrbTanT Posted August 4, 2014 Author Share Posted August 4, 2014 had to work with Marker1 Link to comment
Saml1er Posted August 4, 2014 Share Posted August 4, 2014 had to work with Marker1 Where is marker1 defined? Link to comment
Addlibs Posted August 4, 2014 Share Posted August 4, 2014 Line 18: Marker1 is defined as a local variable in the wrong scope. Possible solution: Don't make Marker1 a local variable, then change line 35 to attach to 'root' and add a check between line 27 and 28: if source == Marker1 then else return end Link to comment
Saml1er Posted August 4, 2014 Share Posted August 4, 2014 You can do all this with 1 event handler but I don't got much time to anyway here: local Marker,Marker1 = createMarker ( -2235.21, -1736.60, 479.80, "cylinder", 2.5, 0, 0, 255, 170 ), nil function paraquedismo ( thePlayer, matchingDimension ) if isElementWithinMarker( thePlayer, Marker) then outputChatBox("Para pular de paraquedas digite /pular!", thePlayer, 255, 0, 0) end end addEventHandler ("onMarkerHit", Marker, paraquedismo) function pular ( playerSource, matchingDimension ) if isElementWithinMarker( playerSource, Marker) then setElementPosition( playerSource, -2235.21, -1736.60, 1300.80 ) giveWeapon ( playerSource, 46 ) setPedWeaponSlot(playerSource, getSlotFromWeapon(46)) outputChatBox("Caia no Alvo para ganhar 5000$!", thePlayer, 255, 0, 0) Marker1 = createMarker ( -2407.97, -596.58, 131.80, "cylinder", 7.0, 0, 0, 255, 170 ) local blip1 = createBlip( -2407.97, -596.58, 132.64, 0, 0, 0, 255, 255 ) setBlipSize ( blip1, 5 ) else outputChatBox("Você não está na área de Paraquedismo!", thePlayer, 255, 0, 0) end end addCommandHandler ( "pular", pular ) function cairmarker ( thePlayer, matchingDimension ) if isElementWithinMarker( thePlayer, source) then if Marker1 == nil and source ~= Marker1 then return end setPlayerMoney(thePlayer, 5000) outputChatBox("Você ganhou 5000$ por cair no alvo!", thePlayer, 255, 0, 0) else outputChatBox("Você não conseguiu cair no Alvo!", thePlayer, 255, 0, 0) end end addEventHandler ("onMarkerHit",resourceRoot, cairmarker) 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