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 P2
 View previous topic :: View next topic  
Author Message
Punisher
Administrator
Administrator


In Game: The Punisher
Gender: Gender:Male
Joined: May 04, 2012
Last Visit: Nov 01, 2019
Age: 22
Posts: 740

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

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

SOF2MODDING Advanced tutorial – Adding Editable rank prefixes Part.2

PART.1 - Editable Rank Prefixes
Step.2   - g_main.c

Now we are going to make it a text ( string ) so you can edit it in your cfg as a text between the “ “.
Before we are doing this we will have to do the same thing as we did at the g_local.h file.
On about line 240 theres some free space, add the codes you need there.
Just about: //vmCvar_t g_anonymousReferee;

For me it’s:
// Rank Prefixes
vmCvar_t pref_admin;
vmCvar_t pref_ref;
vmCvar_t pref_sysop;
vmCvar_t pref_coldr;
vmCvar_t pref_clan;
vmCvar_t pref_spec;
vmCvar_t pref_ghost;
vmCvar_t pref_visitor;


When we have done this we need to add the string part. It gives the information that it has to be a text and not a true/false or value.

When you search for g_message1 again you’ll see the following code:
{ &g_message1, "g_message1", "", 0, 0.0f, 0.0f, 0, qfalse },

We are gonna change this for our command.
Copy it and paste it in a open space.
On about line 575 theres some free space for the code for me.

I’m adding the code:
// Admin Prefixes
{ &pref_admin, "pref_admin", "", 0, 0.0f, 0.0f, 0, qfalse },
{ &pref_ref, "pref_ref", "", 0, 0.0f, 0.0f, 0, qfalse },
{ &pref_sysop, "pref_sysop", "", 0, 0.0f, 0.0f, 0, qfalse },
{ &pref_coldr, "pref_coldr", "", 0, 0.0f, 0.0f, 0, qfalse },
{ &pref_clan, "pref_clan", "", 0, 0.0f, 0.0f, 0, qfalse },
{ &pref_spec, "pref_spec", "", 0, 0.0f, 0.0f, 0, qfalse },
{ &pref_ghost, "pref_ghost", "", 0, 0.0f, 0.0f, 0, qfalse },
{ &pref_visitor, "pref_visitor", "", 0, 0.0f, 0.0f, 0, qfalse },


Save g_main.c also and you are done here too.
We only need to add these to the correct rank so it can be changed by cfg.

Step.3   - g_cmds.c

This is the last part we have to do.
Go back to the lines where you left of at Floo’s tutorial.

I’m using the Admin prefixes as an example in this part.

If you did it correct your Admin prefixes will look something like this:
else if ( ent->client->sess.modData->adminref == 2 )
{
type = “^7*Admin*”;
}

As you can see the type = “ Text ”; give you the text you see ingame.
This is the part we are going to edit.
Now use the commands you made, so in my case :

vmCvar_t pref_admin;
vmCvar_t pref_ref;
vmCvar_t pref_sysop;
vmCvar_t pref_coldr;
vmCvar_t pref_clan;
vmCvar_t pref_spec;
vmCvar_t pref_ghost;
vmCvar_t pref_visitor;


and add the commands instead of the “ text “.
So it’ll look something like this:

else if ( ent->client->sess.modData->adminref == 2 )
{
type = pref_admin.string;
}


Repeat it for the other ranks but with the other command names you made.
I ended up with this code:

else if ( ghost )
{
type = pref_ghost.string;
}
else if ( spec )
{
type = pref_spec.string;
}
else if ( ent->client->sess.modData->adminref == 2 )
{
type = pref_admin.string;
}
else if ( ent->client->sess.modData->adminref == 1 )
{
type = pref_ref.string;
}
else if ( ent->client->sess.modData->adminref == 3 )
{
type = pref_sysop.string;
}
else if ( ent->client->sess.modData->adminref == 4 )
{
type = pref_coldr.string;
}
else if ( ent->client )
{
type = pref_visitor.string;
}
else if ( ent->client->sess.modData->clan == 1 && ent->client->sess.modData->adminref <1>client->sess.modData->versionVerified )
{
chat = "achat";
}


Save the g_cmds.c and you are done.
Now you only have to compile it into a .qvm and copy/paste it into your vm folder.

If any errors occurred you probably misspelled a name or deleted a part of a code such as the “ ; “ at the end or didn’t use the same word as you used before.


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

<a><img></a>

<a><img></a>
Back to top
View user's profile Send private message
Sponsor
Smiley face
Punisher
Administrator
Administrator


