TorNix~|nR Posted July 5, 2016 Share Posted July 5, 2016 Hello everyone I made a zone of PVP, I create for it an anti weapon for example (Minigun, Rocket Launcher...) etc but it doesn't work anyone help please? Link to comment
TorNix~|nR Posted July 5, 2016 Author Share Posted July 5, 2016 Client local antiWeapon = {[0] = true, [1] = true, [2] = true, [4] = true, [5] = true, [6] = true, [8] = true, [9] = true, [10] = true, [12] = true, [14] = true, [34] = true, [35] = true, [36] = true, [37] = true, [38] = true, [16] = true, [17] = true, [18] = true, [39] = true, [14] = true, [40] = true, [41] = true} addEventHandler("onClientPedDamage", root, function (attacker, weapon) local pvp = getElementData(source, "PVP") if pvp and antiWeapon[weapon] then cancelEvent() end end) addEventHandler("onClientPlayerWeaponSwitch", localPlayer, function (prevSlot, newSlot) for _, pvp in ipairs(getElementsByType("player")) do if getElementData(pvp, "PVP") then local px, py, pz = getElementPosition(localPlayer) local x, y, z = getElementPosition(pvp) local dist = getDistanceBetweenPoints3D(px, py, pz, x, y, z) if dist < 300 and antiWeapon[getPedWeapon(getLocalPlayer())] then outputChatBox("No se puede utilizar esta arma en PVP Zona", 255, 0, 0) toggleControl("fire", false) return else toggleControl("fire", true) end end end end) addEventHandler("onClientPlayerWeaponFire", localPlayer, function (weapon, _, _, _, _, _, hitElement ) if hitElement and getElementData(hitElement, "PVP") and antiWeapon[weapon] then outputChatBox("No se puede utilizar esta arma en PVP Zona", 255, 0, 0) toggleControl("fire", false) end end) addEventHandler("onClientPlayerDamage", localPlayer, function (attacker,weapon, bodypart) if (attacker) and (isElement(attacker)) and not (attacker == source) then if (getElementType(attacker) == "vehicle") then attacker = getVehicleController(attacker) or false end if (attacker) and (getElementType(attacker) == "player") then local ff1, ff2, bag1, bag2 = getElementData(source, "friendlyFire"), getElementData(attacker, "friendlyFire"), getElementData(source, "bag"), getElementData(attacker, "bag") if (bag1 or bag2) then return end if (ff1 or ff2) then return end cancelEvent() end end end) addEventHandler("onClientPlayerStealthKill", localPlayer, function (attacker,weapon, bodypart) if (attacker) and (getElementType(attacker) == "player") then local ff1, ff2 = getElementData(source, "friendlyFire"), getElementData(attacker, "friendlyFire") if not (ff1 or ff2) then cancelEvent() end end end) addEventHandler("onClientPlayerSpawn", root, function ( ) if not (source == localPlayer) then setElementCollidableWith(source, localPlayer, false) end end) addEventHandler("onClientResourceStart", resourceRoot, function ( ) for _, thePlayer in ipairs(getElementsByType("player"))do if not (thePlayer == localPlayer) then setElementCollidableWith(thePlayer, localPlayer, false) end end end) Link to comment
Captain Cody Posted July 5, 2016 Share Posted July 5, 2016 He was messaging me on Skype about this, said there was nothing in debug. Link to comment
TorNix~|nR Posted July 5, 2016 Author Share Posted July 5, 2016 The debug is clean ._. Link to comment
Walid Posted July 5, 2016 Share Posted July 5, 2016 The debug is clean ._. Try using outputDebugString to see what the problem is. And try this local antiWeapon = {[0] = true, [1] = true, [2] = true, [4] = true, [5] = true, [6] = true, [8] = true, [9] = true, [10] = true, [12] = true, [14] = true, [34] = true, [35] = true, [36] = true, [37] = true, [38] = true, [16] = true, [17] = true, [18] = true, [39] = true, [14] = true, [40] = true, [41] = true} addEventHandler("onClientPlayerDamage",localPlayer, function (attacker, weapon) if (attacker and getElementType(attacker) == "player" and attacker ~= source) then local pvp = getElementData(source, "PVP") if pvp and antiWeapon[weapon] then cancelEvent() end end end) addEventHandler("onClientPlayerWeaponSwitch", localPlayer, function (prevSlot, newSlot) for _, pvp in ipairs(getElementsByType("player")) do if getElementData(pvp, "PVP") then local px, py, pz = getElementPosition(localPlayer) local x, y, z = getElementPosition(pvp) local dist = getDistanceBetweenPoints3D(px, py, pz, x, y, z) if dist < 300 and antiWeapon[getPedWeapon(getLocalPlayer())] then outputChatBox("No se puede utilizar esta arma en PVP Zona", 255, 0, 0) toggleControl("fire", false) return else toggleControl("fire", true) end end end end) addEventHandler("onClientPlayerWeaponFire", localPlayer, function (weapon, _, _, _, _, _, hitElement ) if hitElement and getElementData(hitElement, "PVP") and antiWeapon[weapon] then outputChatBox("No se puede utilizar esta arma en PVP Zona", 255, 0, 0) toggleControl("fire", false) end end) addEventHandler("onClientPlayerDamage", localPlayer, function (attacker,weapon, bodypart) if (attacker) and (isElement(attacker)) and not (attacker == source) then if (getElementType(attacker) == "vehicle") then attacker = getVehicleController(attacker) or false end if (attacker) and (getElementType(attacker) == "player") then local ff1, ff2, bag1, bag2 = getElementData(source, "friendlyFire"), getElementData(attacker, "friendlyFire"), getElementData(source, "bag"), getElementData(attacker, "bag") if (bag1 or bag2) then return end if (ff1 or ff2) then return end cancelEvent() end end end) addEventHandler("onClientPlayerStealthKill", localPlayer, function (attacker,weapon, bodypart) if (attacker) and (getElementType(attacker) == "player") then local ff1, ff2 = getElementData(source, "friendlyFire"), getElementData(attacker, "friendlyFire") if not (ff1 or ff2) then cancelEvent() end end end) addEventHandler("onClientPlayerSpawn", root, function ( ) colliDable(source) end) addEventHandler("onClientResourceStart", resourceRoot, function ( ) for _, thePlayer in ipairs(getElementsByType("player"))do colliDable(thePlayer) end end) function colliDable(player) if not (player == localPlayer) then setElementCollidableWith(player, localPlayer, false) end end Link to comment
TorNix~|nR Posted July 5, 2016 Author Share Posted July 5, 2016 nothing in debug not work:/ Link to comment
Walid Posted July 5, 2016 Share Posted July 5, 2016 nothing in debugnot work:/ You can't see every thing using debugscript 3 , Try using outputDebugString to see what the problem is. Link to comment
TorNix~|nR Posted July 5, 2016 Author Share Posted July 5, 2016 INFO: Done function working fine 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