Castillo Posted September 17, 2010 Posted September 17, 2010 hey, i want to make when a player is on same team and he tryes to kill his teamate the health won't go down, i've done something but it won't work. function playerDamage ( attacker, weapon, bodypart, loss ) if attacker then if getElementType ( attacker ) == "vehicle" then cancelEvent() else local team = getPlayerTeam(source) local teamname = getTeamName(team) local team2 = getPlayerTeam(attacker) local teamname2 = getTeamName(team2) if teamname == teamname2 then --triggerClientEvent(source,"enableGodMode",source) cancelEvent() end end end end addEventHandler ( "onPlayerDamage", getRootElement(), playerDamage) thanks in advance. addEvent("enableGodMode", true) addEventHandler ("enableGodMode", getRootElement(), function() addEventHandler ("onClientPlayerDamage", getRootElement(), cancelEventEvent) end) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
dzek (varez) Posted September 17, 2010 Posted September 17, 2010 https://wiki.multitheftauto.com/wiki/SetTeamFriendlyFire ? Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
Castillo Posted September 17, 2010 Author Posted September 17, 2010 https://wiki.multitheftauto.com/wiki/SetTeamFriendlyFire ? that was my old idea but dunno why it won't work O_o code was: addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function () local allTeams = getElementsByType ( "team" ) for index, theTeam in ipairs(allTeams) do if ( getTeamFriendlyFire ( theTeam ) == true ) then setTeamFriendlyFire ( theTeam, false ) end end end) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
dzek (varez) Posted September 17, 2010 Posted September 17, 2010 hmm, what i don't like in games is that, that some of them treats friendly fire as when it's OFF - you can't kill your team mate, and some when it's ON. Try to reverse it, and set to true. And remove that "if" - you think it's really needed? Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
Castillo Posted September 17, 2010 Author Posted September 17, 2010 hmm, what i don't like in games is that, that some of them treats friendly fire as when it's OFF - you can't kill your team mate, and some when it's ON.Try to reverse it, and set to true. And remove that "if" - you think it's really needed? Ok, when i will try when i get someone else. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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