Jump to content

Tournament Mod Help


Recommended Posts

Hello, I'm really bad at modding  xP

This is for jk2 btw >.<

 

Q1: is it possible to make text that is displayed on a timer and if so can you help me?

EX: Every 10mins, "I hope you are enjoying your stay" is displayed

 

Q2: Does anyone know the code for stats after a duel (health/shield)

 

Q3: Does anyone know the code to make broadcasting messages easier (amsay all/dcsay all)

EX: /amsay all Welcome to the Server:D

 

 

Thank you :D

Link to comment

Code for Q2:

In g_active.c, in the ClientThink_real function, search for:

 

trap_SendServerCommand( -1, va("cp \"%s %s %s!\n\"", ent->client->pers.netname, G_GetStripEdString("SVINGAME", "PLDUELWINNER"), duelAgainst->client->pers.netname) );

and replace it with

trap_SendServerCommand( -1, va("cp \"%s %s %s with %i health and %i shields remaining!\n\"", ent->client->pers.netname, G_GetStripEdString("SVINGAME", "PLDUELWINNER"), duelAgainst->client->pers.netname, ent->client->ps.stats[STAT_HEALTH], ent->client->ps.stats[STAT_ARMOR]) );

Edit: Looking at the code again, it looks like you need to move the above line so it's before this piece of code:

if (ent->health < ent->client->ps.stats[STAT_MAX_HEALTH])
{
ent->client->ps.stats[STAT_HEALTH] = ent->health = ent->client->ps.stats[STAT_MAX_HEALTH];
}

otherwise it'll just print that the winner won with full health remaining.

 

Code for Q3:

I think this is a combination of JK3 ClanMod and some OJP code that I use a variation of in my JK3 mod, but it should work fine in JK2:

http://pastebin.com/CGXBMWPh

 

If I figure out Q1, I'll update this post.

 
Link to comment

i cant seem to get Q2 to work >.<

trap_SendServerCommand( -1, va("cp \"%s %s %s with %i health and %i shields remaining!\n\"", ent->client->pers.netname, G_GetStripEdString("SVINGAME", "PLDUELWINNER"), duelAgainst->client->pers.netname, ent->client->ps.stats[STAT_HEALTH], ent->client->ps.stats[STAT_ARMOR]) );

if (ent->health < ent->client->ps.stats[STAT_MAX_HEALTH])
{
ent->client->ps.stats[STAT_HEALTH] = ent->health = ent->client->ps.stats[STAT_MAX_HEALTH];
}

how was it suppose to be set up?

 

and i do have probably an easier question, how do you start a duel with 100/100 health

 

I've gotten as far as

ent->client->ps.stats[STAT_HEALTH = 100];
ent->client->ps.stats[STAT_ARMOR] = 100;

duelAgainst->client->ps.stats[STAT_HEALTH] = 100;
duelAgainst->client->ps.stats[STAT_ARMOR] = 100;

 

but for some reason the health doesnt go to 100 only the armor does >.<

 

Link to comment
if (ent->health > 0 && ent->client->ps.stats[STAT_HEALTH] > 0)
 {
          ent->client->ps.stats[STAT_HEALTH] = ent->health = ent->client->health;
           ent->client->ps.stats[STAT_ARMOR] = ent->client->armor;
{

I came up with this for the starting player health, but im not sure how to quit put it in with the rest of the code >.<

Link to comment

Ok i finally figured everything out

 

K so the codes i had were alllmost  right

Both went into g_active.c i was just missing the ent->health = 100 (reason was because  all ent's have health so you have to set it that way)

ent->client->ps.stats[sTAT_HEALTH] = ent->health = 100;
ent->client->ps.stats[sTAT_ARMOR] = 100;          

 

duelAgainst->client->ps.stats[sTAT_HEALTH] = duelAgainst->health = 100;  (same down here but change ent to duelAgainst because the challengie needs health too)

duelAgainst->client->ps.stats[sTAT_ARMOR] = 100;

 

 

Also

trap_SendServerCommand( -1, va("cp \"%s %s %s with %i health and %i shields remaining!\n\"", ent->client->pers.netname, G_GetStripEdString("SVINGAME", "PLDUELWINNER"), duelAgainst->client->pers.netname, ent->client->ps.stats[STAT_HEALTH], ent->client->ps.stats[STAT_ARMOR]) );

The code needed some changes "cp" changed to "print" because the messages was getting pushed off to the side and couldn't bee seen "%i" was also changed to "%d" because  that is how health and armor is shown, this code also had to moved up before the player was given health for winning the  duel or  else the message would display the new health of the player rather then the end of duel health (100/100 instead of 20/0 or what ever)

 

Thank you guys for your help :D lead me on the right path, thank you

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...