Jump to content

Mta friendly fire help


B7raani

Recommended Posts

Posted

hey guys i need help in friendly fire please

this is the team selection code imade the friendly fire true but its not working

  
    "Teams الأفرقة" > 
     
        "Rebel" friendlyfire="true" > 
            "يجب أن نحصل على حقوقنا وأن لا ندع أي شيء يقف في طريقنا" /> 
            "255" green="0" blue="0" /> 
            "ثائر" id="1" > 
                "1475.9217529297" y="-2240.7573488281" z="13.3828125" rot="90" /> 
            
            "وفاقي" id="7" > 
                "1475.9217529297" y="-2240.7573488281" z="13.3828125" rot="90" /> 
            
            "إئتلافي" id="2" > 
                "1475.9217529297" y="-2240.7573488281" z="13.3828125" rot="90" /> 
                        
            "قطيفي" id="14" > 
                "2103.2326660156" y="1013.2601318359" z="10.8203125" rot="90" /> 
            
            "18" ammo="50" /> 
            "5" ammo="100" /> 
            "41" ammo="100" /> 
            "43" ammo="100" /> 
            
                "1475.9217529297" y="-2240.7573488281" z="13.3828125" /> 
                "1475.9217529297" y="-2240.7573488281" z="13.3828125" /> 
            
        

Posted

Maybe Try This

    "Teams الأفرقة" /> 
    
        "Rebel" friendlyfire="true" /> 
            "يجب أن نحصل على حقوقنا وأن لا ندع أي شيء يقف في طريقنا" /> 
            "255" green="0" blue="0" /> 
            "ثائر" id="1" > 
                "1475.9217529297" y="-2240.7573488281" z="13.3828125" rot="90" /> 
            
            "وفاقي" id="7" > 
                "1475.9217529297" y="-2240.7573488281" z="13.3828125" rot="90" /> 
            
            "إئتلافي" id="2" > 
                "1475.9217529297" y="-2240.7573488281" z="13.3828125" rot="90" /> 
                        
            "قطيفي" id="14" > 
                "2103.2326660156" y="1013.2601318359" z="10.8203125" rot="90" /> 
            
            "18" ammo="50" /> 
            "5" ammo="100" /> 
            "41" ammo="100" /> 
            "43" ammo="100" /> 
            
                "1475.9217529297" y="-2240.7573488281" z="13.3828125" /> 
                "1475.9217529297" y="-2240.7573488281" z="13.3828125" /> 
            
        

you forgot />

"Teams الأفرقة" > 
    
        "Rebel" friendlyfire="true" > 

that should be

"Teams الأفرقة" /> 
    
        "Rebel" friendlyfire="true" /> 

Posted
"true" means they can kill each other, "false" means they can't.

should be:

friendlyfire="false" 

Maybe he want they can kill each other :P

EDIT: and he said when he add / script does'nt work ?

Posted

i did but its not working please help

Perfect no i want to make same team cant kill each other because its pissing me off

please help me please

Posted

Seems like the attribute "friendlyfire" is not being used at all.

Replace all the content of: "s_main.lua" with this:

