Araa Posted April 19, 2012 Share Posted April 19, 2012 Perdon si estoy haciendo muchas preguntas, pero en fin... Aca tengo un problema, con el script de medico. Este al disparar con el spray cura al otro, pero a la vez lo lastima un poco y hace que se retuersa por el pray en los ojos ._. Si alguien me ayuda a arreglarlo les agradezco function healing (attacker, attackerweapon, bodypart, loss) health = getElementHealth (source) if not skin[getElementModel(attacker)] then return end else if (attackerweapon == 41) and (loss > 1) and ( health < 95 ) then setElementHealth ( source, health+15 ) givePlayerMoney (attacker, 1.7*health) takePlayerMoney (source, 1.9*health) end end end addEventHandler ("onPlayerDamage", getRootElement(), healing ) Gracias Link to comment
Castillo Posted April 19, 2012 Share Posted April 19, 2012 Necesitas hacer el script client side y server side, asi podes cancelar el daño que hace el medico. -- client side: function healing ( attacker, attackerweapon, bodypart, loss ) local health = getElementHealth ( source ) if ( attacker and getElementType ( attacker ) == "player" ) and ( attackerweapon == 41 ) and ( loss > 1 ) and ( health < 95 ) then if ( not skin [ getElementModel ( attacker ) ] ) then return end else cancelEvent ( ) if ( not isTimer ( waitTimer ) ) then triggerServerEvent ( "healPlayer", localPlayer, attacker, health ) waitTimer = setTimer ( function ( ) end, 2000, 1 ) end end end addEventHandler ( "onClientPlayerDamage", getRootElement(), healing ) -- server side: addEvent ( "healPlayer", true ) addEventHandler ( "healPlayer", root, function ( medic, health ) if ( health < 99 ) then setElementHealth ( source, health + 15 ) givePlayerMoney ( medic, 1.7 * health ) takePlayerMoney ( source, 1.9 * health ) end end ) Link to comment
Recommended Posts