Shayan816 Posted June 21, 2017 Share Posted June 21, 2017 (edited) I used this code for Friendlyfire, so players cant kill other players.. local pTeam = createTeam("Players",255,255,0) setTeamFriendlyFire(pTeam,false) function sFF() setPlayerTeam( source, pTeam ) end addEventHandler("onPlayerJoin", getRootElement(), sFF) But i dont want friendlyfire for entire map. i want to set Las Venturas Area as PVP.. so is there anyway i can set friendlyfire on only in Las Venturas ? i tried this function createTeamsOnStart () teamPVP = createTeam ( "PVP", 0, 255, 255 ) setTeamFriendlyFire ( teamPVP, false ) end addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart) local randomSpawnTable = { { 258, -2018, 22.5 }, { 1674, 2181, 22.8 }, { 2096, 1286, 10.8 }, { 1933, 1344, 10.8 }, { 2106, 1407, 24.2 }, { 1888, 1469, 11.4 } } function randomSpawn( thePlayer, randomSpawnTable ) local random = math.random( 1, #randomSpawnTable ) spawnPlayer( thePlayer, randomSpawnTable[random][1], randomSpawnTable[random][2], randomSpawnTable[random][3] randomSpawnTable[random][4] randomSpawnTable[random][5] randomSpawnTable[random][6] ) end addCommandHandler("PVP", randomSpawn) but its not working.. i have to move players to PVP Team Manually from Admin panel then its working.. i want when player do /pvp he move to PVP Team and spawn in location. Any Help Please ? Edited June 21, 2017 by Shayan816 Link to comment
Shayan816 Posted June 21, 2017 Author Share Posted June 21, 2017 Where can you show me please ?? im Newbie.. anyone help please ? Link to comment
pa3ck Posted June 21, 2017 Share Posted June 21, 2017 (edited) If you want to disable friendly fire for specific players, you will need to approach it from a different direction, since if you disable with the nativa MTA function, it will be disabled for everyone else in the team. Try to use the event onClientPlayerDamage with cancelEvent, get the player's team + the zone name using getZoneName which can return Los Santos, Las Venturas, San Fierro if you pass the "cities only" argument as true. Edited June 21, 2017 by pa3ck Link to comment
Shayan816 Posted June 21, 2017 Author Share Posted June 21, 2017 i want to disable friendly fire for all teams/players when they go in las venturas.. or can we just disable Friendly Fire in Another Dimension ? so i could put a teleport to Another Dimension.. i have teleport to a las venturas in Dimension 207, so can we just disable friendly fire for dimension 207 ? Link to comment
AE. Posted June 22, 2017 Share Posted June 22, 2017 (edited) 26 minutes ago, Shayan816 said: Any Help Please ? pa3ck helped you Edited June 22, 2017 by 3laa33 Link to comment
Shayan816 Posted June 28, 2017 Author Share Posted June 28, 2017 im trying to disable FriendlyFire for certain zone, so players can kill each other, can anyone help me ? server Pvparea = createColRectangle ( 909, 525, 2100, 2600 ) function Pvpzone ( thePlayer ) setElementPosition ( thePlayer, 2032.6420898438, 1429.3059082031, 10.8203125 ) outputChatBox ( getPlayerName ( thePlayer ) .. " has Entered in PVP zone!" ) end addCommandHandler ( "pvp", Pvpzone ) client addEventHandler( 'onClientPlayerDamage', localPlayer, function( ) if getElementData( localPlayer, 'damage' ) == 'yes' then cancelEvent( ) end end ) can anyone help me ? and im using this friendlyfire script local pTeam = createTeam("Players",255,255,0) setTeamFriendlyFire(pTeam,false) function sFF() setPlayerTeam( source, pTeam ) end addEventHandler("onPlayerJoin", getRootElement(), sFF) Link to comment
pa3ck Posted June 28, 2017 Share Posted June 28, 2017 (edited) You still don't understand what I said. If you use setTeamFriendlyFire to false, it will be disabled for every single player, no matter where they are or what color their eyes are.. That is why you should remove the player(s) from the team when they use the pvp command and that way the friendlyFire will be disabled. By the way, you have so many things going on, elementData, team, col... not sure what you essentially want. Pvparea = createColRectangle ( 909, 525, 2100, 2600 ) function Pvpzone ( thePlayer ) setElementPosition ( thePlayer, 2032.6420898438, 1429.3059082031, 10.8203125 ) outputChatBox ( getPlayerName ( thePlayer ) .. " has Entered in PVP zone!" ) setPlayerTeam( thePlayer ) end addCommandHandler ( "pvp", Pvpzone ) function Pvezone ( thePlayer ) setElementPosition ( thePlayer, 2032.6420898438, 1429.3059082031, 10.8203125 ) -- change PVE position outputChatBox ( getPlayerName ( thePlayer ) .. " has Entered in PVE zone!" ) setPlayerTeam( thePlayer, getTeamFromName("Players") ) end addCommandHandler ( "pve", Pvezone ) Edited June 28, 2017 by pa3ck Link to comment
Shayan816 Posted June 28, 2017 Author Share Posted June 28, 2017 (edited) ok i understood, i made this local pvpTeam = createTeam("PVP") setTeamFriendlyFire(pvpTeam,true) Pvpzone = createColRectangle ( 909, 525, 2100, 2600 ) function Pvpzone ( thePlayer ) setElementPosition ( thePlayer, 2032.6420898438, 1429.3059082031, 10.8203125 ) outputChatBox ( getPlayerName ( thePlayer ) .. " has Entered in PVP zone!" ) setPlayerTeam ( thePlayer, pvpTeam ) end addCommandHandler ( "pvp", Pvpzone ) so when players do /pvp they will be moved to PVP Team and they can kill each other, but problem is, when players go to pvp and die, they staying in PVP Team, but i want when players die in PVP team, they should be moved to Players Team back.. so i added onPlayerwasted on Friendlyfire Script.. local pTeam = createTeam("Players",255,255,0) setTeamFriendlyFire(pTeam,false) function sFF() setPlayerTeam( source, pTeam ) end addEventHandler("onPlayerJoin", getRootElement(), sFF) function die() setPlayerTeam( source, pTeam ) end addEventHandler( "onPlayerWasted", getRootElement(), die) But still Players are stuck in PVP Team, when they do /pvp i want to move them to Players Team when they get die in PVp Edited June 28, 2017 by Shayan816 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