JuanM27 Posted January 7, 2012 Posted January 7, 2012 hola, quisiera saber como poder bloquear el uso de armas, y de golpe cuando un player esta en la carcel? busque en la wiki y no encontre nada relacionado. si conocen la pag de la wiki que explique su funcion me lo podrian dar o algun ejemplo si esa informacion no esta en la wiki. saludos y gracias
JuanM27 Posted January 7, 2012 Author Posted January 7, 2012 Usa la funcion: toggleControl("fire", false) dale muchas gracias, hay me funciono y con la wiki le puse para que tambien no permita el cambio de armas. tengo 1 consulta no saben cual es el id del Spray que usa el medico para currar en varios server? yo probe con el id 41 que es el Spraycan pero ese hace daño al currar al otro player, o como seria para que el Spray no haga daño a los players? saludos y muchas gracias
Castillo Posted January 7, 2012 Posted January 7, 2012 Para cambiar el arma al slot 0: https://wiki.multitheftauto.com/wiki/SetPedWeaponSlot Se usa el Spray Can ID: 41, pero cancelamos el daño en onClientPlayerDamage. Ejemplo de como lo hice en el servidor SAUR: -- client side: addEventHandler("onClientPlayerDamage", localPlayer, function (attacker, weapon, bodypart, loss) if (attacker and getElementType(attacker) == "player" and weapon == 41) then local team = getPlayerTeam(attacker) if (team and getTeamName(team) == "Medic") then cancelEvent() end end end)
JuanM27 Posted January 8, 2012 Author Posted January 8, 2012 hola si pongo ese codigo en el cliente addEventHandler("onClientPlayerDamage", localPlayer, function (attacker, weapon, bodypart, loss) if (attacker and getElementType(attacker) == "player" and weapon == 41) then local team = getPlayerTeam(attacker) if (team and getTeamName(team) == "Medicos") then cancelEvent() end end end) no hace daño, pero no cura. la parte que cura lo tengo en el lado del server que es la siguiente function heal(attacker, attackerweapon, bodypart, loss) theHealth = getElementHealth (source) if (attackerweapon == 41) and (loss > 1) and ( theHealth < 90 ) then -- el real era (if (attackerweapon == 14) and (loss > 1) and ( theHealth < 80 ) then) setElementHealth ( source, 100 ) takePlayerMoney (source, 100) givePlayerMoney (attacker, 100) end end addEventHandler ("onPlayerDamage", getRootElement(), heal ) pero trate de modificarlo, quitando la parte del server y agregando en el cliente esto addEventHandler("onClientPlayerDamage", localPlayer, function (attacker, weapon, bodypart, loss) if (attacker and getElementType(attacker) == "player" and weapon == 41) then local team = getPlayerTeam(attacker) if (team and getTeamName(team) == "Medicos") then setElementHealth ( localPlayer, 100 ) takePlayerMoney (localPlayer, 100) givePlayerMoney (attacker, 100) cancelEvent() end end end) pero tampoco cura, me darias una mano, para hacerlo funcionar? gracias
Castillo Posted January 8, 2012 Posted January 8, 2012 -- client side. addEventHandler("onClientPlayerDamage", localPlayer, function (attacker, weapon, bodypart, loss) if (attacker and getElementType(attacker) == "player" and weapon == 41) then local team = getPlayerTeam(attacker) if (team and getTeamName(team) == "Medicos") then cancelEvent() if (not isTimer(timer)) then local health = getElementHealth(localPlayer) if (health < 99) then triggerServerEvent("medic_heal", localPlayer, attacker) timer = setTimer(function() end, 1000, 1) end end end end end) -- server side: addEvent("medic_heal", true) addEventHandler("medic_heal", root, function (medic) if (getElementHealth(source) < 100) then local newHP = getElementHealth(source) + 20 setElementHealth(source, newHP) if (newHP > 100) then setElementHealth(source, 100) end givePlayerMoney(medic, 100) takePlayerMoney(source, 100) end end)
JuanM27 Posted January 8, 2012 Author Posted January 8, 2012 ok gracias, ya lo pruebo y te digo edito: me andubo perfecto, muchas gracias de verdad
Recommended Posts