yesyesok Posted May 11, 2015 Share Posted May 11, 2015 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? Link to comment
Walid Posted May 11, 2015 Share Posted May 11, 2015 Hey, i'm using tactics gamemode and i wanted to hide the bilps of the team 'tactics' to the other teamwhat should i do? use this function setElementVisibleTo () Link to comment
yesyesok Posted May 11, 2015 Author Share Posted May 11, 2015 Hey, i'm using tactics gamemode and i wanted to hide the bilps of the team 'tactics' to the other teamwhat 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
Walid Posted May 11, 2015 Share Posted May 11, 2015 Thanks walid and how do destroy the blip of the team tactics. I mean it should not be visible to anyone. try to use destroyElement() Link to comment
yesyesok Posted May 11, 2015 Author Share Posted May 11, 2015 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
yesyesok Posted May 11, 2015 Author Share Posted May 11, 2015 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
Walid Posted May 11, 2015 Share Posted May 11, 2015 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
yesyesok Posted May 11, 2015 Author Share Posted May 11, 2015 Tysm Walid What about my second question? What's wrong in the script? Link to comment
Walid Posted May 11, 2015 Share Posted May 11, 2015 Tysm Walid What about my second question? What's wrong in the script? np , about the second question sorry i don't undrestand what you want exactly Link to comment
yesyesok Posted May 11, 2015 Author Share Posted May 11, 2015 Tysm Walid What about my second question? What's wrong in the script? np , about the second question sorry i don't undrestand what you want exactly I don't want the team tactics get damage from fire. Link to comment
jingzhi Posted May 11, 2015 Share Posted May 11, 2015 and also this isn't workingtrying 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
Walid Posted May 11, 2015 Share Posted May 11, 2015 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
yesyesok Posted May 11, 2015 Author Share Posted May 11, 2015 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
yesyesok Posted May 11, 2015 Author Share Posted May 11, 2015 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
Walid Posted May 11, 2015 Share Posted May 11, 2015 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
jingzhi Posted May 11, 2015 Share Posted May 11, 2015 Not workingError: 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
Walid Posted May 11, 2015 Share Posted May 11, 2015 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
jingzhi Posted May 11, 2015 Share Posted May 11, 2015 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
yesyesok Posted May 11, 2015 Author Share Posted May 11, 2015 That's not what i asked, I'm trying make team tactics don't get damage from fire. Id 37 Link to comment
Walid Posted May 11, 2015 Share Posted May 11, 2015 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
yesyesok Posted May 11, 2015 Author Share Posted May 11, 2015 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
ALw7sH Posted May 11, 2015 Share Posted May 11, 2015 onPlayerDamage can't be canceled instead on cancling onPlayerDamage you have to cancle onClientPlayerDamage Link to comment
yesyesok Posted May 12, 2015 Author Share Posted May 12, 2015 onPlayerDamage can't be canceledinstead on cancling onPlayerDamage you have to cancle onClientPlayerDamage Killped is server side function. what should i do? Link to comment
Walid Posted May 12, 2015 Share Posted May 12, 2015 onPlayerDamage can't be canceledinstead on cancling onPlayerDamage you have to cancle onClientPlayerDamage Killped is server side function. what should i do? use triggerServerEvent() 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