Jump to content

View skins in air


SAWA

Recommended Posts

Posted

How i can make view all skins in server in air and player can choose the skins And when press the left or right arrow Change skins and when prees enter get the skins

Who knows gives me the function

Posted
  
local allSkins = 0 
addEventHandler ( "onPlayerJoin", root, 
 function ( peds ) 
 local allSkins = getValidPedModels ( ) 
bindKey ( player, "arrow_r", "down", peds ) 
allSkins = allSkins + 1 
bindKey ( player, "arrow_l", "down", peds ) 
allSkins = allSkins  -1 
h = createPed ( 120, 2491.2412109375, -1675.3841552734, 30.133781433105 ) 
p = createObject ( 1337, 2491.2412109375, -1675.3841552734, 30.133781433105 ) 
setElementFrozen ( h, true ) 
  
setCameraMatrix ( 2492.833984375, -1666.5686035156, 22.295654296875 ) 
bindKey ( player, "enter", "down", peds ) 
setElementModel ( player, allSkins ) 
  
spawnPlayer ( player, -2417.2517089844, 602.68542480469, 132.5625 ) 
  
end) 
  
  

i make this code

6: Bad argument @ 'bindKey'

7: attempt to perform arithmetic on local 'allSkins ' a table value

Any one Help me the code not worked

Posted
  
local allSkins = 0 
addEventHandler ( "onPlayerJoin", root, 
 function ( peds ) 
 local allSkins = getValidPedModels ( ) 
bindKey ( player, "arrow_r", "down", peds ) 
allSkins = allSkins + 1 
bindKey ( player, "arrow_l", "down", peds ) 
allSkins = allSkins  -1 
h = createPed ( 120, 2491.2412109375, -1675.3841552734, 30.133781433105 ) 
p = createObject ( 1337, 2491.2412109375, -1675.3841552734, 30.133781433105 ) 
setElementFrozen ( h, true ) 
  
setCameraMatrix ( 2492.833984375, -1666.5686035156, 22.295654296875 ) 
bindKey ( player, "enter", "down", peds ) 
setElementModel ( player, allSkins ) 
  
spawnPlayer ( player, -2417.2517089844, 602.68542480469, 132.5625 ) 
  
end) 
  
  

i make this code

6: Bad argument @ 'bindKey'

7: attempt to perform arithmetic on local 'allSkins ' a table value

Any one Help me the code not worked

You should make the code on the client side, otherwise it will be all buggy when more then 1 players are trying to select a skin.

Posted

Error 7:attempt to perform arithmetic on local "allSkins" { a table value }

pls how know fix the code

its clientside now

  • Moderators
Posted
Because getValidPedModels returns a table not a number.

so how to fix the code !

Learn lua pfff,

setElementModel ( player, allSkins[math.random(#allSkins)] ) 

Posted

^^

i try to start code now at client side no error but the code doesnt work

and i want view skins start from 0 and when prees arrow_r view skin 1 and when prees again 2 etc .. so +1

and when prees arrow_l -1 so if view skins number 1 and prees arrow_l then view 0 etc ..

your code its take a random skins

i make code but not worked

so any one knows fix it

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