top sniper Posted March 10, 2012 Share Posted March 10, 2012 i toke this code from mtasa wiki function setFriendlyFireOn ( ) -- For each team, for index, theTeam in ipairs">ipairs ( getElementsByType("team") ) do -- if friendly fire is off, if ( getTeamFriendlyFire ( theTeam ) == false ) then -- switch it on. setTeamFriendlyFire ( theTeam, true ) end end end -- Add console command 'setFF' addCommandHandler ( "setFF", setFriendlyFireOn ) but it didn't work Link to comment
Kenix Posted March 10, 2012 Share Posted March 10, 2012 function setFriendlyFireOn ( ) -- For each team, for index, theTeam in ipairs ( getElementsByType("team") ) do -- if friendly fire is off, if not getTeamFriendlyFire ( theTeam ) then -- switch it on. setTeamFriendlyFire ( theTeam, true ) end end end -- Add console command 'setFF' addCommandHandler ( "setFF", setFriendlyFireOn ) Show meta.xml too. for index, theTeam in ipairs">ipairs ( getElementsByType("team") ) do Forum syntax bug Link to comment
drk Posted March 10, 2012 Share Posted March 10, 2012 (edited) addCommandHandler ( 'setFF', function ( ) for i, team in ipairs">ipairs ( getElementsByType ( 'team' ) ) do if ( getTeamFriendlyFire ( team ) == false ) then setTeamFriendlyFire ( team, true ) end end end ) Be sure that your script is server side in meta.xml. Edited March 10, 2012 by Guest Link to comment
X-SHADOW Posted March 10, 2012 Share Posted March 10, 2012 addCommandHandler ( 'setFF', function ( ) for i, team in ipairs">ipairs">ipairs ( getElementsByType ( 'team' ) ) do if ( getTeamFriendlyFire ( team ) == false ) then setTeamFriendlyFire ( team, true ) end end end ) Be sure that your script is server side in meta.xml. for i, team in ipairs">ipairs ( getElementsByType ( 'team' ) ) do synatx error Link to comment
X-SHADOW Posted March 10, 2012 Share Posted March 10, 2012 yes we should wait for administration to fix it lol Link to comment
top sniper Posted March 10, 2012 Author Share Posted March 10, 2012 addEvent("spawn1",true) addEventHandler("spawn1",root, function() spawnPlayer ( source, 252, 1861, 9, 1, 0, 0, t) local redteam = getTeamFromName ( "F.B.I" ) if ( redteam ) then -- If it was found (not false) setPlayerTeam ( source, redteam ) setElementHealth ( source, 100 ) setPedArmor ( source, 20 ) giveWeapon ( source , 31,600 ) giveWeapon ( source , 25,500 ) giveWeapon ( source , 46 ) giveWeapon ( source , 16,5 ) setTeamFriendlyFire ( redteam, true ) end end ) even this not working Link to comment
drk Posted March 10, 2012 Share Posted March 10, 2012 addEvent("spawn1",true) addEventHandler("spawn1",root, function() spawnPlayer ( source, 252, 1861, 9, 1, 0, 0, t) local redteam = getTeamFromName ( "F.B.I" ) if ( redteam ) then setPlayerTeam ( source, redteam ) setElementHealth ( source, 100 ) setPedArmor ( source, 20 ) giveWeapon ( source , 31,600 ) giveWeapon ( source , 25,500 ) giveWeapon ( source , 46 ) giveWeapon ( source , 16,5 ) setTeamFriendlyFire ( redteam, true ) end end ) Where spawn1 event is called? Link to comment
top sniper Posted March 10, 2012 Author Share Posted March 10, 2012 addEvent("spawn1",true) addEventHandler("spawn1",root, function() spawnPlayer ( source, 252, 1861, 9, 1, 0, 0, t) local redteam = getTeamFromName ( "F.B.I" ) if ( redteam ) then setPlayerTeam ( source, redteam ) setElementHealth ( source, 100 ) setPedArmor ( source, 20 ) giveWeapon ( source , 31,600 ) giveWeapon ( source , 25,500 ) giveWeapon ( source , 46 ) giveWeapon ( source , 16,5 ) setTeamFriendlyFire ( redteam, true ) end end ) Where spawn1 event is called? I did not understand what you mean Link to comment
drk Posted March 10, 2012 Share Posted March 10, 2012 Event spawn1 isn't ever called. Link to comment
top sniper Posted March 10, 2012 Author Share Posted March 10, 2012 Event spawn1 isn't ever called. triggerServerEvent("spawn1",localPlayer) Link to comment
drk Posted March 10, 2012 Share Posted March 10, 2012 Show full code, client and server-side. Link to comment
top sniper Posted March 10, 2012 Author Share Posted March 10, 2012 the problem was i should change true to false to set it on !! Link to comment
TAPL Posted March 10, 2012 Share Posted March 10, 2012 spawnPlayer ( source, 252, 1861, 9, 1, 0, 0, t) t is not defined. 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