will briggs Posted June 5, 2011 Share Posted June 5, 2011 Hi, I made a script where you enter the marker and it sets your team, puts you in a police skin and gives you weapons. but you can keep going back and getting more weapons :\ I need a way so you can only go as get weapons once until you leave the team, when they are removed. This is what i got so far local Police = createTeam("Police", 0, 0, 255) -- this will create the team everytime the script starts local teamMarker = createMarker(1553.33, -1677.37, 15.382, 'cylinder', 1.0, 0, 0, 255, 150 ) function teamMarkerHit( hitElement, matchingDimension ) if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then setPlayerTeam ( hitElement, Police) setPlayerSkin( hitElement, 280) giveWeapon ( hitElement, 3, 1, true ) giveWeapon ( hitElement, 22, 148, true ) giveWeapon ( hitElement, 29, 64, true ) giveWeapon ( hitElement, 25, 10, true ) end end addEventHandler( "onMarkerHit", teamMarker , teamMarkerHit ) Any ideas? Thanks Link to comment
BriGhtx3 Posted June 5, 2011 Share Posted June 5, 2011 (edited) local Police = createTeam("Police", 0, 0, 255) local teamMarker = createMarker(1553.33, -1677.37, 15.382, 'cylinder', 1.0, 0, 0, 255, 150 ) function teamMarkerHit( hitElement, matchingDimension ) if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then if getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam (hitElement) == Police then outputChatBox("You are already in this team", thePlayer) else setPlayerTeam" class="kw6">setPlayerTeam ( hitElement, Police) setPlayerSkin( hitElement, 280) giveWeapon ( hitElement, 3, 1, true ) giveWeapon ( hitElement, 22, 148, true ) giveWeapon ( hitElement, 29, 64, true ) giveWeapon ( hitElement, 25, 10, true ) end end end addEventHandler( "onMarkerHit", teamMarker , teamMarkerHit ) Edited June 5, 2011 by Guest Link to comment
Dark Dragon Posted June 5, 2011 Share Posted June 5, 2011 you can check if the players team is the same as the team element saved on your "Police" variable local Police = createTeam("Police", 0, 0, 255) -- this will create the team everytime the --script starts local teamMarker = createMarker(1553.33, -1677.37, 15.382, 'cylinder', 1.0, 0, 0, 255, 150 ) function teamMarkerHit( hitElement, matchingDimension ) if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then if not getPlayerTeam(hitElement) == Police then setPlayerTeam ( hitElement, Police) setPlayerSkin( hitElement, 280) giveWeapon ( hitElement, 3, 1, true ) giveWeapon ( hitElement, 22, 148, true ) giveWeapon ( hitElement, 29, 64, true ) giveWeapon ( hitElement, 25, 10, true ) end end end addEventHandler( "onMarkerHit", teamMarker , teamMarkerHit ) Link to comment
will briggs Posted June 5, 2011 Author Share Posted June 5, 2011 Thanks guys for helping Link to comment
will briggs Posted June 6, 2011 Author Share Posted June 6, 2011 local Police = createTeam("Police", 0, 0, 255)local teamMarker = createMarker(1553.33, -1677.37, 15.382, 'cylinder', 1.0, 0, 0, 255, 150 ) function teamMarkerHit( hitElement, matchingDimension ) if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then if getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam (hitElement) == Police then outputChatBox("You are already in this team", thePlayer) else setPlayerTeam" class="kw6">setPlayerTeam" class="kw6">setPlayerTeam ( hitElement, Police) setPlayerSkin( hitElement, 280) giveWeapon ( hitElement, 3, 1, true ) giveWeapon ( hitElement, 22, 148, true ) giveWeapon ( hitElement, 29, 64, true ) giveWeapon ( hitElement, 25, 10, true ) end end end addEventHandler( "onMarkerHit", teamMarker , teamMarkerHit ) This doesnt seem to be working, i get an error on my server window saying : Then expected near kw2 Please help? Link to comment
Aibo Posted June 6, 2011 Share Posted June 6, 2011 this is a forum Lua highlighter bug with get/setPlayerTeam() functions. and dont just blindly copy everything, at least try to understand how things work. function teamMarkerHit( hitElement, matchingDimension ) if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then if getPlayerTeam (hitElement) == Police then outputChatBox("You are already in this team", hitElement) else setPlayerTeam ( hitElement, Police) setPlayerSkin( hitElement, 280) giveWeapon ( hitElement, 3, 1, true ) giveWeapon ( hitElement, 22, 148, true ) giveWeapon ( hitElement, 29, 64, true ) giveWeapon ( hitElement, 25, 10, true ) end end end addEventHandler( "onMarkerHit", teamMarker , teamMarkerHit ) also its not thePlayer, but hitElement on line 4. Link to comment
will briggs Posted June 6, 2011 Author Share Posted June 6, 2011 Right ok, sorry but im learning, I know other languages but it takes a while to sync in, I do understand it all... 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