Time, date ?

Discussions about ET modding (sdk code, player/weapon modeling)

Moderators: Forum moderators, developers

User avatar
dutchmeat
Posts: 62
Joined: Tue Jan 28, 2003 8:08 am
Location: Netherlands
Contact:

Time, date ?

Post by dutchmeat »

Hello , i need a code to let the player show the time and date.
can someone help ?
User avatar
ReyalP
Posts: 1663
Joined: Fri Jul 25, 2003 11:44 am

Re: Time, date ?

Post by ReyalP »

dutchmeat wrote:Hello , i need a code to let the player show the time and date.
can someone help ?
look at the /currenttime command that already exists in ET (src/cgame/cg_consolecommands.c) :moo:
send lawyers, guns and money
User avatar
dutchmeat
Posts: 62
Joined: Tue Jan 28, 2003 8:08 am
Location: Netherlands
Contact:

Re: Time, date ?

Post by dutchmeat »

SCDS_reyalP wrote:
dutchmeat wrote:Hello , i need a code to let the player show the time and date.
can someone help ?
look at the /currenttime command that already exists in ET (src/cgame/cg_consolecommands.c) :moo:
Yes ET, i code in rtcw demo... :O

but tnx
uber-noob
Posts: 285
Joined: Sat Dec 20, 2003 2:02 pm
Location: Germany
Contact:

Re: Time, date ?

Post by uber-noob »

dutchmeat wrote: Yes ET, i code in rtcw demo... :O
So why do you ask in the ET Modding forum?
User avatar
dutchmeat
Posts: 62
Joined: Tue Jan 28, 2003 8:08 am
Location: Netherlands
Contact:

Post by dutchmeat »

There Is no RTCW MODDING FORUM :?
User avatar
V6.Sven
Posts: 86
Joined: Fri Jan 23, 2004 10:12 am
Location: Netherlands!

Post by V6.Sven »

dutchmeat wrote:There Is no RTCW MODDING FORUM :?
good point ;)
User avatar
=FF=im2good4u
Posts: 3821
Joined: Wed Feb 05, 2003 7:30 am
Location: The Netherlands, HOLLAND
Contact:

Post by =FF=im2good4u »

yeh he got u there :D
User avatar
dutchmeat
Posts: 62
Joined: Tue Jan 28, 2003 8:08 am
Location: Netherlands
Contact:

Post by dutchmeat »

:oops: :D
Can someone help me out HERE? :S :
this code is in g_combat.c and it does this:
when you hit someone with a bullet (either an enemy , chair or something else) you will get health!...

Code: Select all

// Vampire mod
if (g_vampire.integer)  {

attacker->health = attacker->health + take;
if (attacker->health > 500) {
        attacker->health = 500;

}
}
// end Vampire 
only what I want is simple but i can do it:
just the same as above but it can only be used with KNIFE , so when i have a knife and g_vampire is enabled, i will get health when i stab someone.
can someone help ? tnx
User avatar
ReyalP
Posts: 1663
Joined: Fri Jul 25, 2003 11:44 am

Re: Time, date ?

Post by ReyalP »

dutchmeat wrote: Yes ET, i code in rtcw demo... :O

but tnx
Huh ? there is no public SDK for the RTCW demo, and the EULA restricts making mods for it AFAIK. Secondly, you could still just copy the code from ET. It should work fine as /currenttime was added by OSP for RTCW.

In the second question, look at the mod parameter. MOD is Means Of Death.
send lawyers, guns and money
User avatar
dutchmeat
Posts: 62
Joined: Tue Jan 28, 2003 8:08 am
Location: Netherlands
Contact:

Post by dutchmeat »

yes i already copied the et code... had to change it a little bit though :

Code: Select all

/*
=================
Cmd_currenTime_f
=================
*/

const char *aMonths[12] = {
	"Jan", "Feb", "Mar", "Apr", "May", "Jun",
	"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};

void Cmd_currentTime_f( gentity_t *ent ) {
	qtime_t ct;

	trap_RealTime(&ct);
	G_Printf( "Current time: ^3%02d:%02d:%02d (%02d %s %d)\n", ct.tm_hour, ct.tm_min, ct.tm_sec, ct.tm_mday, aMonths[ct.tm_mon], 1900+ct.tm_year );
}
but about the vampire:
you dont get health when you KILL someone, you get health when you shoot at someone... but thats now with all weapons, for every bulet (rocket,nade...etc) you get health.. and i want it only for KNIFE.
User avatar
fretn
Posts: 341
Joined: Sun Jul 27, 2003 4:35 am
Location: Belgium!

Post by fretn »

add a check if the current weapon is a knife
Day by day : http://w.twwwo.be/
User avatar
ReyalP
Posts: 1663
Joined: Fri Jul 25, 2003 11:44 am

Post by ReyalP »

dutchmeat wrote:and i want it only for KNIFE.
I told you *exactly* what you needed to check, assuming your vampire stuff is in G_Damage (which is the logical place to put it) :?

the mod parameter tells you what weapon was used to inflict the damage. if you look through G_Damage, you should be able to see other weapon specific checks.
send lawyers, guns and money
User avatar
dutchmeat
Posts: 62
Joined: Tue Jan 28, 2003 8:08 am
Location: Netherlands
Contact:

Post by dutchmeat »

fretn wrote:add a check if the current weapon is a knife
yes how ? :?
User avatar
dutchmeat
Posts: 62
Joined: Tue Jan 28, 2003 8:08 am
Location: Netherlands
Contact:

Post by dutchmeat »

finaly i did it :P :D

Code: Select all

// Vampire mod

if (g_vampire.integer){
	if(attacker->s.weapon == WP_KNIFE){

 attacker->health = attacker->health + take;
if (attacker->health > 500) {
        attacker->health = 500;
}
}

}
// end Vampire 

took me a while because of other weapons could also get that health
bacon
Posts: 549
Joined: Sat Apr 19, 2003 9:34 pm
Contact:

Post by bacon »

Very good use of indentation in your code there pal.

Seriously you should mess around with the source if you ever want to do anything worthwhile. A big part of that is doing the coding without any outside help.
Post Reply