Jump to content

Skin take


yMassai

Recommended Posts

  • Replies 51
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted (edited)

function pickupUse ( thePlayer ) 
    outputChatBox ( getPlayerName ( thePlayer ) .. " picked up a pickup!" ) 
end 
addEventHandler ( "onPickupUse", getRootElement(), pickupUse ) 

this?

Edited by Guest
Posted (edited)
function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) --when a player dies 
    x, y, z = getElementPosition ( source ) --get the position of the person who died and define it as x, y and z 
    currentweapon = getPlayerWeapon ( source ) --get the current weapon of the dead person 
    createPickup ( x, y, z, 2, currentweapon, 10000, totalammo ) 
end 
lockSkins = { [287] = true ; [121] = true ; } -- sets the lock skins 
if ( not lockSkins[getElementModel ( player )] ) and ( seat == 0 ) then  
utputChatBox ( "*Você não pode pegar esta arma.", player , 255, 00, 00) --info in chatbox 
addEventHandler ( "onPlayerWasted", getRootElement(), createDeathPickup ) --add an event handler for onPlayerWasted 

maybe?

Edited by Guest
Posted
lockSkins = { [287] = true, [121] = true } -- sets the lock skins 
  
function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) --when a player dies 
    if ( lockSkins[getElementModel ( source )] ) and ( seat == 0 ) then 
        local x, y, z = getElementPosition ( source ) --get the position of the person who died and define it as x, y and z 
        local currentweapon = getPedWeapon ( source ) --get the current weapon of the dead person 
        createPickup ( x, y, z, 2, currentweapon, 10000, totalammo ) 
    else 
        outputChatBox ( "*Você não pode entrar neste veículo.", source, 255, 00, 00) --info in chatbox 
    end 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), createDeathPickup ) --add an event handler for onPlayerWasted 

Posted

lockSkins = { [287] = true, [121] = true } -- sets the lock skins 
  
function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) --when a player dies 
    if ( lockSkins[getElementModel ( player )] ) and ( seat == 0 ) then 
        local x, y, z = getElementPosition ( source ) --get the position of the person who died and define it as x, y and z 
        local currentweapon = getPedWeapon ( source ) --get the current weapon of the dead person 
       createPickup  ( 1540.5999755859, -1660.9000244141, 13.60000038147, 2, 30, 10000, 1000 ) 
    else 
        outputChatBox ( "*Só militares podem pegar esta arma.", player, 255, 00, 00) --info in chatbox 
    end 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), createDeathPickup ) --add an event handler for onPlayerWasted 

Not Work

Posted (edited)

try

function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) --when a player dies 
    local skin = getElementModel(source) 
    if ( skin == 287 ) or ( skin == 121 ) and ( seat == 0 ) then 
        local x, y, z = getElementPosition ( source ) --get the position of the person who died and define it as x, y and z 
        local currentweapon = getPedWeapon ( source ) --get the current weapon of the dead person 
        createPickup ( x, y, z, 2, currentweapon, 10000, totalammo ) 
    else 
        outputChatBox ( "*Você não pode entrar neste veículo.", player, 255, 00, 00) --info in chatbox 
    end 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), createDeathPickup ) --add an event handler for onPlayerWasted 
  

Edited by Guest
Posted
<meta> 
    <info author="Ninguem" name="test" version="1.0.0" type="script"/>   
    <script src="weapon.lua" type ="server"/> 
</meta> 

Posted

Why don't use the fucking tables? Isn't more easy for him add skins?? And why you simply copy examples / other scripts DNL291?

As far as I know, he want this:

local skins = { [ 287 ] = true; [ 121 ] = true }; 
  
addEventHandler ( 'onPlayerWasted', root, 
    function ( uAmmo, uKiller, uWeapon, uPart ) 
        if ( skins [ getElementModel ( source ) ] ) then 
            local x, y, z = getElementPosition ( source ) 
            local cWeapon = getPedWeapon ( source ) 
            thePickup = createPickup ( x, y, z, 2, cWeapon, 10000, uAmmo ); 
            addEventHandler ( 'onPickupHit', thePickup, getPickup ) 
        else 
            return 
        end 
    end 
) 
  
function getPickup ( player ) 
    if ( skins [ getElementModel ( player ) ] ) then 
        giveWeapon ( player, getPickupWeapon ( source ), getPickupAmmo ( source ) ); 
    end 
end 

This creates a pickup when you die if you have any skin of the table. Then anyone who haves a skin of table can take the weapon.

Posted (edited)
lockSkins = { [287] = true, [121] = true } 
function onDeathPickupHit( player ) 
    local skin = getElementModel(player) 
    if ( lockSkins[skin] ) then 
        getPickupWeapon( player ) 
    else 
            cancelEvent() 
            outputChatBox("*Só militares podem pegar esta arma.", player, 255, 0, 0) 
    end 
end 
  
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 ) 
end) 
  

And why you simply copy examples / other scripts DNL291?

is an example of wiki.

https://wiki.multitheftauto.com/wiki/CreatePickup

Edited by Guest
Posted

try this and change x y z with your coordinate

yourgun = createPickup ( x, y, z, 2, 31, 4000, 0) ---change x, y, z and change gun id  
  
function onPickupuse ( uPlayer ) 
    local skin = getElementModel( uPlayer ) 
    if ( skin == 287 ) or ( skin == 121 ) and ( seat == 0 ) then 
       giveWeapon ( uPlayer, 31, 500, true ) ----give m4 change with your guns 
     end 
end 
addEventHandler ( "onPickupUse", yourgun, onPickupuse ) 

Meta.xml

    "Ninguem" name="test" version="1.0.0" type="script"/>   
    

Posted (edited)

DNL291, why change my code?? Mine was correct. No need to change my code.

Edited by Guest
Posted
try this and change x y z with your coordinate
yourgun = createPickup ( x, y, z, 2, 31, 4000, 0) ---change x, y, z and change gun id  
  
function onPickupuse ( uPlayer ) 
    local skin = getElementModel( uPlayer ) 
    if ( skin == 287 ) or ( skin == 121 ) and ( seat == 0 ) then 
       giveWeapon ( uPlayer, 31, 500, true ) ----give m4 change with your guns 
     end 
end 
addEventHandler ( "onPickupUse", yourgun, onPickupuse ) 

Meta.xml

    "Ninguem" name="test" version="1.0.0" type="script"/>   
    

is not what he wants.

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