Hey guys i need help with starting a leveling system. I don't want it to have experience though i would like admins to rank the person up. i also need help saving the persons level. i think i know how to get the admin to rank them up but i dont know how to start the rest of it.
-Thanks in advance
you can use [b][url=http://wiki.garrysmod.com/?title=Player.SetPData]Player.SetPData [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] and [b][url=http://wiki.garrysmod.com/?title=Player.GetPData]Player.GetPData [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] to save/retrive information about a player. So in the [b][url=wiki.garrysmod.com/?title=Gamemode.PlayerInitialSpawn]Gamemode.PlayerInitialSpawn [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] check and see if you have any saved data for them, if so load it, if not then create the default variables on the player like ply.level = 0.
ok thanks, but i still need to figure out the leveling system before i start the saving
Check there level on the LoadOut hook and then give them weapons, set their model, set their speed, etc. based on their level.
[QUOTE=xam678;29253242]ok thanks, but i still need to figure out the leveling system before i start the saving[/QUOTE]
I guess i'm not understanding the question, if you aren't using experience to advance the level what I suggested would set all new people to level 0 or 1 (where ever you want to start it), and then after the admins level them up you would save it. Then do like cis.joshb said and check the level in the loadout hook or the PlayerSpawn hook and give them the appropriate things based on their level. If you want example code I can post some, just ask.
I don't think this guy knows much lua. This should probably be in requests.
i know lua i just need to know how to get the leveling started you guys are not understanding. so to simply put it i need to know how to set the players level then save it. thats all i need i can easily make the admin leveling up the player and stuff like that.
Hooks:
[b][url=wiki.garrysmod.com/?title=Gamemode.PlayerInitialSpawn]Gamemode.PlayerInitialSpawn [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
[b][url=wiki.garrysmod.com/?title=Gamemode.PlayerDisconnected]Gamemode.PlayerDisconnected [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Functions:
[b][url=http://wiki.garrysmod.com/?title=Player.SetPData]Player.SetPData [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
[b][url=http://wiki.garrysmod.com/?title=Player.GetPData]Player.GetPData [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
So, in the PlayerInitalSpawn check if you can load data about the player with GetPData, if you can then set ply.level to the value you got from GetPData. If you get no value from GetPData then set ply.level to your base level (usually 1 or 0). In the PlayerDisconnected use SetPData to save the ply.level value. As far as leveling up the players just modify ply.level whenever it changes. I usually include a concommand, [b][url=http://wiki.garrysmod.com/?title=Concommand.Add]Concommand.Add [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b], so players and admins can save data before a server restart or map reload, disconnect doesn't get called and you will lose data. I don't know any other way to explain it, hope this helped and good luck:smile:.
[QUOTE=xam678;29306415]i know lua[/QUOTE]
You sure?
[url]http://lua.org/pil/[/url]
I would read over then then do some tutorials on Gmod Wiki.
Okay well first what do you need help with as of now?
i now have the i think the basic part of the leveling save system set i have it get the players data for the level and now i am just trying to get the admin plugin to increase a players rank
Concommand, with an argument for the player's nickname, gets all players, if they have the nickname then set their level to their level + 1.
Sorry, you need to Log In to post a reply to this thread.