g_root = getRootElement( ); 
classGroups = { }; 
  
  
addEvent( "spawn_clientRequestSpawn", true ); 
addEventHandler( "spawn_clientRequestSpawn", g_root, 
    function( categoryIndex, classIndex, skinIndex, password ) 
        if skinIndex then 
            local class = classGroups[ categoryIndex ].classes[ classIndex ]; 
            if class.password then 
                if not password or password == "" then 
                    triggerClientEvent( client, "spawn_requestPassword", root, class.name ); 
                    return; 
                elseif password ~= class.password then 
                    outputChatBox( "The password you typed in is incorrect! Try again or cancel to choose different class.", client, 200, 50, 50 ); 
                    triggerClientEvent( client, "spawn_requestPassword", root, class.name ); 
                    return; 
                end 
            end 
            local skin = class.skinMngr.skins[ skinIndex ]; 
            local spawn = true; 
            local spawned; 
            --[[if not classGroups[ cetegoryIndex ].owner then -- if there is NO owner of the clan/gang spawn player 
                spawn = true; 
            else -- if there IS owner of the clan/gang then check if he's member of the clan/gang 
                
            end]] 
            
            if spawn then 
                if not class.team then 
                    class.team = createTeam( class.name, class.color.red, class.color.green, class.color.blue ); 
                    setTeamFriendlyFire ( class.team, false ) 
                end 
                
                local plrTeam = getPlayerTeam( client ); 
                if ( ( plrTeam ) and ( plrTeam ~= class.team ) and ( countPlayersInTeam( plrTeam ) == 1 ) ) then 
                    destroyElement( plrTeam ); 
                end 
                
                spawned = spawnPlayer( 
                    client, 
                    skin.spawnLoc.x, 
                    skin.spawnLoc.y, 
                    skin.spawnLoc.z, 
                    skin.spawnLoc.rot, 
                    skin.modelId, 
                    0, 0, 
                    class.team 
                ); 
            end 
            
            if spawned then 
                setElementData( client, "team", class.name ) 
                setElementData( client, "skin", skin.name ) 
                fadeCamera( client, true ); 
                setCameraTarget( client, client ); 
                setTimer( setCameraTarget, 200, 1, client, client ); 
                
                triggerClientEvent( client, "spawn_SpawnedSuccessfully", client ); 
                
                --setPlayerMoney( client, 500 ); 
                for _, weapon in ipairs( class.weaponMngr.weapons ) do 
                    giveWeapon( client, weapon.id, weapon.ammo, false ); 
                end 
                createBlipAttachedTo( client, 0, 2, class.color.red, class.color.green, class.color.blue ) 
            else 
                triggerClientEvent( client, "spawn_FailedToSpawn", client ); 
                if countPlayersInTeam( class.team ) == 0 then 
                    destroyElement( class.team ); 
                    class.team = nil; 
                end 
            end 
        end 
    end 
); 
  
addEvent( "spawn_receivePassword", true ); 
addEventHandler( "spawn_receivePassword", g_root, 
    function( ) 
    
    end 
); 
  
  
addEventHandler( "onPlayerSpawn", g_root, 
    function ( ) 
    
    end 
); 
  
addEventHandler( "onPlayerWasted", g_root, 
    function( ) 
        fadeCamera( source, false, 4 ); 
        setTimer( requestMenu, 5000, 1, source ); 
        deleteAllPlayerBlips( source ) 
    end 
); 
  
function requestMenu( player ) 
    callClientFunc( player, "showSpawnMenu", true, true ); 
    callClientFunc( player, "classSelected" ); 
end 
  
  
addCommandHandler( "kill", 
    function( plr ) 
        killPed( plr ); 
    end 
) 
  
  
  
function preloadClassesInfo( ) 
    local groups = getElementsByType( "category" ); 
    for _, group in ipairs( groups ) do 
        table.insert( classGroups, Group:New( group ) ); 
    end 
end 
addEventHandler( "onResourceStart", getResourceRootElement(), preloadClassesInfo ) 
  
  
function deleteAllPlayerBlips(player) 
    local elements = getAttachedElements(player) 
    if (elements) then 
        for i, element in ipairs(elements) do 
            if (getElementType(element) == "blip") then 
                destroyElement(element) 
            end 
        end 
    end 
    print( "number of players in team: " .. tostring( countPlayersInTeam( getPlayerTeam( player ) ) ) ); 
end 
  
addEventHandler( "onPlayerQuit", g_root, function() deleteAllPlayerBlips(source) end ); 
  
  
------------------------------------------------------------------------------------------ 
------------------------------------------------------------------------------------------ 
function callClientFunc( player, funcName, ... ) 
    if #{ ... } ~= 0 then 
        triggerClientEvent( player, "_clientCallFunction", root, funcName, ... ) 
    else 
        triggerClientEvent( player, "_clientCallFunction", root, funcName ) 
    end 
end 
  
addEvent( "_serverCallFunction", true ) 
addEventHandler( "_serverCallFunction", root, 
    function( funcName, ... ) 
        _G[ funcName ](...) 
    end 
) 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...