AlexWo Posted April 6, 2014 Share Posted April 6, 2014 Hello I have a problem in my script... I have 2 Markers and if I enter the second marker, the function of my first marker appears... At the moment my script is only Client Side: objecttosteal = createObject ( 2914, 2000, 1567, 14.5, 0, 0, 0 ) createBlipAttachedTo ( objecttosteal, 53 ) local attachedmarker = createMarker ( 2000, 1567, 13, "cylinder", 1.5, 0, 255, 255, 150 ) attachElements ( attachedmarker, objecttosteal, 0, 0, 0 ) armyblip = createBlip(2294, 2459, 10, 44) function chooseteam () local x,y = guiGetScreenSize() TeamWindow = guiCreateWindow ( 0.25, 0.25, 0.4, 0.4, "BF3 'Capture the Flag' by AlexWo", true ) TeamPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, TeamWindow ) TeamTab = guiCreateTab( "Choose Team", TeamPanel ) --Team Choose Labels Text local localPlayerName = getPlayerName(getLocalPlayer()) modinfo = guiCreateLabel(0.39, 0.95, 0.9, 0.2, "Capture the Flag - by AlexWo", true, TeamTab) guiLabelSetColor (modinfo, 255, 0, 0) namelabel = guiCreateLabel(0.02, 0.1, 0.9, 0.2, "Welcome " ..localPlayerName.."!", true, TeamTab) chooseateam = guiCreateLabel(0.02, 0.16, 0.9, 0.2, "Please Choose a Team!", true, TeamTab) guiLabelSetColor (chooseateam, 255, 255, 0) guiLabelSetColor (namelabel, 255, 255, 0) --Pictures guiCreateStaticImage( 480, 30, 250, 120, "images/dogtagctf.png", false, TeamTab ) --Task Descriptiont tasktext1 = guiCreateLabel(0.25, 0.3, 0.9, 0.2, "Your Task is to steal the Flag of the other Team!", true, TeamTab) tasktext2 = guiCreateLabel(0.25, 0.35, 0.9, 0.2, "Be careful, they might steal your Flag, too!", true, TeamTab) tasktext3 = guiCreateLabel(0.25, 0.4, 0.9, 0.2, "Try to stop them!", true, TeamTab) guiLabelSetColor (tasktext1, 0, 255, 150) guiLabelSetColor (tasktext2, 0, 255, 150) guiLabelSetColor (tasktext3, 0, 255, 150) ArmyRadioButton = guiCreateRadioButton(10,80,120,32,"Army",false, TeamTab) guiRadioButtonSetSelected(ArmyRadioButton,true) TerroristsRadioButton = guiCreateRadioButton(10,120,120,32,"Terrorists",false, TeamTab) exitbutton = guiCreateButton( 0.6, 0.8, 0.3, 0.10, "Cancel", true, TeamTab ) choosebutton = guiCreateButton( 0.1, 0.8, 0.3, 0.10, "Choose", true, TeamTab) showCursor(true) end addCommandHandler("bf", chooseteam) function closegui (state) if state == "left" then if source == exitbutton then guiSetVisible(TeamWindow , false) showCursor(false) end end end addEventHandler("onClientGUIClick", getRootElement(), closegui) function setTeam (state) if state == "left" then if source == choosebutton then if(guiRadioButtonGetSelected(ArmyRadioButton))then triggerServerEvent("giveEquipmentLS", getLocalPlayer(), thePlayer) guiSetVisible(TeamWindow, false) showCursor(false) elseif(guiRadioButtonGetSelected(TerroristsRadioButton))then triggerServerEvent("giveEquipmentSF", getLocalPlayer(), thePlayer) guiSetVisible(TeamWindow, false) showCursor(false) end end end end addEventHandler("onClientGUIClick", getRootElement(), setTeam) function attachobjectterror() attachElements ( objecttosteal, localPlayer, 0.5, 0, -0.5 ) setMarkerColor ( attachedmarker, 0, 255, 0, 0 ) end function attachobjectarmy() if isPedInVehicle(localPlayer) then outputChatBox("You can't use Vehicles to steal the Flag!", 255, 0, 0) else attachElements ( objecttosteal, localPlayer, 0.5, 0, -0.5 ) setMarkerColor ( attachedmarker, 0, 255, 0, 0 ) outputChatBox("The Army picked up the Flag!", 255, 255, 0) armymarker() end end function armymarker() destinationmarkerarmy = createMarker( 2294, 2459, 10, "cylinder", 2, 255, 255, 255, 150, localPlayer ) if isElementWithinMarker (destinationmarkerarmy, localPlayer) then outputChatBox("The Army Team reached their Marker", 255, 255, 255) end end addEventHandler("onClientMarkerHit", destinationmarkerarmyt, givepoints) function givepoints() outputChatBox("Congratz", 255, 255, 255) end function getModelID(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then theSkin = getElementModel ( getLocalPlayer() ) if (theSkin == 287) then attachobjectarmy() end end end addEventHandler("onClientMarkerHit", getRootElement(), getModelID) function detachbyenteringVehicles() local x,y,z = getElementPosition( objecttosteal ) if isElementAttached ( objecttosteal ) then detachElements ( objecttosteal, localPlayer ) setElementPosition ( objecttosteal, x +2, y, z -0.5 ) setMarkerColor ( attachedmarker, 0, 0, 255, 150 ) outputChatBox("Flag has been lost! Try to get it!", 100, 100, 255, localPlayer) destroyElement(destinationmarkerarmy) else outputChatBox("You entered a Vehicle", 0, 255, 255, localPlayer) end end addEventHandler("onClientPlayerVehicleEnter",getRootElement(),detachbyenteringVehicles) By the way the function of the second marker begins in line 97 Thank you Link to comment
iPrestege Posted April 6, 2014 Share Posted April 6, 2014 Do you see this? addEventHandler("onClientMarkerHit", getRootElement(), getModelID) Change the root element to the marker variable. 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