PCS Game Hosting
  Forum Index    Search    Usergroups    Edit your profile    Members    Arcade    Ranks

 Reputation    Medals    Staff    Statistics    Board Rules    Forum FAQ    Private MessagesLogin, Check Messages    Log in 

Search for at
Soldier Of Fortune 2 Advanced Search

Post new topicReply to topicprinter-friendly viewThank Post
   Soldier Of Fortune 2 Forum Index » SOF2 Tutorials » SOF2MODDING Advanced tutorial – Editable rank prefixes
 View previous topic :: View next topic  
Author Message

In Game: The Punisher
Gender: Gender:Male
Joined: May 04, 2012
Last Visit: Apr 02, 2020
Age: 22
Posts: 740

Reputation: 4027
votes: 3
Medals: 2 (View more...)
Dedication (Amount: 1)

Status: Offline
PostPosted: Wed Apr 01, 2015 4:44 pm
PostPost subject: No icon SOF2MODDING Advanced tutorial – Editable rank prefixes
Reply with quote

SOF2MODDING Advanced tutorial – Adding Editable rank prefixes Part.1

In this tutorial im gonna show you how to make the rank prefixes editable, in for example your server config.
You should be a little bit familiar with the SDK of SOF2, setup successfully, and followed or atleast have something similar to Floo’s tutorial done.
I’ll be starting after the Tutorial of Floo by making the ranknames into a command line which you can edit in the server config.
I wont be using Images in this tutorial, only code example.

To Summerize Floo’s tutorial:
- Open g_cmd.c.
- Search G_SayTo by pressing ctrl + f in notepad and selecting the “ Search “ tab.
- When you did this you’ll probably see this:

- Scroll down until you see:
else if ( ghost )
   type = "*ghost* ";
else if ( spec )
   type = "*spec* ";

- We will be duplicating this with the other ranks too:
else if ( ghost )
type = “^7*Ghost*”;
else if ( spec )
type = “^7*Spec*”;
else if ( ent->client->sess.modData->adminref == 2 )
type = “^7*Admin*”;
else if ( ent->client->sess.modData->adminref == 1 )
type = “^7*Referee*”;
else if ( ent->client->sess.modData->adminref == 3 )
type = “^7*Sysop*”;

else if ( ent->client )
type = “^7*Visitor*”;
else if ( ent->client->sess.modData->clan == 1 && ent->client->sess.modData->adminref < 1 )
type = “^7*Clan*”;

Here is where you left off at Floo’s tutorial.
Now we will be changing this into a command and make it easier for you without going into the SDK every time.

Step.1   - g_local.h

First we are going to add the command.
I based these codes on the g_message1 command codes, which is an easy way to do it.
When you search for it in g_local.h you’ll find this script:

extern vmCvar_t g_message1;

We will be using the same code but changing “g_message1” into the name you want.
Find some free space in the file. About line 1500 you’ll have some free space.
Just above the description:
//extern vmCvar_t g_anonymousReferee;

I’ll add my ranks which are:

// Rank Prefixes
extern vmCvar_t pref_admin;
extern vmCvar_t pref_ref;
extern vmCvar_t pref_sysop;
extern vmCvar_t pref_coldr;
extern vmCvar_t pref_clan;
extern vmCvar_t pref_spec;
extern vmCvar_t pref_ghost;
extern vmCvar_t pref_visitor;

To be sure I wont have dupli commands I used a command which isn’t in sof2 yet.
Using pref_ for prefixes at the start. You could name this whatever you want but I used it to found it back easily and most commands are g_, cg_, sv_ and such things.

Save g_local.h and you are done in this file.

PART.2 - Editable Rank Prefixes

Website: House of Pain Server - Website
Serverlist: House of Pain Server - Serverlist


Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic printer-friendly viewThank Post
Soldier Of Fortune 2 Forum Index »  SOF2 Tutorials
Page 1 of 1
Jump to:  
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

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts How to make you own mod? 6 Crankedup 5198 Tue Jun 19, 2018 11:00 pm
Punisher View latest post
No new posts SOF2MAPPING Tutorial.2 - Make a room 0 Punisher 2375 Tue Oct 06, 2015 3:16 pm
Punisher View latest post
No new posts To make it more clear to everyone READ PLZ 3 Teo 4583 Thu Nov 28, 2013 8:41 pm
Teo View latest post
No new posts want to make a post :) 6 conviction 5510 Thu Nov 15, 2012 10:08 pm
Lessoe View latest post
No new posts Teo which programs u use for make themes? 1 MacTavishXx 4193 Wed May 02, 2012 5:23 pm
Teo View latest post

Back to Top

SOF2.ORG Multiplayer Community © 2020 All times are UTC + 2 Hours [DST enabled]

Copyright ©