Resmurf Posted June 9, 2011 Share Posted June 9, 2011 local myMarker = createMarker( -303.26, 1601.41, 1054.69, 'cylinder', 2.0, 0, 0, 255, 150 ) function MarkerHit( hitElement, matchingDimension ) setElementModel(hitElement,164) giveWeapon ( hitElement, 3, 700, true ) setPlayerTeam ( hitElement, teamcia ) end addEventHandler( "onMarkerHit", myMarker, MarkerHit ) I did this when players join the marker join a team, but how i do it for example, for acl group CIA please help, i want when player join the marker move to team, but only people on the acl group Link to comment
Castillo Posted June 9, 2011 Share Posted June 9, 2011 (edited) markers = {} markers[1] = createMarker(-303.26, 1601.41, 1054.69, 'cylinder', 2.0, 0, 0, 255, 150) --marker ID, ACL name, Team name, Skin, Weapon, Ammo. teamACL = { [1] = {"CIA","CIA Team",164,3,700}, } function onMarkerHitSetTeam(hitPlayer,matchingDimension) for i,v in pairs(markers) do if (source == v) then if getElementType(hitPlayer) == "player" and matchingDimension then local account = getPlayerAccount(hitPlayer) if not account then return end local accountName = getAccountName(account) if isObjectInACLGroup("user."..accountName,aclGetGroup(teamACL[i][1])) then setPlayerTeam(hitPlayer, getTeamFromName(teamACL[i][2])) giveWeapon(hitPlayer,teamACL[i][4],teamACL[i][5],true) setElementModel(hitPlayer,teamACL[i][3]) end end end end end addEventHandler("onMarkerHit",getRootElement(),onMarkerHitSetTeam) Edited June 9, 2011 by Guest Link to comment
Resmurf Posted June 9, 2011 Author Share Posted June 9, 2011 teamACL means acl name? cause i get a error unfinished string. This dont even create the marker. Link to comment
Castillo Posted June 9, 2011 Share Posted June 9, 2011 That's because forum has a bug with setPlayerTeam, copy the code again. Link to comment
Resmurf Posted June 9, 2011 Author Share Posted June 9, 2011 (edited) works but it dont change team, but i think i can fix it i gotta change CIA team to teamcia rite?\ this is my team create teamcia = createTeam ( "CIA", 0, 0, 255 ) Edited June 9, 2011 by Guest Link to comment
Castillo Posted June 9, 2011 Share Posted June 9, 2011 (edited) It does change team, but you need to insert the EXACT team name in the table. Edited June 9, 2011 by Guest Link to comment
Resmurf Posted June 9, 2011 Author Share Posted June 9, 2011 It does change team, but you need to inser the EXACT team name in the table. Got it working! ty sir ^^ Link to comment
Resmurf Posted June 9, 2011 Author Share Posted June 9, 2011 i tried to do the same with army and dont work tell me whats wrong here please markers = {} markers[15] = createMarker(88.91, 2081.20, 16.78, 'cylinder', 2.0, 0, 0, 255, 150) --marker ID, ACL name, Team name, Skin, Weapon, Ammo. teamACL = { [15] = {"LVarmy","Military",287,3,700}, } function onMarkerHitSetTeam(hitPlayer,matchingDimension) for i,v in pairs(markers) do if (source == v) then if getElementType(hitPlayer) == "player" and matchingDimension then local account = getPlayerAccount(hitPlayer) if not account then return end local accountName = getAccountName(account) if isObjectInACLGroup("user."..accountName,aclGetGroup(teamACL[i][15])) then setPlayerTeam(hitPlayer, getTeamFromName(teamACL[i][16])) giveWeapon(hitPlayer,teamACL[i][18],teamACL[i][19],true) setElementModel(hitPlayer,teamACL[i][17]) end end end end end addEventHandler("onMarkerHit",getRootElement(),onMarkerHitSetTeam) i changed the numbers since they are already inuse with the CIA team error bad argument "aclgetgroup" Link to comment
Castillo Posted June 9, 2011 Share Posted June 9, 2011 Dude... you are using the same code for CIA, right? that's stupid and won't work, the point of my script is to make a GLOBAL team changer, so you just add markers[1], markers[2] and change teamACL table acording to the marker, ex: --marker ID, ACL name, Team name, Skin, Weapon, Ammo. teamACL = { [1] = {"CIA","CIA",164,3,700}, [2] = {"LVarmy","Military",287,3,700}, } The rest is already done by the script, nothing else is required. Link to comment
Resmurf Posted June 9, 2011 Author Share Posted June 9, 2011 if i put that then i will get a error in here setPlayerTeam(hitPlayer, getTeamFromName(teamACL[i][2])) Link to comment
Castillo Posted June 9, 2011 Share Posted June 9, 2011 Can you post here your FULL code? with CIA and Military. Link to comment
Resmurf Posted June 9, 2011 Author Share Posted June 9, 2011 Can you post here your FULL code? with CIA and Military. ok markers = {} markers[1] = createMarker(-303.26, 1601.41, 1054.69, 'cylinder', 2.0, 0, 0, 255, 150) markers[2] = createMarker(88.91, 2081.20, 16.78, 'cylinder', 2.0, 0, 0, 255, 150) --marker ID, ACL name, Team name, Skin, Weapon, Ammo. teamACL = { [1] = {"CIA","CIA",164,3,700}, [2] = {"LVarmy","Military",287,3,700}, } function onMarkerHitSetTeam(hitPlayer,matchingDimension) for i,v in pairs(markers) do if (source == v) then if getElementType(hitPlayer) == "player" and matchingDimension then local account = getPlayerAccount(hitPlayer) if not account then return end local accountName = getAccountName(account) if isObjectInACLGroup("user."..accountName,aclGetGroup(teamACL[i][1])) then setPlayerTeam(hitPlayer, getTeamFromName(teamACL[i][2])) giveWeapon(hitPlayer,teamACL[i][4],teamACL[i][5],true) setElementModel(hitPlayer,teamACL[i][3]) end end end end end addEventHandler("onMarkerHit",getRootElement(),onMarkerHitSetTeam) function onMarkerHitSetTeam(hitPlayer,matchingDimension) for i,v in pairs(markers) do if (source == v) then if getElementType(hitPlayer) == "player" and matchingDimension then local account = getPlayerAccount(hitPlayer) if not account then return end local accountName = getAccountName(account) if isObjectInACLGroup("user."..accountName,aclGetGroup(teamACL[i][1])) then setPlayerTeam(hitPlayer, getTeamFromName(teamACL[i][2])) giveWeapon(hitPlayer,teamACL[i][4],teamACL[i][5],true) setElementModel(hitPlayer,teamACL[i][3]) end end end end end addEventHandler("onMarkerHit",getRootElement(),onMarkerHitSetTeam) Link to comment
Castillo Posted June 9, 2011 Share Posted June 9, 2011 See? you did what I told you not to... you only need one function. markers = {} markers[1] = createMarker(-303.26, 1601.41, 1054.69, 'cylinder', 2.0, 0, 0, 255, 150) markers[2] = createMarker(88.91, 2081.20, 16.78, 'cylinder', 2.0, 0, 0, 255, 150) --marker ID, ACL name, Team name, Skin, Weapon, Ammo. teamACL = { [1] = {"CIA","CIA",164,3,700}, [2] = {"LVarmy","Military",287,3,700}, } function onMarkerHitSetTeam(hitPlayer,matchingDimension) for i,v in pairs(markers) do if (source == v) then if getElementType(hitPlayer) == "player" and matchingDimension then local account = getPlayerAccount(hitPlayer) if not account then return end local accountName = getAccountName(account) if isObjectInACLGroup("user."..accountName,aclGetGroup(teamACL[i][1])) then setPlayerTeam(hitPlayer, getTeamFromName(teamACL[i][2])) giveWeapon(hitPlayer,teamACL[i][4],teamACL[i][5],true) setElementModel(hitPlayer,teamACL[i][3]) end end end end end addEventHandler("onMarkerHit",getRootElement(),onMarkerHitSetTeam) Link to comment
Resmurf Posted June 9, 2011 Author Share Posted June 9, 2011 Everything working good ^^ thanks 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