Chickelon12 Posted March 13, 2014 Share Posted March 13, 2014 I have made a script which you should do a mission on a specific timer, when you are in mission if you wrote /timer then a dxText will appear showing the time left, actually the timer is 80000ms which is 80 sec, when i use /timer it shows the timer on miliseconds, how to make it shown in secs.. and how to make it a countdown, when i write /timer i made it to show the time remaining for 3 secs, so it writes for example 52032, without changing the text during the 3 secs, how to make it a countdown which changes the text ??? I am making a mechanic job,, so i wanted to if the player gets the job changes his skin to a random id from those (8, 42, 50) so i have made a table but idk what to write to make it random... skins = { '8', '42', '50'} local randomskin = math.random( #skins ) Link to comment
glowdemon1 Posted March 13, 2014 Share Posted March 13, 2014 Try math.random(1,#skins) or math.random(1,3) Link to comment
Chickelon12 Posted March 13, 2014 Author Share Posted March 13, 2014 (1,#skins) only set my skin to 1(id) (1,3) sets random from 1 to 3 Link to comment
glowdemon1 Posted March 13, 2014 Share Posted March 13, 2014 Try randomskin = skins[math.random(1,3)] Link to comment
Chickelon12 Posted March 13, 2014 Author Share Posted March 13, 2014 (edited) now it gives me the id(50) only EDIT: it gave me it only 1 time then when i restarted the script, and gave my self another skin, the script doesn't change it Edited March 13, 2014 by Guest Link to comment
Saml1er Posted March 13, 2014 Share Posted March 13, 2014 (edited) Its done like this: local mySkin = skins[ math.random( 1,#skins ) ] setElementModel (playerElement, tonumber (mySkin)) onClientRender calls the dx function( can be other function as well) every second or more. To convert 80000 ms into seconds, just divide it by 10000 and it will be converted into seconds. a = 80000/1000 print (a.."s") -- -> 80s Edited March 13, 2014 by Guest Link to comment
Chickelon12 Posted March 13, 2014 Author Share Posted March 13, 2014 Still doesn't change the skin Link to comment
glowdemon1 Posted March 13, 2014 Share Posted March 13, 2014 Well, did you define playerElement? Link to comment
Chickelon12 Posted March 13, 2014 Author Share Posted March 13, 2014 Yes, but i am using 'thePlayer' Link to comment
glowdemon1 Posted March 13, 2014 Share Posted March 13, 2014 Yes, but i am using 'thePlayer' Can you post a bit more code then? Because there shouldn't be a problem. Link to comment
Saml1er Posted March 13, 2014 Share Posted March 13, 2014 Yes, but i am using 'thePlayer' Show the part where you're defining it maybe we can correct you. Link to comment
Chickelon12 Posted March 13, 2014 Author Share Posted March 13, 2014 skins = { '8', '42', '50'} function takejob ( thePlayer ) local mySkin = skins[ math.random( 1,#skins ) ] setElementModel(thePlayer, tonumber (mySkin)) Link to comment
Saml1er Posted March 13, 2014 Share Posted March 13, 2014 skins = { '8', '42', '50'} function takejob ( thePlayer ) local mySkin = skins[ math.random( 1,#skins ) ] setElementModel(thePlayer, tonumber (mySkin)) Oh come on... Seriously, share the whole function. Just think how am I suppose to tell you what's wrong since I don't know if you're using it with an event handler or command handler? Anyways try /debugscript 3 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