Thivenin Posted August 31, 2013 Share Posted August 31, 2013 hai all, I have a problem first here the script : --Teams copTeams = { ["Police"] = true, ["Squads"] = true, ["SCO19"] = true, ["United States Secret Service"] = true, ["The United States Army"] = true } criminalTeams = { ["Criminals"] = true, ["The Confederate States Army"] = true, ["Gangs"] = true, ["Night Factory"] = true } --First door FirstDoor = createObject ( 2929, 288.299, 1411.199, 11.199, 0, 0, 90 ) FirstMarker = createMarker ( 288.7, 1411.5, 9.399, "cylinder", 5, 255, 0, 0, 0 ) function firstDoorCops ( markerHit, matchingDimension ) if copTeams [ getElementData ( source, "team" ) ] then if ( markerHit == FirstMarker ) then moveObject ( FirstDoor, 5000, 288.299, 1411.199, 13.899 ) end end end addEventHandler ( "onPlayerMarkerHit", getRootElement(), firstDoorCops ) function firstDoorCrims ( markerHit, matchingDimension ) if CriminalTeams [ getElementData ( source, "team" ) ] then if ( markerHit == FirstMarker ) then moveObject ( FirstDoor, 20000, 288.299, 1411.199, 13.899 ) end end end addEventHandler ( "onPlayerMarkerHit", getRootElement(), firstDoorCrims ) --secoundDoor SecoundDoor = createObject ( 2929, 204, 1411.19, 11.199, 0, 0, 90 ) SecoundMarker = createMarker ( 208.6, 1410.9, 9.6, "cylinder", 255, 0, 0, 0 ) function secoundDoorCrims ( markerHit, matchingDimension ) if CriminalTeams [ getElementData ( source, "team" ) ] then if ( markerHit == SecoundMarker ) then moveObject ( SecoundDoor, 20000, 204, 1411.199, 13.899 ) end end end addEventHandler ( "onPlayerMarkerHit", getRootElement(), secoundDoorCrims ) the problem is when I hit the marker in one of the right team it's making this error "attempt to index global 'criminalTeams'" to the line 47 and 61 ( 43 and 47 for you ) tanks for help in advance ^^ Link to comment
xXMADEXx Posted August 31, 2013 Share Posted August 31, 2013 ((Not Tested)) --Teams copTeams = { ["Police"] = true, ["Squads"] = true, ["SCO19"] = true, ["United States Secret Service"] = true, ["The United States Army"] = true } criminalTeams = { ["Criminals"] = true, ["The Confederate States Army"] = true, ["Gangs"] = true, ["Night Factory"] = true } --First door FirstDoor = createObject ( 2929, 288.299, 1411.199, 11.199, 0, 0, 90 ) FirstMarker = createMarker ( 288.7, 1411.5, 9.399, "cylinder", 5, 255, 0, 0, 0 ) function firstDoorCops ( markerHit, matchingDimension ) local team = getPlayerteam ( markerHit ) if ( getElementType ( hitMarker ) == 'player' and team and copTeams[getTeamName(team)] ) then moveObject ( FirstDoor, 5000, 288.299, 1411.199, 13.899 ) moveObject ( FirstDoor, 20000, 288.299, 1411.199, 13.899 ) end end addEventHandler ( "onMarkerHit", FirstMarker, firstDoorCops ) --Second SecoundDoor = createObject ( 2929, 204, 1411.19, 11.199, 0, 0, 90 ) SecoundMarker = createMarker ( 208.6, 1410.9, 9.6, "cylinder", 255, 0, 0, 0 ) function secoundDoorCrims ( markerHit, matchingDimension ) local team = getPlayerTeam ( markerHit ) if ( getElementType ( hitMarker ) == 'player' and team and criminalTeams[getTeamName(team)] ) then moveObject ( SecoundDoor, 20000, 204, 1411.199, 13.899 ) end end addEventHandler ( "onMarkerHit", getRootElement(), secoundDoorCrims ) Link to comment
Thivenin Posted August 31, 2013 Author Share Posted August 31, 2013 not sure that will work tbh, because I want a time different for copTeams and for crimTeams Link to comment
funstein Posted September 10, 2013 Share Posted September 10, 2013 Lua is case-sensitive: write criminalTeams instead of CriminalTeams thoughout the whole thing. 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