In Game: The Punisher
Gender: Gender:Male
Joined: May 04, 2012
Last Visit: Nov 01, 2019
Age: 22
Posts: 740

Netherlands.png 
Reputation: 4027
votes: 3
Medals: 2 (View more...)
Distinguished Uploader (Amount: 1)

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

I Hope you guys understood what i was explaining.
Give me some feedback, or tips.
Such as better technique or something about my writing / explaining style. etc...

Upcoming Tutorial:
Adding a new rank.


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

<a><img></a>

<a><img></a>
Back to top
View user's profile Send private message
abdouraoui
Pro Poster
Pro Poster



Joined: Aug 23, 2013
Last Visit: Sep 05, 2018
Posts: 21


Reputation: 43.9
Medals: None

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

it's doesn't work for me :/
look what I see
Back to top
View user's profile Send private message
Punisher
Administrator
Administrator


In Game: The Punisher
Gender: Gender:Male
Joined: May 04, 2012
Last Visit: Nov 01, 2019
Age: 22
Posts: 740

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

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

give me line 1853 of g_cmd.c please, Thats the line which gives you an error.

Also compile with the game.bat in your code folder not in your game folder.
for me the one in the game folder gives errors or just wont work, while the game.bat in my code folder compiles properly.


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

<a><img></a>

<a><img></a>
Back to top
View user's profile Send private message
Sponsor
abdouraoui
Pro Poster
Pro Poster



Joined: Aug 23, 2013
Last Visit: Sep 05, 2018
Posts: 21


Reputation: 43.9
Medals: None

Status: Offline
PostPosted: Thu Apr 02, 2015 3:13 pm
PostPost subject: No icon Re: SOF2MODDING Advanced tutorial – Editable rank prefixes
Reply with quote

the line 1853 is:
else if ( ent->client->sess.modData->clan == 1 && ent->client->sess.modData->adminref <1>client->sess.modData->versionVerified )
Back to top
View user's profile Send private message
Punisher
Administrator
Administrator


In Game: The Punisher
Gender: Gender:Male
Joined: May 04, 2012
Last Visit: Nov 01, 2019
Age: 22
Posts: 740

Netherlands.png 
Reputation: 4027
votes: 3
Medals: 2 (View more...)
Distinguished Uploader (Amount: 1)

Status: Offline
PostPosted: Thu Apr 02, 2015 3:43 pm
PostPost subject: No icon Re: SOF2MODDING Advanced tutorial – Editable rank prefixes
Reply with quote

It's the clan prefix right?

If yes, it should be:
ent->client->sess.modData->clan == 1 && ent->client->sess.modData->adminref <1>client->sess.modData->versionVerified

Shouldnt be anywhere near there, only the line:
if ( g_voiceCommandsEnabled.integer == 1 && sv_modClient.integer || other->client->sess.modData->versionVerified )
{
trap_SendServerCommand( other-g_entities, va("sound %i \"%s\"", ent->client->sess.team, sound));
}


for me on line 1856 contains that part of the code.

So if the lines above and under it are like this:

type = pref_visitor.string;
}
else if ( ent->client->sess.modData->clan == 1 && ent->client->sess.modData->adminref <1>client->sess.modData->versionVerified )
{
type = pref_clan.string;
}


Then you should change:

ent->client->sess.modData->clan == 1 && ent->client->sess.modData->adminref <1>client->sess.modData->versionVerified


to:
ent->client->sess.modData->clan == 1 && ent->client->sess.modData->adminref < 1

Try that and compile again, dunno if it'll work tho bu that part doesnt belong there.


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

<a><img></a>

<a><img></a>
Back to top
View user's profile Send private message
abdouraoui
Pro Poster
Pro Poster



Joined: Aug 23, 2013
Last Visit: Sep 05, 2018
Posts: 21


Reputation: 43.9
Medals: None

Status: Offline
PostPosted: Thu Apr 02, 2015 4:35 pm
PostPost subject: No icon Re: SOF2MODDING Advanced tutorial – Editable rank prefixes
Reply with quote

yeah it's work but when i compiled it i don't found file sof2mp_game.qvm in folder vm
Back to top
View user's profile Send private message
Punisher
Administrator
Administrator


In Game: The Punisher
Gender: Gender:Male
Joined: May 04, 2012
Last Visit: Nov 01, 2019
Age: 22
Posts: 740

Netherlands.png 
Reputation: 4027
votes: 3
Medals: 2 (View more...)
Distinguished Uploader (Amount: 1)

Status: Offline
PostPosted: Thu Apr 02, 2015 4:51 pm
PostPost subject: No icon Re: SOF2MODDING Advanced tutorial – Editable rank prefixes
Reply with quote

