Posted: Fri May 09, 2014 3:25 am Post subject: prefix code tutorial by floo
how to add chat prefix names in the game (for request of punisher) by floo*
there is a little tutorial about what to do into the source to add the prefix names in the game for rocmod of gold
i`m talking to show your rang like this ** clan ** yourname ** referee ** whathever...etc....it`s not hard...
first at all u need to know there are many ways to add this im going to tell u (whoever u are) the most simple and obvious way to add this feature in your server mod...
i assume u already have the source code of this mod and also u know how to compile this....if u dont u can find some videos in youtube where someones teach u how to start....
ok lets start...
just see in the game the only who have a prefix are the spectators and the ghosts looking like this *spec* someone, *ghost*you....its what we want for all...then lets find where its deffined...
check g.cmds of the source exactly in this part G_SayTo
else if ( ghost )
type = "*ghost* ";
else if ( spec )
type = "*spec* ";
then u just need to continue with the same structure just changing this part ( ghost ) .
-next step is find where are the definitions of the clan, visitors, admin, sysop. then lets find this, if u check more down in the same g.cmds u find this Cmd_AdminAdd_f and also how the others rang has ben added, there is the admin:
id_ent->client->sess.modData->adminref = 2; //obviusly we need to remove the id part
here is the referee (Cmd_RefereeMe_f):
ent->client->sess.modData->adminref = 1;
here is the sysop (Cmd_SysopAdd_f):
id_ent->client->sess.modData->adminref = 3; //same, without id
the visitors? they are just clients and this appear in multiple parts there is:
(the clan?...ohhh its other thing....later i tell u...wait first lets add the admin, referee and sysop...)
//continuing below the spec...add...
else if ( ent->client->sess.modData->adminref == 2 ) //we change ghost for the admin def...
type = "*Admin* "; // u can ofcourse change this admin name...u can recall the admins like *spongebob* if u want
else if ( ent->client->sess.modData->adminref == 1 ) //we change ghost for the referee def...
type = "*Referee* ";
else if ( ent->client->sess.modData->adminref == 3 ) //we change ghost for the sysop def...
type = "*Sysop* ";
else if ( ent->client ) //we change ghost for the visitor -clients- def...
type = "*Visitor* ";
else if ( ent->client->sess.modData->clan == 1 && ent->client->sess.modData->adminref < 1 ) //portion of code shared to me by pg mario...this need the extra thing about the adm in suspend
type = "*Clan* ";
//========= thats all u have fun? enjoy! <3 :F ================
then double click in the bat of the game copy past the new qvm in your vm server folder and thats all....
*note: i`m just a curious person about how the games work doing things IM NOT A CODER (i just deduce these things for deduction and logic)...there are other ways how u can add this feature try to find your own way to add this!...just use your imagination...i just show u the easy way...actually im using other way how i find to add this to make more easy to change my prefix when i want ingame....
*note2: if someone who read this decide to use this a little "thanks" or a little credit is allways nice to know ....like i do when anyone help me in something
Last edited by kingsfloo on Sat May 17, 2014 7:40 am; edited 2 times in total
In Game: The Punisher Gender: Joined: May 04, 2012 Last Visit: Nov 01, 2019 Age: 22 Posts: 740
Posted: Sat May 17, 2014 7:42 am Post subject: Re: prefix code tutorial by floo
no problem :)
just a detaill
*note3: this code like i show to u all...have a problem...if u type /adm suspend then u lose your admin prefix....admins in suspend in the prefix back to clan ....also rocmod have the problem of the "admin follow the enemy" then the big part of the servers have his admins in suspend cause the great part of the people think its a unfair advantage.....i let to u (who read this) to find the solution ....love to show the big part of the solution but not the 100% ...muahahahahahhaahahah
Posted: Tue May 27, 2014 1:59 pm Post subject: Re: prefix code tutorial by floo
d_ent->client->sess.modData->adminref = 2; //obviusly we need to remove the id part
as you say remove the id part, lol.
and /adm suspend is working properly for me.
When im Admin and i suspend my admin it goes to Soldier, when i press the button again im leader again.
same when i do suspend and than reconnect it gives me my admin back, and same when im sysop.
and could you also explain how to add a new rank such as Co-Leader.
I tried to figure it out myself by cloning the sysop codes and changing the 3 to 4 and changing sysop command to cldr, but didnt work. >.<
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum