TUTORIAL: Allow black names (includes adding a cvar)
Apparently people like me writing tutorials, so here's another one. o_o
What you will achieve
The purpose of this modification is to allow players to use a black color in their name.
Before we get started
I would like to point out, we will be adding a new cvar to the game.
Cvars are basically pairs of 'key' and 'value'. An example is 'fraglimit'
Key: fraglimit, Value: x
So typing '/fraglimit 60' will set the fraglimit to 60.
You can use cvars for all sorts of things, as you will see.
- g_client.c (game)
- g_main.c (game)
Open up g_client.c and search for the 'ClientCleanName' function
Before that function begins, we want to make sure it knows about our cvar we're going to create
Insert the following code before that function:
There's already a part in ClientCleanName that checks for what colors are used, so we're just going to attach a check for our cvar there.
From here on all we're doing is making the cvar work.
Open up g_main.c and scroll down a little bit to find a rather large list that looks like this.
Just add the following code after 'g_showDuelHealths;'
Now all we have to do is add our new cvar to the actual cvar table
Scroll down and you'll see a bunch of stuff like:
Just add the following code after that:
Now you can compile your code, and try it out!
type /name "^0My Black Name" to use black in your name.
To change whether or not clients can use black in their name, use 'g_allowBlackNames' as a key, and '0' or '1' as a value. (0 = don't allow, 1 = allow)
There are no bugs that I have discovered.
Feel free to contact me about any bugs/glitches/etc
but then the server crashes for some reason after the second kill.
This is for basejka, only thing i can think of is i AM using NeWaGe's sdk fix.
But as i remember i did do another mod prior to this "FunMod" and worked fine.
So i'm not quite sure.
But since i added this the server crashed twice which is a kind of a shame.
See if anything is found,
Edit: Nevermind, fixed it, my own error on another code lol
|All times are GMT -4. The time now is 04:01 AM.|
Powered by vBulletin®
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.
LFNetwork, LLC ©2002-2015 - All rights reserved.