Jump to content

help


Recommended Posts

Hey, i'm using tactics gamemode and i wanted to hide the bilps of the team 'tactics' to the other team

what should i do?

use this function

setElementVisibleTo () 

Thanks walid

and how do destroy the blip of the team tactics. I mean it should not be visible to anyone.

Link to comment

not working

    addEventHandler ( "onResourceStart", resourceRoot, 
        function ( ) 
            for _, player in ipairs ( getElementsByType ( "player" ) ) do 
                local attached = getAttachedElements ( player ) 
                if ( attached ) then 
                    for _, element in ipairs ( attached ) do if ( getTeamName ( source ) == "tactics" ) and 
         if ( getElementType ( element ) == "blip" ) then 
                            destroyElement ( element ) 
                        end 
                    end 
                end 
            end 
       end 
    ) 
     

Link to comment

and also this isn't working

trying to make tactis team fire proof

addEventHandler ( "onClientPlayerDamage", localPlayer,  
function() 
    if ( weapon == 37 )  and ( getTeamName (source) == "tactics" ) then 
        cancelEvent() 
        
    end 
end) 

sorry i'm not that good at lua, just trying make script from wiki and forum examples.

Link to comment

it must be like this

addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        for _, player in ipairs ( getElementsByType ( "player" ) ) do 
            local attached = getAttachedElements (player) 
                if ( attached ) then 
                local playerTeam = getPlayerTeam(player)  
                if (playerTeam) then 
                    if ( getTeamName (playerTeam) == "tactics" ) then 
                        for _, element in ipairs (attached) do  
                            if (getElementType (element) == "blip" ) then 
                            destroyElement ( element ) 
                        end 
                    end 
                end 
            end 
       end 
    end  
end) 

Link to comment
and also this isn't working

trying to make tactis team fire proof

addEventHandler ( "onClientPlayerDamage", localPlayer,  
function() 
    if ( weapon == 37 )  and ( getTeamName (source) == "tactics" ) then 
        cancelEvent() 
        
    end 
end) 

sorry i'm not that good at lua, just trying make script from wiki and forum examples.

addEventHandler ( "onClientPlayerDamage", root,

function()

if getTeamName (source) == "tactics" then

cancelEvent()

end

end)

Link to comment

Try this one

addEventHandler ( "onClientPlayerDamage", localPlayer, 
function() 
    local playerTeam = getPlayerTeam(source) 
    if playerTeam and  
        if ( weapon == 37 )  and ( getTeamName(playerTeam) == "tactics" ) then 
        cancelEvent() 
       end 
    end 
end  
) 

Link to comment
Try this one
addEventHandler ( "onClientPlayerDamage", localPlayer, 
function() 
    local playerTeam = getPlayerTeam(source) 
    if playerTeam and  
        if ( weapon == 37 )  and ( getTeamName(playerTeam) == "tactics" ) then 
        cancelEvent() 
       end 
    end 
end  
) 

Tysm i'll try this.

Link to comment

Not working

Error: unexpected symbol near 'if'

line 5

addEventHandler ( "onClientPlayerDamage", localPlayer, 
function() 
    local playerTeam = getPlayerTeam(source) 
    if playerTeam and  
        if ( weapon == 37 )  and ( getTeamName(playerTeam) == "tactics" ) then 
        cancelEvent() 
       end 
    end 
end  
) 

Link to comment

You must add the argument weapon.

addEventHandler ( "onClientPlayerDamage", localPlayer, 
function( attacker, weapon, bodypart ) 
    local playerTeam = getPlayerTeam(source) 
    if playerTeam and 
        if ( weapon == 37 )  and ( getTeamName(playerTeam) == "tactics" ) then 
        cancelEvent() 
       end 
    end 
end 
) 

Link to comment
Not working

Error: unexpected symbol near 'if'

line 5

addEventHandler ( "onClientPlayerDamage", localPlayer, 
function() 
    local playerTeam = getPlayerTeam(source) 
    if playerTeam and  
        if ( weapon == 37 )  and ( getTeamName(playerTeam) == "tactics" ) then 
        cancelEvent() 
       end 
    end 
end  
) 

  
addEventHandler ( "onClientPlayerDamage", localPlayer, 
function( attacker, weapon, bodypart ) 
    local playerTeam = getPlayerTeam(source) 
    local attackerTeam = getPlayerTeam(attacker) 
    if playerTeam and attackerTeam 
        if (getTeamName(attackerTeam) == "tactics") and ( getTeamName(playerTeam) == "tactics" ) then 
        cancelEvent() 
       end 
    end 
end 
) 

Link to comment

it must be like this :

addEventHandler ( "onClientPlayerDamage", localPlayer, 
    function( attacker, weapon, bodypart ) 
        if attacker and isElement(attacker) and getElementType(attcker) == "player" and attacker ~= source then   
            if (getTeamName(getPlayerTeam(attacker)) == "tactics") and (getTeamName(getPlayerTeam(source)) == "tactics") then  
            cancelEvent() 
       end 
    end 
end  
) 

Edit

Link to comment
it must be like this :
addEventHandler ( "onClientPlayerDamage", localPlayer, 
    function( attacker, weapon, bodypart ) 
        if attacker and isElement(attacker) and getElementType(attcker) == "player" and attacker ~= source then   
            if (getTeamName(getPlayerTeam(attacker)) == "tactics") and (getTeamName(getPlayerTeam(source)) == "tactics") then  
            cancelEvent() 
       end 
    end 
end  
) 

Edit

Agreed

Link to comment
That's not what i asked, I'm trying make team tactics don't get damage from fire.

Id 37

i already gave it to you

addEventHandler ( "onClientPlayerDamage", localPlayer, 
function( attacker, weapon, bodypart ) 
    local playerTeam = getPlayerTeam(source) 
    if playerTeam and 
        if ( weapon == 37 )  and ( getTeamName(playerTeam) == "tactics" ) then 
        cancelEvent() 
       end 
    end 
end 
) 

untested

you must read this about death reason : Here

When a player was shot by a weapon, the respective weapon ID is the death reason ID

Link to comment
That's not what i asked, I'm trying make team tactics don't get damage from fire.

Id 37

i already gave it to you

addEventHandler ( "onClientPlayerDamage", localPlayer, 
function( attacker, weapon, bodypart ) 
    local playerTeam = getPlayerTeam(source) 
    if playerTeam and 
        if ( weapon == 37 )  and ( getTeamName(playerTeam) == "tactics" ) then 
        cancelEvent() 
       end 
    end 
end 
) 

untested

you must read this about death reason : Here

When a player was shot by a weapon, the respective weapon ID is the death reason ID

thanks you soo much, There was one Error anyway i've fixed it

and one more question

I want players to die in 1 second with every weapon expect explostion

addEventHandler("onPlayerDamage", getRootElement() , 
function (attacker, weapon, bodypart, loss) 
    killPed(source,attacker,weapon) 
  if weapon == 51  then 
    cancelEvent() 
end 
end 
) 
   

not working and no error

wanted to cancle the event from id 51, they die in 1 second even with explstion.

Link to comment

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...