MrDante Posted June 21, 2016 Posted June 21, 2016 (edited) Sorry my bad english Guys is this, I'm kind of horrible mess with tables as there are always mistakes: lol: So wanted to make the player caught the vehicle, typing the command / trabalharaqui, and goes toward another marker after getting it the vehicle destroys, but if two players, if you get to the marker, will destroy your and the other player .. I'm debating about that a long time, someone could help? local marker = createMarker (2211, -2506, 12.8, "cylinder", 1, 255,0,0,255) local mark2 = createMarker (667, -615, 16, "cylinder", 4, 255,0,0,255) local blip = createBlip(667, -615, 17, 0) createBlip (2211, -2506, 12.8, 51) setElementVisibleTo(mark2, root, false) setElementVisibleTo(blip, root, false) veh = {} function entrarmarker(Jogador) if(isElement(Jogador)) and (getElementType(Jogador) == "player") then if (not isPedInVehicle(Jogador)) then if veh[Jogador] and isElement(veh[Jogador]) then destroyElement(veh[Jogador]) veh[Jogador] = nil end veh[Jogador] = createVehicle ( 408, 2200, -2509, 12.5 + 10 ) end end end addEventHandler("onMarkerHit", marker, entrarmarker) function commandMarker(Jogador) if isElementWithinMarker(Jogador, marker) then setElementData(Jogador, "trab", true) warpPedIntoVehicle(Jogador, veh[Jogador]) setElementVisibleTo(mark2, Jogador, true) setElementVisibleTo(blip, Jogador, true) end end addCommandHandler("trabalharaqui", commandMarker) function des (Jogador) if(isElement(Jogador)) and (getElementType(Jogador) == "player") then if getElementData(Jogador, "trab") then if veh[Jogador] and isElement(veh[Jogador]) then destroyElement (veh[Jogador]) end destroyElement(marker) setElementVisibleTo(mark2, Jogador, false) outputChatBox ( "#ff0000PARAB?NS VOC? TERMINOU A ENTREGA DE LIXO E GANHOU 500$ !", source, 255,255,255, true) givePlayerMoney ( Jogador, 500) removeElementData(Jogador, "trab") setTimer(function() restartResource(getThisResource()) end, 100, 1) end end end addEventHandler( "onMarkerHit", mark2, des) And I'd like someone to explain, why create something on the table with the player element, you can use another name? example: veh = {} veh["veiculo"] = createVehicle...; Edited June 21, 2016 by Guest
MR.S3D Posted June 21, 2016 Posted June 21, 2016 --1 - make tabel veh = {} veh["veiculo"] = {} --2 - add pLAYER TO TABEL veh["veiculo"][Player] = createVehicle... --3- for destroyElement if veh["veiculo"][Player] and isElement( veh["veiculo"][Player] ) then destroyElement(veh["veiculo"][Player]) veh["veiculo"][Player] = nil end
MrDante Posted June 21, 2016 Author Posted June 21, 2016 --1 - make tabel veh = {} veh["veiculo"] = {} --2 - add pLAYER TO TABEL veh["veiculo"][Player] = createVehicle... --3- for destroyElement if veh["veiculo"][Player] and isElement( veh["veiculo"][Player] ) then destroyElement(veh["veiculo"][Player]) veh["veiculo"][Player] = nil end is not resolved
MR.S3D Posted June 21, 2016 Posted June 21, 2016 local marker = createMarker (2211, -2506, 12.8, "cylinder", 1, 255,0,0,255) local mark2 = createMarker (667, -615, 16, "cylinder", 4, 255,0,0,255) local blip = createBlip(667, -615, 17, 0) createBlip (2211, -2506, 12.8, 51) setElementVisibleTo(mark2, root, false) setElementVisibleTo(blip, root, false) veh = {} function entrarmarker(Jogador) if(isElement(Jogador)) and (getElementType(Jogador) == "player") then if veh[Jogador] and isElement(veh[Jogador]) then destroyElement(veh[Jogador]) veh[Jogador] = nil end if (not isPedInVehicle(Jogador)) then veh[Jogador] = createVehicle ( 408, 2200, -2509, 12.5 + 10 ) outputChatBox ( "#ff0000use /trabalharaqui", Jogador, 255,255,255, true) end end end addEventHandler("onMarkerHit", marker, entrarmarker) function commandMarker(Jogador) if isElementWithinMarker(Jogador, marker) then setElementData(Jogador, "trab", true) warpPedIntoVehicle(Jogador, veh[Jogador]) setElementVisibleTo(mark2, Jogador, true) setElementVisibleTo(blip, Jogador, true) end end addCommandHandler("trabalharaqui", commandMarker) function des (Jogador) if(isElement(Jogador)) and (getElementType(Jogador) == "player") then if getElementData(Jogador, "trab") then if veh[Jogador] and isElement(veh[Jogador]) then destroyElement (veh[Jogador]) veh[Jogador] = nil end ---destroyElement(marker) setElementVisibleTo(marker, Jogador, false) setElementVisibleTo(mark2, Jogador, false) outputChatBox ( "#ff0000PARAB?NS VOC? TERMINOU A ENTREGA DE LIXO E GANHOU 500$ !", Jogador, 255,255,255, true) givePlayerMoney ( Jogador, 500) removeElementData(Jogador, "trab") setTimer(function() restartResource(getThisResource()) end, 100, 1) end end end addEventHandler( "onMarkerHit", mark2, des)
MrDante Posted June 21, 2016 Author Posted June 21, 2016 local marker = createMarker (2211, -2506, 12.8, "cylinder", 1, 255,0,0,255) local mark2 = createMarker (667, -615, 16, "cylinder", 4, 255,0,0,255) local blip = createBlip(667, -615, 17, 0) createBlip (2211, -2506, 12.8, 51) setElementVisibleTo(mark2, root, false) setElementVisibleTo(blip, root, false) veh = {} function entrarmarker(Jogador) if(isElement(Jogador)) and (getElementType(Jogador) == "player") then if veh[Jogador] and isElement(veh[Jogador]) then destroyElement(veh[Jogador]) veh[Jogador] = nil end if (not isPedInVehicle(Jogador)) then veh[Jogador] = createVehicle ( 408, 2200, -2509, 12.5 + 10 ) outputChatBox ( "#ff0000use /trabalharaqui", Jogador, 255,255,255, true) end end end addEventHandler("onMarkerHit", marker, entrarmarker) function commandMarker(Jogador) if isElementWithinMarker(Jogador, marker) then setElementData(Jogador, "trab", true) warpPedIntoVehicle(Jogador, veh[Jogador]) setElementVisibleTo(mark2, Jogador, true) setElementVisibleTo(blip, Jogador, true) end end addCommandHandler("trabalharaqui", commandMarker) function des (Jogador) if(isElement(Jogador)) and (getElementType(Jogador) == "player") then if getElementData(Jogador, "trab") then if veh[Jogador] and isElement(veh[Jogador]) then destroyElement (veh[Jogador]) veh[Jogador] = nil end ---destroyElement(marker) setElementVisibleTo(marker, Jogador, false) setElementVisibleTo(mark2, Jogador, false) outputChatBox ( "#ff0000PARAB?NS VOC? TERMINOU A ENTREGA DE LIXO E GANHOU 500$ !", Jogador, 255,255,255, true) givePlayerMoney ( Jogador, 500) removeElementData(Jogador, "trab") setTimer(function() restartResource(getThisResource()) end, 100, 1) end end end addEventHandler( "onMarkerHit", mark2, des) Friend, you edited a part that does not matter in this topic.
MR.S3D Posted June 21, 2016 Posted June 21, 2016 Sorry, but I did n't understand what you want ! why you use destroyElement(marker) use this setElementVisibleTo(marker, Jogador, false) this code for restart resource setTimer(function() restartResource(getThisResource()) end, 100, 1) why?
MrDante Posted June 21, 2016 Author Posted June 21, 2016 When two players enter, and go to the mark2 as a result was to destroy the vehicle of those in marker, but when two players, destroy the two vehicles understood?
MR.S3D Posted June 21, 2016 Posted June 21, 2016 When two players enter, and go to the mark2 as a result was to destroy the vehicle of those in marker, but when two players, destroy the two vehiclesunderstood? so, you need destroy two vehicles. when tow player hit mark2?
MrDante Posted June 21, 2016 Author Posted June 21, 2016 When two players enter, and go to the mark2 as a result was to destroy the vehicle of those in marker, but when two players, destroy the two vehiclesunderstood? so, you need destroy two vehicles. when tow player hit mark2? not, it destroys, but it was only to destroy those who enter the marker, not everyone who took the vehicle but already decided, the script is not mine, I tested because my friend was in trouble .. I realize when, who was destroying was restartResource I am a very sluggish person
MR.S3D Posted June 21, 2016 Posted June 21, 2016 When two players enter, and go to the mark2 as a result was to destroy the vehicle of those in marker, but when two players, destroy the two vehiclesunderstood? so, you need destroy two vehicles. when tow player hit mark2? not, it destroys, but it was only to destroy those who enter the marker, not everyone who took the vehicle but already decided, the script is not mine, I tested because my friend was in trouble .. I realize when, who was destroying was restartResource I am a very sluggish person yes, I said why use restart
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