Help For Levels

How should players be gaining xp? by drugs, kills, and money prints
Will the levels actually affect anything? yes, jobs will be all leveld to stop abuse and maybe if its possible weapons drugs and entities
Do you need your players to have several stats? no, i just want a level system… i dont want it to store kills ect
What kind of HUDs are you going to need? just a bar at the top like this:

and then the level at the side

If Anyone Could Help :slight_smile:
By The Way… I Edited

Well first you’ll have to make it clear to both us and yourself what it is you want, and therefore what you’re going to need.

How should players be gaining xp?
Will the levels actually affect anything?
Do you need your players to have several stats?
What kind of HUDs are you going to need?

Once that’s done and you know exactly what you need it will be a lot easier for you to start making progress.

Sorry that this is off topic, but what is your ordeal with this guy? Personal grudge?

:raise:

Also please put some more effort into your thread, this is a gentlemens place:eng101:

This.

Also, I might be able to both benefit from and help with this, as I know a bit (a TINY bit) about lua.

no. he keeps posting on every thread i see :@ and every thread i do. thanks for that crazy quebec tho. will do it

[editline]10:36PM[/editline]

ya. sry

[editline]10:47PM[/editline]

How should players be gaining xp? by drugs, kills, and money prints
Will the levels actually affect anything? yes, jobs will be all leveld to stop abuse and maybe if its possible weapons drugs and entities
Do you need your players to have several stats? no, i just want a level system… i dont want it to store kills ect
What kind of HUDs are you going to need? just a bar at the top like this:

and then the level at the side

Manolis, i’ve posted in one of your threads, i’m sorry if I pissed you off in some way.

But to do levels you will need an SQL Database, it’s a long thing to explain, and the tutorial series explains it much better than I could.
Part 1
Part 2
Part 3

Then to actually give them EXP, you’d need to define it in clientside, so you’d do if statements for when certain things happen they get exp. If you did set up the SQL correctly, then adding EXP is a peice of cake:

[lua]if thisandthathappens then
LocalPlayer():SetNWInt(“exp”, LocalPlayer():GetNWInt(“exp”) + exptoaddhere )
end[/lua]Add a hook if needed to complete the code, but that would go inside a function.

As for the HUD, that’s pretty simple, just use
**[Surface.DrawRect

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Surface.DrawRect)**
**[Draw.Text

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Draw.Text)**

To draw the bars and the text to go on it.

How do I save my client’s xp?
Saving and loading

  • Functions : **[Player.SetPData

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Player.SetPData)**, **[Player.GetPData

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Player.GetPData)**

  • You should only have to load the data once a player joins the game, you can store the value serverside while the player is connected for easy reference. (example : player.Xp)

How do I tell the client how much XP he has?
Server to client networking

  • Tutorial : **[User Messages

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=User Messages)**

How should players be gaining xp?
By drugs and money prints.

  • You will need to modify the drug making and money printing entities to give the player who spawned them some xp.

With kills.

  • Hook : **[Gamemode.PlayerDeath

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.PlayerDeath)**

Will the levels actually affect anything?
Jobs will be all have a level requirement.

  • You will have to change the way the game decides if a player can join a team or not, there are several ways to do this and most require you to change a gamemode’s file.

weapons drugs and entities

  • Same thing.

What kind of HUDs are you going to need?
Just a bar at the top and the level at the side.

  • Hook : **[Gamemode.HUDPaint

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.HUDPaint)** <-- All of your drawing must be done in this.

  • Libraries : **[Draw

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Draw)**, **[Surface

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Surface)** <-- To do the actual drawing.

Hooks, what are they?

  • See this : **[Hook.Add

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Hook.Add)**

[:science:

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/)

Fuck, Crazy Quebec just fucked over my post D:

Also if I were you I would start with getting the very basic functions working, that is saving and loading Xp. Once that is done the rest is just icing on the cake.

[editline]07:13PM[/editline]

Usually I would be against using Networked Variables but in that case it could be good, if you want other clients to know what level the others are. The networked variable could easilly take care of all of the networking for you.

On the other hand if you want to make it so that a given client can only know his own XP then you’ll have to go with usermessages, which are just as easy to use once setup properly.

**[Entity.SetNetworkedInt

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Entity.SetNetworkedInt)**

[editline]07:15PM[/editline]

HeavyMtl123 also mentioned using the SQL library which is in my eyes better then SetPData, it’s just harder to setup. But once it’s done it will be more efficient.
**[sql

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=sql)**

you guys are great! and sry heavymtl but every post i see you have reply’d BUT i wont say anything else about this

Fair do’s.

Also, apologies if I was mean, sometimes i’m in a bad mood, just don’t sweat it :3: