will briggs Posted June 5, 2011 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 Founder of SAUR - Founder/Owner of ARC RPG
BriGhtx3 Posted June 5, 2011 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 Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
Dark Dragon Posted June 5, 2011 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 ) Loads of fun for free! Also a lot of fun for free!
will briggs Posted June 5, 2011 Author Posted June 5, 2011 Thanks guys for helping Founder of SAUR - Founder/Owner of ARC RPG
will briggs Posted June 6, 2011 Author 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? Founder of SAUR - Founder/Owner of ARC RPG
Aibo Posted June 6, 2011 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. ?
will briggs Posted June 6, 2011 Author 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... Founder of SAUR - Founder/Owner of ARC RPG
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