Jump to content

DarArma


Arsilex

Recommended Posts

Que debería hacer para que cuando pongan dararma pekio123 que le den el arma que el hombre tiene en la mano ._.?

addCommandHandler( "dararma", 
    function( player, commandName, otherPlayer ) 
        local weapon = tonumber( weapon ) 
        if otherPlayer and weapon and math.ceil( weapon ) == weapon and weapon > 1 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 
                            outputChatBox( "Le diste " .. name .. " tu " .. weapon .. ".", player, 0, 255, 0 ) 
                            outputChatBox( getPlayerName( player ):gsub( "_", " " ) .. " te dio un " .. weapon .. ".", other, 0, 255, 0 ) 
                    else 
                        outputChatBox( "Estas lejos de  " .. name .. ".", player, 255, 0, 0 ) 
                    end 
                else 
                    outputChatBox( "No puedes darte arma a ti mismo.", player, 255, 0, 0 ) 
                end 
            end 
        else 
            outputChatBox( "Syntax: /" .. commandName .. " [player] [weapon]", player, 255, 255, 255 ) 
        end 
    end 
) 

Link to comment
addCommandHandler ( "dararma", 
    function ( player, commandName, otherPlayer ) 
        local weapon = getPedWeapon ( player ) 
        if ( otherPlayer and weapon and weapon > 1 ) 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 
                        giveWeapon ( other, weapon ) 
                        takeWeapon ( player, weapon ) 
                        outputChatBox ( "Le diste " .. name .. " tu " .. weapon .. ".", player, 0, 255, 0 ) 
                        outputChatBox ( getPlayerName ( player ):gsub ( "_", " " ) .. " te dio un " .. weapon .. ".", other, 0, 255, 0 ) 
                    else 
                        outputChatBox ( "Estas lejos de  " .. name .. ".", player, 255, 0, 0 ) 
                    end 
                else 
                    outputChatBox ( "No puedes darte arma a ti mismo.", player, 255, 0, 0 ) 
                end 
            end 
        else 
            outputChatBox ( "Syntax: /" .. commandName .. " [player] [weapon]", player, 255, 255, 255 ) 
        end 
    end 
) 

Eso?

Link to comment

Eso es porque no le pusiste que le de las balas tambien.

addCommandHandler ( "dararma", 
    function ( player, commandName, otherPlayer ) 
        local weapon = getPedWeapon ( player ) 
        local ammo = getPedTotalAmmo ( player ) 
        if ( otherPlayer and weapon and weapon > 1 ) 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 
                        giveWeapon ( other, weapon, ammo, true ) 
                        takeWeapon ( player, weapon ) 
                        outputChatBox ( "Le diste " .. name .. " tu " .. weapon .. ".", player, 0, 255, 0 ) 
                        outputChatBox ( getPlayerName ( player ):gsub ( "_", " " ) .. " te dio un " .. weapon .. ".", other, 0, 255, 0 ) 
                    else 
                        outputChatBox ( "Estas lejos de  " .. name .. ".", player, 255, 0, 0 ) 
                    end 
                else 
                    outputChatBox ( "No puedes darte arma a ti mismo.", player, 255, 0, 0 ) 
                end 
            end 
        else 
            outputChatBox ( "Syntax: /" .. commandName .. " [player] [weapon]", player, 255, 255, 255 ) 
        end 
    end 
) 

Link to comment
  • Recently Browsing   0 members

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