use the game.bat in your CODE folder not in your GAME folder, same is when your editing in cgame folder you have to use the CGAMe.bat in your CODE folder.

Also be sure you have edited the paths in your .bat

so for Rocmod2.1c game.bat in your code folder you'll get this code:
Change the colored parts in your game.bat to the path you have your SDK installed to.
Also be sure there arent any errors.
Hidden: 

@ECHO OFF

if not "%nocount%" == "1" call buildcounter.bat

@set include=

@cd game

del /q vm
mkdir vm
cd vm
set cc=C:\SoF2SDK\bin\sof2lcc -A -DQ3_VM -DROCMOD_BUILD=%buildcount% -DMISSIONPACK -S -Wf-target=bytecode -Wf-g -I..\..\cgame -I..\..\game -I..\..\ui %1

echo ---------------------------------

%cc%  ../g_main.c
@if errorlevel 1 goto quit

%cc%  ../g_syscalls.c
@if errorlevel 1 goto quit

%cc%  ../bg_misc.c
@if errorlevel 1 goto quit
%cc%  ../bg_lib.c
@if errorlevel 1 goto quit
%cc%  ../bg_pmove.c
@if errorlevel 1 goto quit
%cc%  ../bg_slidemove.c
@if errorlevel 1 goto quit
%cc%  ../bg_player.c
@if errorlevel 1 goto quit
%cc%  ../bg_weapons.c
@if errorlevel 1 goto quit
%cc%  ../bg_gametype.c
@if errorlevel 1 goto quit
%cc%  ../q_math.c
@if errorlevel 1 goto quit
%cc%  ../q_shared.c
@if errorlevel 1 goto quit

%cc%  ../ai_main.c
@if errorlevel 1 goto quit
%cc%  ../ai_util.c
@if errorlevel 1 goto quit
%cc%  ../ai_wpnav.c
@if errorlevel 1 goto quit

%cc%  ../g_active.c
@if errorlevel 1 goto quit
%cc%  ../g_antilag.c
@if errorlevel 1 goto quit
%cc%  ../g_bot.c
@if errorlevel 1 goto quit
%cc%  ../g_client.c
@if errorlevel 1 goto quit
%cc%  ../g_cmds.c
@if errorlevel 1 goto quit
%cc%  ../g_combat.c
@if errorlevel 1 goto quit
%cc%  ../g_gametype.c
@if errorlevel 1 goto quit
%cc%  ../g_items.c
@if errorlevel 1 goto quit
%cc%  ../g_misc.c
@if errorlevel 1 goto quit
%cc%  ../g_missile.c
@if errorlevel 1 goto quit
%cc%  ../g_mover.c
@if errorlevel 1 goto quit
%cc%  ../g_session.c
@if errorlevel 1 goto quit
%cc%  ../g_spawn.c
@if errorlevel 1 goto quit
%cc%  ../g_svcmds.c
@if errorlevel 1 goto quit
%cc%  ../g_target.c
@if errorlevel 1 goto quit
%cc%  ../g_team.c
@if errorlevel 1 goto quit
%cc%  ../g_trigger.c
@if errorlevel 1 goto quit
%cc%  ../g_utils.c
@if errorlevel 1 goto quit
%cc%  ../g_weapon.c
@if errorlevel 1 goto quit

%cc%  ../g_admin.c
@if errorlevel 1 goto quit
%cc%  ../g_admincmds.c
@if errorlevel 1 goto quit

echo ---------------------------------

C:\SoF2SDK\bin\sof2asm -f ../game
@if errorlevel 1 goto quit

mkdir "..\..\..\base\vm"
copy *.map "..\..\..\base\vm"
copy *.qvm "..\..\..\base\vm"
copy *.qvm "..\..\..\packages\ROCmod-xxxx-server\rocmod\vm"

:quit
@cd ..
@cd ..


Also be sure you got something similar to this:


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

<a><img></a>

<a><img></a>
Back to top
View user's profile Send private message
Sponsor
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 4871 Tue Jun 19, 2018 11:00 pm
Punisher View latest post
No new posts SOF2MAPPING Tutorial.2 - Make a room 0 Punisher 2201 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 4287 Thu Nov 28, 2013 8:41 pm
Teo View latest post
No new posts want to make a post :) 6 conviction 5146 Thu Nov 15, 2012 10:08 pm
Lessoe View latest post
No new posts Teo which programs u use for make themes? 1 MacTavishXx 4012 Wed May 02, 2012 5:23 pm
Teo View latest post
 




Back to Top

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

Copyright ©