Arsilex Posted August 8, 2012 Share Posted August 8, 2012 por que no me funciona esto addCommandHandler ( "liberar", function( player, commandName, otherPlayer ) if otherPlayer then local other, name = exports.players:getFromName( player, otherPlayer ) if other then if player ~= other then local x, y, z = getElementPosition( player ) if getDistanceBetweenPoints3D( x, y, z, getElementPosition( other ) ) < 5 then showCursor ( false, otherPlayer ) else outputChatBox( "Fallo4.", player, 255, 0, 0 ) end else outputChatBox( "Fallo3.", player, 255, 0, 0 ) end else outputChatBox( "Fallo2.", player, 255, 0, 0 ) end else outputChatBox( "Fallo1.", player, 255, 0, 0 ) end end) Link to comment
Castillo Posted August 8, 2012 Share Posted August 8, 2012 addCommandHandler ( "liberar", function ( player, commandName, otherPlayer ) if ( otherPlayer ) then local other, name = exports.players:getFromName ( player, otherPlayer ) if ( other ) then if ( player ~= other ) then local x, y, z = getElementPosition ( player ) if ( getDistanceBetweenPoints3D ( x, y, z, getElementPosition ( other ) ) < 5 ) then showCursor ( otherPlayer, false ) else outputChatBox ( "Fallo4.", player, 255, 0, 0 ) end else outputChatBox ( "Fallo3.", player, 255, 0, 0 ) end else outputChatBox ( "Fallo2.", player, 255, 0, 0 ) end else outputChatBox ( "Fallo1.", player, 255, 0, 0 ) end end ) El unico problema era que pusiste alrevez los argumentos en showCursor. Link to comment
Arsilex Posted August 8, 2012 Author Share Posted August 8, 2012 LOL pos valla fallazo tuve alli gracias castillo ^^ Link to comment
Arsilex Posted August 8, 2012 Author Share Posted August 8, 2012 Tengo una pregunta de este script cuando pongo liberar ID no libera al personaje por que puede ser osea no le quita el raton Link to comment
Arsilex Posted August 8, 2012 Author Share Posted August 8, 2012 mira mi script client-side function stopMinigunDamage ( attacker, otherPlayer, weapon, bodypart ) if ( weapon == 3 ) then showCursor ( true, otherPlayer ) end end addEventHandler ( "onClientPlayerDamage", getRootElement(), stopMinigunDamage ) y el sv es ese pos mira pego a alguen y se le pone el curson y cuando yo ponga liberar [nombre]o[iD] pos que se le quite el cursor al player que este diciendo en el nombre como ago Link to comment
Arsilex Posted August 8, 2012 Author Share Posted August 8, 2012 a mi me estan diciendo que no osea ese script el segundo que lo arreglaste lo puse bien poniendolo en server o es client? Link to comment
Alexs Posted August 8, 2012 Share Posted August 8, 2012 El segundo argumento de "onClientPlayerDamage" es un arma, no un jugador y en showCursos es jugador,boolean tu tenes boolean,jugador bool showCursor ( player thePlayer, bool show, [ bool toggleControls = true ] ) Link to comment
Castillo Posted August 8, 2012 Share Posted August 8, 2012 En el client side, el argumento de jugador no se usa. Link to comment
Arsilex Posted August 8, 2012 Author Share Posted August 8, 2012 por si no te as dado cuenta si quito el segundo argumento al que le salra el cursor es ami no al que sufrio el ataque Link to comment
Alexs Posted August 8, 2012 Share Posted August 8, 2012 Eso es mas simple: function stopMinigunDamage ( attacker, weapon, bodypart, loss ) if ( weapon == 3 ) then showCursor ( true ) end end addEventHandler ( "onClientPlayerDamage", getRootElement(), stopMinigunDamage ) Y no, tu eres attacker y el otro es 'source' Link to comment
Arsilex Posted August 8, 2012 Author Share Posted August 8, 2012 con lo que as puesto alex me sale el cursor a mi al otro nada PD:y si pongo showCursor ( source, true ) me sale bad argument showcurson Link to comment
Alexs Posted August 8, 2012 Share Posted August 8, 2012 con lo que as puesto alex me sale el cursor a mi al otro nada Tu kieres mostrarle el cursor a quien ataco? si es asi usa esto en server side: function stopMinigunDamage ( attacker, weapon, bodypart, loss ) if ( weapon == 3 ) then showCursor ( true, attacker ) end end addEventHandler ( "onPlayerDamage", getRootElement(), stopMinigunDamage ) Link to comment
Alexs Posted August 8, 2012 Share Posted August 8, 2012 no funciona. Como lo testeaste tan rapido? bool showCursor ( player thePlayer, bool show, [ bool toggleControls = true ] ) function stopMinigunDamage ( attacker, weapon, bodypart, loss ) if ( weapon == 3 ) then showCursor ( attacker, true ) end end addEventHandler ( "onPlayerDamage", getRootElement(), stopMinigunDamage ) Link to comment
Arsilex Posted August 8, 2012 Author Share Posted August 8, 2012 que no que nada me sale bad argument show cursor Link to comment
Alexs Posted August 8, 2012 Share Posted August 8, 2012 que no que nada me sale bad argument show cursor 1 o 2? esta en sv? function stopMinigunDamage ( attacker, weapon, bodypart, loss ) if ( weapon == 3 ) then showCursor ( attacker, true ) end end addEventHandler ( "onPlayerDamage", getRootElement(), stopMinigunDamage ) Eso deberia estar bien attacker: A player element representing the player who was the attacker. If there was no attacker this returns false. Link to comment
Castillo Posted August 8, 2012 Share Posted August 8, 2012 addEventHandler ( "onPlayerDamage", root, function ( _, weapon ) if ( weapon == 3 ) then showCursor ( source, true ) end end ) Link to comment
Alexs Posted August 8, 2012 Share Posted August 8, 2012 addEventHandler ( "onPlayerDamage", root, function ( _, weapon ) if ( weapon == 3 ) then showCursor ( source, true ) end end ) Espera, querias mostrar el cursor al atacado o al atacante?? Link to comment
Arsilex Posted August 8, 2012 Author Share Posted August 8, 2012 castillo eso ya me funciona muxa gracias una ultima pregunta como ago que un player siga a otro player ? Link to comment
Alexs Posted August 8, 2012 Share Posted August 8, 2012 castillo eso ya me funciona muxa gracias una ultima pregunta como ago que un player siga a otro player ? Eso ya es mucho mas complicado, especifica Link to comment
Arsilex Posted August 8, 2012 Author Share Posted August 8, 2012 osea que cuando yo ponga esposar que el personaje me siga osea el other Link to comment
Recommended Posts