• GMOD DARKRP : Model Level Restricted
    2 replies, posted
just wondering say i have a job here it is : TEAM_MARVEL = DarkRP.createJob("Spiderman", { color = Color(255, 0, 0, 255), model = { "models/kryptonite/spiderman_2/spiderman_2.mdl", "models/kryptonite/spiderman_miles_suit/spiderman_miles_suit.mdl" }, description = [[Spiderman]], weapons = {}, command = "spiderman", max = 1, salary = 1, admin = 0, vote = false, hasLicense = false, candemote = true, category = "Marvel Heros" }) but i want the models to be level rectricted like : TEAM_MARVEL = DarkRP.createJob("Spiderman", { color = Color(255, 0, 0, 255), model = { lev 20"models/kryptonite/spiderman_2/spiderman_2.mdl", lev 40 "models/kryptonite/spiderman_miles_suit/spiderman_miles_suit.mdl" }, description = [[Spiderman]], weapons = {}, command = "spiderman", max = 1, salary = 1, admin = 0, vote = false, hasLicense = false, candemote = true, category = "Marvel Heros" }) if it is possible to please explain how been trying for ages
You could do this with a simple if statement. Not that hard. PlayerSetModel = function( ply ) if( ply.level <= 20 ) then -- ply.level is the variable for the players level i guess return "somemodel" -- so if players level is equal to 20 or less then return this model elseif( ply.level > 20 ) then -- if it is greater than 20 then return this other model shown- return "someothermodel" -- -here end end, The "PlayerSetModel" is called whenever the player changes job or spawns and when it is called it will return a string which is a file path to a model ( .mdl ) and set the players model to what ever "PlayerSetModel" returns. As you probably noticed I put some if statements there, so if the variable "level" ( which is a child of "ply" ) is less than or equal to 20 then the function will return "somemodel". Now this isn't a real model but you can find player model paths here: https://csite.io/tools/gmod-universal-mdl But when the level is greater than 20 then the function will return "someothermodel". Now if you would have changed the second if statement's ( the elseif ) number to 40 then the function would only return "someothermodel" if the level is greater than 40. But the function won't return anything if the level is less than 40 or greater than 20. So it is pretty important that you don't leave a "gap". Now if you want to learn lua script for garry's mod or just in general you can go here: Beginner Tutorial Intro And here for just lua: Lua 5.1 Reference Manual You can also search for your answers at the DarkRP Wiki: https://wiki.darkrp.com/index.php/Main_Page
Thanks Alot!
Sorry, you need to Log In to post a reply to this thread.