5150 Posted January 31, 2016 Posted January 31, 2016 hey guys, i need this script changed a little bit.. i edited it so it only attacks "army forces", but times change blah blah, and i need it so it attacks ALL players in range EXCEPT players in the team #000000Psycho Ma#990000ns Gang. color codes need to be included. could anyone help? addEvent("sniperTakeDecision", true) addCommandHandler("PMGsnipernpc", function(thePlayer, command) local x, y, z = getElementPosition(thePlayer) local int = getElementInterior(thePlayer) local ped = createSniperPed(x, y, z) setElementInterior(ped, int) end ) setTimer( function() for i, peds in ipairs(getElementsByType("ped")) do if getElementData(peds, "type") == "ped.sniper.npc" and getElementHealth(peds) > 0 then setPedWeaponSlot(peds, 7) giveWeapon(peds, 38, 99999, true) end end end , 50, 0) function createSniperPed(x, y, z) local ped = createPed(43, x, y, z) setTimer( function() if isElement(ped) then giveWeapon(ped, 38, 99999, true) setPedWeaponSlot(ped, 7) setElementData(ped, "type", "ped.sniper.npc") setElementFrozen(ped, true) setElementHealth(ped, 100) end end , 5000, 1) return ped end addEventHandler("sniperTakeDecision", getRootElement(), function(sniperPedID, aimPlayer) if getPlayerTeam(aimPlayer) and getTeamName(getPlayerTeam(aimPlayer)) == "Army Forces" then setElementData(sniperPedID, "target", aimPlayer) triggerClientEvent("sniperTakeDecisionClient", getRootElement(), sniperPedID, aimPlayer) end end ) thanks
ALw7sH Posted January 31, 2016 Posted January 31, 2016 Change line 38 to if getPlayerTeam(aimPlayer) and getTeamName(getPlayerTeam(aimPlayer)) ~= "#000000Psycho Ma#990000ns Gang" then
5150 Posted January 31, 2016 Author Posted January 31, 2016 that will make it so it only attacks my gang... i want it so it attacks everyone EXCEPT for my gang
ALw7sH Posted January 31, 2016 Posted January 31, 2016 that will make it so it only attacks my gang... i want it so it attacks everyone EXCEPT for my gang That's false ~= means not equal to Yes it wasn't gonna work like what it supposed to but not as you said change it to if (not getPlayerTeam(aimPlayer)) or (getPlayerTeam(aimPlayer) and getTeamName(getPlayerTeam(aimPlayer)) ~= "#000000Psycho Ma#990000ns Gang") then
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