a question for coders

New Member
Joined
May 30, 2002
Messages
35
Best answers
0
first of all i wanna say to harSens good job with making this game...


second..im a HL coder i started 5 months ago and my test mod is pretty good from now....i made my own menus with a little help of forums...but now there is something i wanna add to my mod...thats Flying!!!

i tried a tutourial from CC but it didnt work (got it from a forum)
well i wanna add it like in dmz OR esf like:

press F then you go fly...press F again you go down...i edited the pm_shared.c file ...and added something to const.h
but if i put the stuff in player.cpp and client.cpp in the mp.dll project...there are lots of errors in it......
BTW link to the tut http://coding.valve-erc.com/?area=browse&id=118/1025983986

i realise the last to blocks of code gives errors.....who can help me with adding fly?????

if you can help me...please post it here...and harsens if ya wanna...please PM ur e-mail adress (im dutch so you dont have to write in english to me :D)
 
New Member
Joined
Nov 24, 2001
Messages
692
Best answers
0
From the tutorial:
Heres how you would use it if you wanted a button bound to make you fly or walk (warning this part is not cut and paste! You do need to think a little).
Hmm.... Looks like there actually is a teaching moment in those tutorials :)
 
New Member
Joined
Jan 8, 2002
Messages
807
Best answers
0
its pretty simple... u edit

else if (FStrEq(pcmd, "startfly" ) )
{

if (GetClassPtr((CBasePlayer *)pev)->IsFlying)
{
ALERT ( at_console, "Damn gravity! \n" );
GetClassPtr((CBasePlayer *)pev)->IsFlying = false;
GetClassPtr((CBasePlayer *)pev)->BeginFly();
}
else if (!(GetClassPtr((CBasePlayer *)pev)->IsFlying))
{
if (GetClassPtr((CBasePlayer *)pev)->m_iEP > 1500)
{
GetClassPtr((CBasePlayer *)pev)->pev->velocity.z += 20;
ALERT ( at_console, "Look Im flying! \n" );
GetClassPtr((CBasePlayer *)pev)->IsFlying = true;
GetClassPtr((CBasePlayer *)pev)->BeginFly();
}
else
{
ClientPrint( &pEntity->v, HUD_PRINTCENTER, "Need 1500 EP to fly" );
}
}
}


So That

else if (FStrEq(pcmd, "startfly" ) )
{

if (GetClassPtr((CBasePlayer *)pev)->IsFlying)
{
ALERT ( at_console, "Damn gravity! \n" );
GetClassPtr((CBasePlayer *)pev)->IsFlying = false;
GetClassPtr((CBasePlayer *)pev)->BeginFly();
}


u edit Damn Gravity! to what u want the console command to be when u drop and then

else if (!(GetClassPtr((CBasePlayer *)pev)->IsFlying))
{
if (GetClassPtr((CBasePlayer *)pev)->m_iEP > 1500)
{
GetClassPtr((CBasePlayer *)pev)->pev->velocity.z += 20;
ALERT ( at_console, "Look Im flying! \n" );
GetClassPtr((CBasePlayer *)pev)->IsFlying = true;
GetClassPtr((CBasePlayer *)pev)->BeginFly();
}


u change Look Im Flying! to the console command that u want it to be for flying... also, if (GetClassPtr((CBasePlayer *)pev)->m_iEP > 1500) means if u have less than 1500 of energy or whatever the ****, then u stop flying...

and if you have less than 1500, and u drop, it says

ClientPrint( &pEntity->v, HUD_PRINTCENTER, "Need 1500 EP to fly" );

well if im wrong, tell me, cuz im really tired right now and cant think
:D
 
New Member
Joined
May 30, 2002
Messages
35
Best answers
0
thanks for helping ill try that :)



more suggestions....(if this wont help :D)


BTW...t might fixed it :D


i changed this:

else if (FStrEq(pcmd, "startfly" ) )
{

if (GetClassPtr((CBasePlayer *)pev)->IsFlying)
{
ALERT ( at_console, "Damn gravity! \n" );
GetClassPtr((CBasePlayer *)pev)->IsFlying = false;
GetClassPtr((CBasePlayer *)pev)->BeginFly();
}
else if (!(GetClassPtr((CBasePlayer *)pev)->IsFlying))
{
if (GetClassPtr((CBasePlayer *)pev)->m_iEP > 1500)
{
GetClassPtr((CBasePlayer *)pev)->pev->velocity.z += 20;
ALERT ( at_console, "Look Im flying! \n" );
GetClassPtr((CBasePlayer *)pev)->IsFlying = true;
GetClassPtr((CBasePlayer *)pev)->BeginFly();
}
else
{
ClientPrint( &pEntity->v, HUD_PRINTCENTER, "Need 1500 EP to fly" );
}
}
}


TO THIS:

else if (FStrEq(pcmd, "startfly" ) )
{

if (GetClassPtr((CBasePlayer *)pev)->IsFlying)
{
ALERT ( at_console, "Damn gravity! \n" );
GetClassPtr((CBasePlayer *)pev)->IsFlying = false;
GetClassPtr((CBasePlayer *)pev)->BeginFly();
}
else if (!(GetClassPtr((CBasePlayer *)pev)->IsFlying))
{
GetClassPtr((CBasePlayer *)pev)->pev->velocity.z += 20;
ALERT ( at_console, "Look Im flying! \n" );
GetClassPtr((CBasePlayer *)pev)->IsFlying = true;
GetClassPtr((CBasePlayer *)pev)->BeginFly();
}
}


and now i added the commands to player.h under jump()
and prethink()

void BeginFly();
bool IsFlying;


so it might work now :D
 

Users who are viewing this thread

Top Bottom