Jump to content

source for skin table


Darky

Recommended Posts

i have a question , i am learning in this and i don't know if i can change the "element" ( source ) and replace this for a skin tablet or a specific skin

example:

local Skin = { 9,12 } 
  
    function skinW (  ) 
      giveWeapon ( Skin , 2 , 1, true ) 
       end 
   addEventHandler ( "onPlayerSpawn", getRootElement(), SkinW  ) 
  

Link to comment

Maybe this is what you want...

addEventHandler( "onPlayerSpawn", root, 
    function( ) 
        local playerSkin = getElementModel( source ); 
        if( playerSkin == 287 ) then 
            giveWeapon( source, 31, 100 ); 
        elseif( playerSkin == 286 ) then 
            giveWeapon( source, 22, 100 ); 
        end 
    end 
) 

Link to comment
Maybe this is what you want...
addEventHandler( "onPlayerSpawn", root, 
    function( ) 
        local playerSkin = getElementModel( source ); 
        if( playerSkin == 287 ) then 
            giveWeapon( source, 31, 100 ); 
        elseif( playerSkin == 286 ) then 
            giveWeapon( source, 22, 100 ); 
        end 
    end 
) 

addEventHandler( "onPlayerSpawn", root, 
    function( ) 
        local playerSkin = getElementModel( source ); 
        if( playerSkin == 287 or 286 ) then 
            giveWeapon( source, 31, 100 ); 
        elseif( playerSkin == 285 ) then 
            giveWeapon( source, 22, 100 ); 
        end 
    end 
) 

Link to comment
Maybe this is what you want...
addEventHandler( "onPlayerSpawn", root, 
    function( ) 
        local playerSkin = getElementModel( source ); 
        if( playerSkin == 287 ) then 
            giveWeapon( source, 31, 100 ); 
        elseif( playerSkin == 286 ) then 
            giveWeapon( source, 22, 100 ); 
        end 
    end 
) 

addEventHandler( "onPlayerSpawn", root, 
    function( ) 
        local playerSkin = getElementModel( source ); 
        if( playerSkin == 287 or 286 ) then 
            giveWeapon( source, 31, 100 ); 
        elseif( playerSkin == 285 ) then 
            giveWeapon( source, 22, 100 ); 
        end 
    end 
) 

Your code is wrong.

Link to comment

and other question, i can create a list which all skins? or something that looks

example

     
  
    local Weapons = {31 , 30 } 
    local skins = { 287 , 286 } 
  
addEventHandler( "onPlayerSpawn", root, 
        function( ) 
            local playerSkin = getElementModel( source ); 
            if( playerSkin == skins ) then 
                giveWeapon( source, Weapons[ math.random ( #Weapons ) ], 100 ); 
            elseif( playerSkin == 285 ) then 
                giveWeapon( source, 22, 100 ); 
            end 
        end 
    ) 
  
  
  

Link to comment

You can have weapon ID assigned to skin ID

  
local weaponIDBySkin = {  
[287] = 31, -- skin ID 287 will have weapon 31 
[286] = 31, 
[285] = 22 
} 
  
addEventHandler( "onPlayerSpawn", root, 
    function( ) 
        local playerSkin = getElementModel( source ); 
        if( skins[ playerSkin ] ) then -- check if playerSkin is inside the table 
            giveWeapon( source, weaponIDBySkin[ playerSkin ], 100 ); 
        end 
    end 
) 
  
  
  

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