Parazitas Posted January 13, 2016 Share Posted January 13, 2016 Hello guys! i need edit one script but.. im a bad scripter.. I need make this: cuz this pvp toogle automatically start working then player join the sevise team delete all on/off functions and chatbox messages. Im sorry for my bad English.. timepvp=15000 pvpkey="3" vehprotect=true keyunbind=false pvptime=timepvp/1000 addEventHandler ("onClientPlayerDamage",getRootElement(),function(attacker,weapon,bodypart) if attacker then if getElementData (attacker,"antidm") ==true or getElementData(source,"antidm")==true then cancelEvent() end end end) addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()),function() bindKey (pvpkey,"down",function() if not getElementData(localPlayer,"antidm") then if getElementData (localPlayer,"waiting") then outputChatBox ("PvP mode is already being disabled, just wait!",255,0,0) return end outputChatBox ("Disabling PvP mode, wait#ff0000 "..pvptime.."#ffffff seconds!",255,255,255,true) setElementData (localPlayer,"waiting",true) setTimer (function() if keyunbind then toggleControl ("fire",false) end setElementData (localPlayer,"waiting",false) setElementData(localPlayer,"antidm",true) outputChatBox ("PvP mode successfully disabled!",0,255,0) end,timepvp,1) else toggleControl ("fire",true) setElementData (localPlayer,"antidm",false) outputChatBox ("PvP mode enabled!",0,100,255) end end) end) addEventHandler ("onClientVehicleDamage",getRootElement(),function(theAttacker,theWeapon) if vehprotect then if theAttacker then if getVehicleOccupant (source,0) then if getElementData (theAttacker,"antidm") or getElementData (getVehicleOccupant(source,0),"antidm") then cancelEvent() end end end end end) Link to comment
aka Blue Posted January 13, 2016 Share Posted January 13, 2016 I don't understand. ¿You want an elementData that allows you be inmortal o something like that? Link to comment
Parazitas Posted January 13, 2016 Author Share Posted January 13, 2016 Yes. I need script when players in team [service] they be inmortal and can't kill others players to. Link to comment
aka Blue Posted January 13, 2016 Share Posted January 13, 2016 Well, this should work. Try it: function isPlayerInTeam(player, team) assert(isElement(player) and getElementType(player) == "player", "Bad argument 1 @ isPlayerInTeam [player expected, got " .. tostring(player) .. "]") assert((not team) or type(team) == "string" or (isElement(team) and getElementType(team) == "team"), "Bad argument 2 @ isPlayerInTeam [nil/string/team expected, got " .. tostring(team) .. "]") return getPlayerTeam(player) == (type(team) == "string" and getTeamFromName(team) or (type(team) == "userdata" and team or (getPlayerTeam(player) or true))) end addCommandHandler ( "onService", function ( player, commandName, mode ) if isPlayerInTeam ( player ) == "[service]" then if mode == "true" then setElementData ( player, "onService", true ) outputChatBox ( "Now you are on service.", player, 0, 255, 0 ) toggleControl ( player, "fire", false ) elseif mode == "false" then setElementData ( player, "onService", false ) outputChatBox ( "Now you are out of service.", player, 0, 255, 0 ) toggleAllControls ( player, true ) end end end ) addEventHandler ( "onPlayerDamage", getRootElement ( ), function ( attacker, _, _, _ ) if getElementData ( attacker, "onService" ) == true or getElementData ( source, "onService" ) == true then cancelEvent ( ) end end ) addEventHandler ( "onVehicleDamage", getRootElement ( ), function ( loss ) local player = getVehicleOccupant ( source ) if player and getElementData ( player, "onService" ) == true then cancelEvent ( ) end end ) Link to comment
Parazitas Posted January 13, 2016 Author Share Posted January 13, 2016 Don't work:/ When im in group service other player who not in this group can kill me... Link to comment
aka Blue Posted January 13, 2016 Share Posted January 13, 2016 Should work. Check the team if is the same in the script. Link to comment
Parazitas Posted January 13, 2016 Author Share Posted January 13, 2016 Same.. Service Link to comment
aka Blue Posted January 13, 2016 Share Posted January 13, 2016 Is [service], not Service... if isPlayerInTeam ( player ) == "[service]" then Link to comment
Parazitas Posted January 14, 2016 Author Share Posted January 14, 2016 Is [service], not Service...if isPlayerInTeam ( player ) == "[service]" then I changed but still same Sh*t maybe edit this script just add function when player in team service when... function rewardOnWasted ( ammo, killer, killerweapon, bodypart ) if ( killer ) and ( killer ~= source ) then setElementHealth (killer, 0) end end addEventHandler ( "onPlayerWasted", getRootElement(), rewardOnWasted ) Link to comment
aka Blue Posted January 14, 2016 Share Posted January 14, 2016 Erase that code and use the code i send it, should work. PD: Not tested but im sure. Should work Link to comment
aka Blue Posted January 14, 2016 Share Posted January 14, 2016 Damn, im so stupid, sorry. Change the event onPlayerDamage for this: addEventHandler ( "onClientPlayerDamage", getLocalPlayer ( ), function ( attacker, _, _ ) if getElementData ( source, "onService" ) == true or getElementData ( attacker, "onService" ) == true then cancelEvent ( ) end end ) PD: Sorry again, my mistake... Link to comment
Parazitas Posted January 14, 2016 Author Share Posted January 14, 2016 Still nothing.. wtf.. Link to comment
aka Blue Posted January 14, 2016 Share Posted January 14, 2016 ¿Sure? Look, you need to execute the command /onService to be inmortal. 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