Xwad Posted September 25, 2015 Share Posted September 25, 2015 hi i created a marker in a function but the other funvtion is not starting when i enter the marker.. The createMarkerG6 is not starting when i enter the "markerG6" maker! function createMarkerG6(hitElement, matchingDimension, thePlayer) if getElementType(hitElement) =="player" and getPlayerTeam(hitElement) and getTeamName (getPlayerTeam(hitElement)) == "German" then triggerClientEvent ( thePlayer, root, "CreateVshop_g" ) else outputChatBox("You can't buy form the enemys shop!",thePlayer,255,50 ,50 ) end end addEventHandler("onMarkerHit", markerG6, createMarkerG6) function captureAreaG6() destroyElement ( UA6 ) destroyElement ( markerA6 ) GA6 = createRadarArea ( -1220, -1165, 250, 300, 40, 40, 40, alpha ) markerG6 = createMarker ( -1082.77, -1173.14, 128, "cylinder", 3, 255, 255, 0, 170 ) end Link to comment
KariiiM Posted September 25, 2015 Share Posted September 25, 2015 Hey, does alpha is defined? it's a full code or part of , if yes then i fixed your code function createMarkerG6(hitElement, matchingDimension) if getElementType(hitElement) =="player" and getPlayerTeam(hitElement) and getTeamName (getPlayerTeam(hitElement)) == "German" then triggerClientEvent ( hitElement,"CreateVshop_g",hitElement ) else outputChatBox("You can't buy form the enemys shop!",hitElement,255,50 ,50 ) end end addEventHandler("onResourceStart", resourceRoot, function () if isElement(UA6) then destroyElement ( UA6 ) end if isElement(markerA6) then destroyElement ( markerA6 ) end GA6 = createRadarArea ( -1220, -1165, 250, 300, 40, 40, 40, alpha ) local markerG6 = createMarker ( -1082.77, -1173.14, 128, "cylinder", 3, 255, 255, 0, 170 ) addEventHandler("onMarkerHit", markerG6, createMarkerG6) end) Link to comment
Xwad Posted September 25, 2015 Author Share Posted September 25, 2015 Yeah the alpha is nefined and its just a part of my script. Here is the full script. And thanks for the fast answer! --markers local marker6 = createMarker(-1066.28, -1146.61, 129.87, 'cylinder', 3, 250, 250, 250, 250) --shop markers local alpha = 170 --AREA MARKER6 --on marker hit function createMarker6(hitElement, matchingDimension) if getElementType(hitElement) =="player" and getPlayerTeam(hitElement) and getTeamName (getPlayerTeam(hitElement)) == "German" then outputChatBox("Please,Stay 10 Secs in the marker to capture the area!",thePlayer,255,109 ,109 ) timer6 = setTimer ( captureAreaG6, 4000, 1 ) else outputChatBox("Please,Stay 10 Secs in the marker to capture the area!",thePlayer,255,109 ,109 ) timer6 = setTimer ( captureAreaA6, 4000, 1 ) end end addEventHandler("onMarkerHit", marker6, createMarker6) function createMarkerG6(hitElement, matchingDimension, thePlayer) if getElementType(hitElement) =="player" and getPlayerTeam(hitElement) and getTeamName (getPlayerTeam(hitElement)) == "German" then triggerClientEvent ( thePlayer, root, "CreateVshop_g" ) else outputChatBox("You can't buy form the enemys shop!",thePlayer,255,50 ,50 ) end end addEventHandler("onMarkerHit", markerG6, createMarkerG6) --on marker leave function markerLeave6( leaveElement, matchingDimension, theTimer, thePlayer ) if isTimer ( timer6 ) then outputChatBox("You have failed to capture the area!",getRootElement(), 255, 50, 50) killTimer ( timer6 ) end end addEventHandler( "onMarkerLeave", marker6, markerLeave6 ) function captureAreaG6() destroyElement ( UA6 ) destroyElement ( markerA6 ) GA6 = createRadarArea ( -1220, -1165, 250, 300, 40, 40, 40, alpha ) markerG6 = createMarker ( -1082.77, -1173.14, 128, "cylinder", 3, 255, 255, 0, 170 ) end function captureAreaA6() destroyElement ( UA6 ) destroyElement ( markerG6 ) UA6 = createRadarArea ( -1220, -1165, 250, 300, 255, 255, 31, alpha ) end Link to comment
KariiiM Posted September 25, 2015 Share Posted September 25, 2015 Yeah the alpha is nefined and its just a part of my script. Here is the full script. And thanks for the fast answer! You're welcome ,so your problem is solved or still need help? Link to comment
xeon17 Posted September 25, 2015 Share Posted September 25, 2015 addEventHandler("onMarkerHit", root, function (player, matchingDimensions) if (source == markerG6 and matchingDimensions)) then if (getElementType(player) == "player" and getPlayerTeam (player) and getTeamName (getPlayerTeam(player))) == "German" then triggerClientEvent (player, "CreateVshop_g", player) else outputChatBox("You can't buy form the enemys shop!", player,255,50 ,50 ) end end end) function captureAreaG6() destroyElement ( UA6 ) destroyElement ( markerA6 ) GA6 = createRadarArea ( -1220, -1165, 250, 300, 40, 40, 40, alpha ) markerG6 = createMarker ( -1082.77, -1173.14, 128, "cylinder", 3, 255, 255, 0, 170 ) end Link to comment
Xwad Posted September 25, 2015 Author Share Posted September 25, 2015 Ohh cool now its working! Thanks guys! Link to comment
Xwad Posted September 28, 2015 Author Share Posted September 28, 2015 One more question. I tryed to make that i created a marker and if a player hit the marker then it will check the team ,and if the player is from the german team then a timer will start the captureAreaG6 function. And if the player is in America team then it will start the captureAreaA6.. The problem is that its only working if the player is in german team.. Its not working with america team.. The captureAreaA6 function is not starting:( (This is not the full script) local marker6 = createMarker(-1066.28, -1146.61, 129.87, 'cylinder', 3, 250, 250, 250, 250) local alpha = 170 function markerHit6(hitElement, matchingDimension, player) if getElementType(hitElement) =="player" and getPlayerTeam(hitElement) and getTeamName (getPlayerTeam(hitElement)) == "America" then if isElement (GA6) then outputChatBox("Please,Stay 10 Secs in the marker to capture the area!",thePlayer,255,109 ,109 ) timer6 = setTimer ( captureAreaA6, 4000, 1 ) else if getElementType(hitElement) =="player" and getPlayerTeam(hitElement) and getTeamName (getPlayerTeam(hitElement)) == "German" then if isElement (UA6) then outputChatBox("Please,Stay 10 Secs in the marker to capture the area!",thePlayer,255,109 ,109 ) timer6 = setTimer ( captureAreaG6, 4000, 1 ) else cancelEvent() end end end end end addEventHandler("onMarkerHit", marker6, markerHit6) function captureAreaG6(commandName, player) GA6 = createRadarArea ( -1220, -1165, 250, 300, 40, 40, 40, alpha ) markerG6 = createMarker ( -1082.77, -1173.14, 128, "cylinder", 3, 255, 255, 0, 170 ) if isElement(markerA6) then destroyElement ( markerA6 ) destroyElement ( UA6 ) end end function captureAreaA6(commandName, player) UA6 = createRadarArea ( -1220, -1165, 250, 300, 255, 255, 31, alpha ) markerA6 = createMarker ( -1082.77, -1173.14, 128, "cylinder", 3, 255, 255, 0, 170 ) if isElement(markerG6) then destroyElement ( markerG6 ) destroyElement ( GA6 ) end end Link to comment
ozulus Posted September 29, 2015 Share Posted September 29, 2015 Try that local marker6 = createMarker(-1066.28, -1146.61, 129.87, 'cylinder', 3, 250, 250, 250, 250) local alpha = 170 function markerHit6(hitElement, matchingDimension, player) if getElementType(hitElement) =="player" then if getPlayerTeam(hitElement) and getTeamName (getPlayerTeam(hitElement)) == "America" then if isElement(GA6) then outputChatBox("Please,Stay 10 Secs in the marker to capture the area!",thePlayer,255,109 ,109 ) timer6 = setTimer ( captureAreaA6, 4000, 1 ) else cancelEvent() end elseif getPlayerTeam(hitElement) and getTeamName (getPlayerTeam(hitElement)) == "German" then if isElement(UA6) then outputChatBox("Please,Stay 10 Secs in the marker to capture the area!",thePlayer,255,109 ,109 ) timer6 = setTimer ( captureAreaG6, 4000, 1 ) else cancelEvent() end end end end addEventHandler("onMarkerHit", marker6, markerHit6) function captureAreaG6(commandName, player) GA6 = createRadarArea ( -1220, -1165, 250, 300, 40, 40, 40, alpha ) markerG6 = createMarker ( -1082.77, -1173.14, 128, "cylinder", 3, 255, 255, 0, 170 ) if isElement(markerA6) then destroyElement ( markerA6 ) destroyElement ( UA6 ) end end function captureAreaA6(commandName, player) UA6 = createRadarArea ( -1220, -1165, 250, 300, 255, 255, 31, alpha ) markerA6 = createMarker ( -1082.77, -1173.14, 128, "cylinder", 3, 255, 255, 0, 170 ) if isElement(markerG6) then destroyElement ( markerG6 ) destroyElement ( GA6 ) end end 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