Jump to content

Skin take


yMassai

Recommended Posts

  • Replies 51
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

@DNL291 : why u put this ?
          
.. 
destroyElement( player ) 

cancelEvent the pickup will not disappear and the player will not pick up the weapon.

destroyElement dont work.

Your server must be magic to run this. Wanna see where are errors in your code? Basically, in all the code.

then show the error

Link to comment
lockSkins = { [287] = true, [121] = true } 
function onDeathPickupHit ( player, matchingDimension ) 
    local skin = getElementModel(player) 
    if ( lockSkins[skin] ) then 
        if ( matchingDimension ) then -- no need 
            removeEventHandler ( "onPickupHit", source, onDeathPickupHit ) -- idk if it's needed 
            local weaponPickup = getPickupWeapon( player ) -- wrong 
            destroyElement( player ) -- wrong 
            giveWeapon( player, weapon, false ) -- wrong 
            local weapon = getPedWeapon( player ) -- wrong 
        end 
    else 
            cancelEvent() 
            outputChatBox("*Só militares podem pegar esta arma.", player, 255, 0, 0) 
    end 
end 
  
local function destroyDeathPickup( pickup ) 
    removeEventHandler( "onPickupHit", pickup, onDeathPickupHit ) 
    destroyElement( pickup )  
end 
  
addEventHandler("onPlayerWasted", root,  
function (totalammo, killer, killerweapon, bodypart) 
        local timeout = 60000 
        local x, y, z = getElementPosition( source ) 
        local currentweapon = getPedWeapon( source ) 
        local totalammo = getPedTotalAmmo( source ) 
        local pickup = createPickup( x, y, z, 2, currentweapon, timeout, totalammo ) 
        addEventHandler( "onPickupHit", pickup, onDeathPickupHit ) 
        setTimer( destroyDeathPickup, timeout, 1, pickup ) -- idk why need function 
end) 
  

Link to comment

oh, not needed it.

location = getPedWeapon weapon (player) 
if ( matchingDimension ) then 
destroyElement( player ) 
removeEventHandler ( "onPickupHit" , origem, onDeathPickupHit ) 
giveWeapon( player, weapon, false ) 

but anyway operate normally.

Edited by Guest
Link to comment
Am? Work? Are you kidding me? You put the code in a file, create a resource, start it and search for errors. No errors, working. Good. STOP SAYING THAT YOUR CODE WORK NORMALLY. YOUR CODE IS TOTALLY WRONG.

Learn: viewtopic.php?f=148&t=40809

why do you say that? does not work for you? arrange and then only post.

as I said please post the error that hinders the functioning of the script, as you say

Link to comment
lockSkins = 
    { 
        [ 287 ] = true, 
        [ 121 ] = true 
    } 
    
function onDeathPickupHit ( player ) 
    local skin = getElementModel ( player ) 
    if ( lockSkins[ skin ] ) then 
        destroyDeathPickup ( source ) 
    else 
        cancelEvent ( ) 
        outputChatBox("*Só militares podem pegar esta arma.", player, 255, 0, 0) 
    end 
end 
  
function destroyDeathPickup ( pickup ) 
    if ( isElement ( pickup ) ) then 
        removeEventHandler ( "onPickupUse", pickup, onDeathPickupHit ) 
        destroyElement ( pickup ) 
    end 
end 
  
addEventHandler ( "onPlayerWasted", root, 
    function ( _, killer ) 
        local timeout = 60000 
        local x, y, z = getElementPosition ( source ) 
        local currentweapon = getPedWeapon ( source ) 
        local totalammo = getPedTotalAmmo ( source ) 
        local pickup = createPickup ( x, y, z, 2, currentweapon, 50, totalammo ) 
        addEventHandler ( "onPickupUse", pickup, onDeathPickupHit ) 
        setTimer( destroyDeathPickup, timeout, 1, pickup ) 
    end 
) 

Link to comment
lockSkins = 
    { 
        [ 287 ] = true, 
        [ 121 ] = true 
    } 
    
function onDeathPickupHit ( player ) 
    local skin = getElementModel ( player ) 
    if ( lockSkins[ skin ] ) then 
        destroyDeathPickup ( source ) 
    else 
        cancelEvent ( ) 
        outputChatBox("*Só militares podem pegar esta arma.", player, 255, 0, 0) 
    end 
end 
  
function destroyDeathPickup ( pickup ) 
    if ( isElement ( pickup ) ) then 
        removeEventHandler ( "onPickupUse", pickup, onDeathPickupHit ) 
        destroyElement ( pickup ) 
    end 
end 
  
addEventHandler ( "onPlayerWasted", root, 
    function ( _, killer ) 
        local timeout = 60000 
        local x, y, z = getElementPosition ( source ) 
        local currentweapon = getPedWeapon ( source ) 
        local totalammo = getPedTotalAmmo ( source ) 
        local pickup = createPickup ( x, y, z, 2, currentweapon, 50, totalammo ) 
        addEventHandler ( "onPickupUse", pickup, onDeathPickupHit ) 
        setTimer( destroyDeathPickup, timeout, 1, pickup ) 
    end 
) 

Your code doesn't work too. createPickup returns false.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...