Jump to content

Commando liberar


Arsilex

Recommended Posts

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
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

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 :S

Link to comment

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
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
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
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
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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...