Hello again guys. I'm adding various features to the game, so far I added a body damage hud.
This time, I'm going to add a new feature, namely a parachute. I got this from an old tutorial for HL SDK and I want to carry it over to XashXT. I got some of the problems fixed, now the part that boggled me which brings up the question.
E:\Applications\Xash Source Code\Nikki\server\player.cpp(1392) : error C2666: '-' : 3 overloads have similar conversions
The code has something to do with the long velocity check: GetClassPtr((CBasePlayer *)pev)->pev->velocity = GetClassPtr((CBasePlayer *)pev)->pev->velocity - 100;
I tried to find solutions online, but there's none that helped me. I don't know if you guys can help about this. If you can, I'll truly appreciate that.
If it does matter, I used VC++ 6.0 Standard with no service packs installed for it.
Is a piece of shit in this code, i think. You don't need for this.
C++ Source Code:
1
void CBasePlayer::ParaGlide( void )
2
{
3
if (!m_fParachute)
4
{
5
EMIT_SOUND( "common/wpn_denyselect.wav" );
6
return;
7
}
8
9
if (m_fParaOpen)
10
{
11
m_flFallVelocity = 50;
12
pev->velocity = pev->velocity - 100;
13
}
14
}
And next: pev->velocity is a vector. You cannot substract any constant values from it. You can substract values from the components of pev->velocity, such as pev->velocity.x, pev->velocity.y and pev->velocity.z:
Ku2zoff, Well, I didn't see that before. I just realized that I'm branching already to CBasePlayer, so there's no need to point. Thanks for the advice. BTW, can I go PM you whenever I have problems codewise?
I also want to ask if there's a way to make hud messages within CBasePlayer or any code for that matter too? I was originally intending to use a hud message if the player doesn't have a chute.
Thanks for the reply guys! I'll check this code now.
BTW,Дядя Миша , is there a rename the first post as solved?
Hey guys, I got the thing working! It took me last night and today to fix the code after Ku2zoff's fix.
I got a problem with the chute's speed. It keeps on killing me, but I modified the velocity to be halfed by 3/4 and it worked! And I implemented a fully working chute. Just a little modification to the code again to add some sprites whenever the parachute is in effect and when the player picks it up.
Here's another thing that I want to ask. This is for whenever I land on the ground with the parachute on, the parachute is still active.
What part in jump would I place the m_fParaOpen = FALSE parameter in the player.cpp? The jump is kind of convoluted and I don't know where to place.
Thanks again guys!
Добавлено 12-05-2014 в 14:30:
Yeah, i got my own attempt at it in jump, but still doesn't work. I don't have a clue where to put it.
Anyhow, I also want to know aside from disabling the parachute once the player lands on the ground, is there also a way to disable the use of the parachute while still in the ground as well? I know it has something to do with the PlayerUse function as well, since I used it as a trigger for the chute.
Sorry for this one, the edit post was disabled for my post.