anufis_ok Posted June 4, 2018 Share Posted June 4, 2018 Where is the error in the code? local validSkins = {29, 30, 100, 101, 102, 104, 106, 107, 108, 109, 110, 114, 115, 116, 118, 144, 165, 173, 174, 175, 280, 283, 285, 286, 287, 294} local function spawn(player) if player and isElement(player) then validSkins[math.random(1,#validSkins)],0,0) end end <meta> <info author="Yolo" description="This is script, setting skins." version="1.0.0" type="script" /> <script src="setskin.lua"/> </meta> Link to comment
opnaiC Posted June 4, 2018 Share Posted June 4, 2018 What is the event handler and what do you want to do? Link to comment
DNL291 Posted June 4, 2018 Share Posted June 4, 2018 validSkins [math.random(1,#validSkins)], 0, 0 ) : missing the first parenthesis validSkins[math.random(1,#validSkins)] : table 0, 0 : argument ? Maybe you forgot to use the function before the table. Link to comment
Hoffmann Posted June 5, 2018 Share Posted June 5, 2018 (edited) Probably this is what you wanna do: local validSkins = {29, 30, 100, 101, 102, 104, 106, 107, 108, 109, 110, 114, 115, 116, 118, 144, 165, 173, 174, 175, 280, 283, 285, 286, 287, 294} function spawnOnJoin() local rndSkin = validSkins[math.random(0,#validSkins)] -- get random valid skin from the table spawnPlayer(source, 0,0, 5, 0, rndSkin) -- spawn a player when he joins the server fadeCamera(source, true) setCameraTarget(source, source) end end addEventHandler("onPlayerJoin", root, spawnOnJoin) Edited June 5, 2018 by NeverUnbeatable 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