lolman Posted June 27, 2015 Share Posted June 27, 2015 Hello, I got a problem with my code... I want that if you are in the team Criminal, and if you aim at a player which is in the team "Police" the criminal guy which aimed will get stars... But in this code, if you are in the police team and you aim, you also get stars. and as a crim you get stars too. function playerTargetCheck ( thePlayer ) local target for i, thePlayer in ipairs ( getElementsByType("player") ) do target = getPedTarget ( thePlayer ) if ( target ) then if ( getElementType ( target ) == "player" ) and thePlayer then setPlayerWantedLevel(thePlayer, 6) elseif target == thePlayer then return false end end end end setTimer ( playerTargetCheck, 1000, 0 ) Link to comment
KariiiM Posted June 27, 2015 Share Posted June 27, 2015 Try this by putting it in your Police part local team = getPlayerTeam() local theTeamName = getTeamName(team) if ( theTeamName == "Police" ) and (target) and getPlayerWantedLevel ( source ) > 0 ) then return end Link to comment
Walid Posted June 27, 2015 Share Posted June 27, 2015 Try this using onPlayerTarget event. function onPlayerTarget (element) local teamNameC = getTeamName(getPlayerTeam(source)) if element and getElementType (element) == "player" then local theTeamName = getTeamName(getPlayerTeam(element)) if (theTeamName == "Police") then if (teamNameC ~= "Criminal") then return end setPlayerWantedLevel(source, 6) end end end addEventHandler ( "onPlayerTarget", getRootElement(), onPlayerTarget ) Link to comment
lolman Posted June 28, 2015 Author Share Posted June 28, 2015 Your code shows the error : 42 & 44 : bad argument @ getTeamName, expected team at argument 1, got boolean Link to comment
KariiiM Posted June 28, 2015 Share Posted June 28, 2015 Which one? and its not an full code Put your code and we'll helps we have no idea about your Police and Criminal team names. Link to comment
Walid Posted June 28, 2015 Share Posted June 28, 2015 Which one? and its not an full codePut your code and we'll helps we have no idea about your Police and Criminal team names. here's your mistake 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