SAWA Posted August 30, 2013 Share Posted August 30, 2013 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 Link to comment
xXMADEXx Posted August 30, 2013 Share Posted August 30, 2013 There is no specific function for it. You'll need: createPed setElementModel bindKey createObject Link to comment
SAWA Posted August 30, 2013 Author Share Posted August 30, 2013 Thanks Can you explain why the use of CreateObject because I did not understand Link to comment
xXMADEXx Posted August 30, 2013 Share Posted August 30, 2013 Thanks and can i use GetValidPedModels to get all skins and make the skins in air ؟ https://wiki.multitheftauto.com/wiki/GetValidPedModels Yea, you can use that How to use createObject: Example: MyObject = createObject ( 980, 500, 300, 101, 0, 0, 90 ) -- element createObject ( int objectID, float x, float y, float z, float rx, float ry, float rz ) -- This is all the args you will need Link to comment
SAWA Posted August 30, 2013 Author Share Posted August 30, 2013 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 Link to comment
xXMADEXx Posted August 30, 2013 Share Posted August 30, 2013 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. Link to comment
SAWA Posted August 31, 2013 Author Share Posted August 31, 2013 Error 7:attempt to perform arithmetic on local "allSkins" { a table value } pls how know fix the code its clientside now Link to comment
DNL291 Posted August 31, 2013 Share Posted August 31, 2013 Because getValidPedModels returns a table not a number. Link to comment
SAWA Posted August 31, 2013 Author Share Posted August 31, 2013 Because getValidPedModels returns a table not a number. so how to fix the code ! Link to comment
Moderators IIYAMA Posted August 31, 2013 Moderators Share Posted August 31, 2013 Because getValidPedModels returns a table not a number. so how to fix the code ! Learn lua pfff, setElementModel ( player, allSkins[math.random(#allSkins)] ) Link to comment
SAWA Posted August 31, 2013 Author Share Posted August 31, 2013 ^^ 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 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now