Raised This Month: $ Target: $400
 0% 

Flags question....


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Batman/Gorlag
Senior Member
Join Date: Aug 2005
Old 09-10-2005 , 04:05   Flags question....
Reply With Quote #1

Alright just one question, if you set the player flag, meaning you, from FL_ONGROUND to FL_SWIM, and then you started moving, would you be moving as if you were swimming?

P.S. Alright if you registered a cvar, where would you paste the cvar information? In amxx.cfg?
__________________
GRR If only the amxmod programming were in Java.....
Java and C used to be two different languages, now Java is turning into another C. My logevent plugin
Batman/Gorlag is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 09-10-2005 , 07:05  
Reply With Quote #2

1) i dont think so, only if the player is not touching the ground

2) huh?
Code:
native register_cvar(const name[],const string[],flags = 0,Float:fvalue = 0.0);
__________________
plop
p3tsin is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 09-10-2005 , 11:21  
Reply With Quote #3

1) Yes it would you move as you were swimming..

2) You could post the cvar anywhere a file was executed( well not anywhere) either amxx.cfg or server.cfg, or you could create your own .cfg and tell the plugin to execute it....
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Batman/Gorlag
Senior Member
Join Date: Aug 2005
Old 09-10-2005 , 15:18  
Reply With Quote #4

Hmm....okay one more question, if you also set the flag to FL_INWATER could you move up and down as if you were in water?
__________________
GRR If only the amxmod programming were in Java.....
Java and C used to be two different languages, now Java is turning into another C. My logevent plugin
Batman/Gorlag is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 09-10-2005 , 15:44  
Reply With Quote #5

pm_shared.c handles your movement if I'm not mistaken, and it doesn't use FL_INWATER at all. It uses waterlevel and watertype. Also, in certain parts it uses PointContents to see if you're in water. Your best bet is to try this every prethink or postthink (I'm not sure which):

Code:
entity_set_int(id,EV_INT_waterlevel,3); // fully submerged entity_set_int(id,EV_INT_watertype,CONTENTS_WATER); // I'm in water, not acid or something

NOTE: This may make you drown.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Batman/Gorlag
Senior Member
Join Date: Aug 2005
Old 09-10-2005 , 17:50  
Reply With Quote #6

Oh really, cause I thought I would have to rewrite the whole movement functions if you moved in the air....Here's my coding so far. BTW: My left and right button doesn't work. And you can ignore the whole movetype fly stuff as well, I didn't bother erasing it yet that's why it's still there lol.

EDIT: I changed the buttons to moveleft and moveright, I'm gonna see if this works now....

Code:
public client_PreThink(id) {     new Float:maxSpeed = 1000, Float:walkSpeed = 350     new Float:fVelocity[3], Float:v_angles[3]     new flag = entity_get_int(id, EV_INT_flags)     if(isFlyModeEnabled == true && is_user_alive(id)){         if(get_user_button(id) == IN_JUMP){             if(flag & FL_ONGROUND){                 entity_set_int(id, EV_INT_flags, FL_INWATER)             }         }         if(!(flag & FL_ONGROUND)){                          if(get_user_button(id) == IN_FORWARD){                 velocity_by_aim(id, maxSpeed, fVelocity)                 entity_set_vector(id, EV_VEC_velocity, fVelocity)             }             if(get_user_button(id) == IN_BACK){                 velocity_by_aim(id, maxSpeed, fVelocity)                 fVelocity[0] -= fVelocity[0]*2.0                 fVelocity[1] -= fVelocity[1]*2.0                 fVelocity[2] -= fVelocity[2]*2.0                 entity_set_vector(id, EV_VEC_velocity, fVelocity)             }             if(get_user_button(id) == IN_LEFT){                 entity_get_vector(id, EV_VEC_v_angle, v_angles)                 v_angles[0] += 90.0                 v_angles[1] += 90.0                 fVelocity[0] = floatcos(v_angles[1], degrees) * maxSpeed                 fVelocity[1] = floatsin(v_angles[1], degrees) * maxSpeed                 fVelocity[2] = 0.0                 entity_set_vector(id, EV_VEC_velocity, fVelocity)             }             if(get_user_button(id) == IN_RIGHT){                 entity_get_vector(id, EV_VEC_v_angle, v_angles)                 v_angles[0] += 270.0                 v_angles[1] += 270.0                 fVelocity[0] = floatcos(v_angles[1], degrees) * maxSpeed                 fVelocity[1] = floatsin(v_angles[1], degrees) * maxSpeed                 fVelocity[2] = 0.0                 entity_set_vector(id, EV_VEC_velocity, fVelocity)             }             if(flag & FL_FLY){                 client_print(0, print_chat, "You are flying!")             }             else if(flag & FL_SWIM){                 client_print(0, print_chat, "You are swimming!")             }             else{                 client_print(0, print_chat, "You are doing something else!")             }         }         if(flag & FL_ONGROUND){             if(flag & FL_INWATER){                 entity_set_int(id, EV_INT_movetype, MOVETYPE_WALK)                 set_user_maxspeed(id, walkSpeed)             }         }     }     if(!isFlyModeEnabled && is_user_alive(id)){         if(entity_get_int(id, EV_INT_movetype) == MOVETYPE_FLY){             entity_set_int(id, EV_INT_movetype, MOVETYPE_WALK)             set_user_maxspeed(id, walkSpeed)         }     }     //entity_set_float(id, EV_FL_nextthink, 0.001) }

Now my question is, if I implement your code, I wouldn't have to mess around with the movement buttons right (like what you see above)?
__________________
GRR If only the amxmod programming were in Java.....
Java and C used to be two different languages, now Java is turning into another C. My logevent plugin
Batman/Gorlag is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 09-10-2005 , 20:35  
Reply With Quote #7

I don't know, I've never tried.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Batman/Gorlag
Senior Member
Join Date: Aug 2005
Old 09-11-2005 , 02:27  
Reply With Quote #8

Okay, well I tested out my prethink method, and I can go forwards or backwards in the air, but I can't seem to move left or right. I was wondering if there was something wrong with my coding and also if I push any other buttons like the attack button, I just stand still could someone help me out on this:

Code:
public client_PreThink(id) {     new Float:maxSpeed = 1000     new Float:fVelocity[3], Float:v_angles[3]     new flag = entity_get_int(id, EV_INT_flags)     if(isFlyModeEnabled && is_user_alive(id)){         if(!(flag & FL_ONGROUND)){                          if(get_user_button(id) == IN_FORWARD){                 velocity_by_aim(id, maxSpeed, fVelocity)                 entity_set_vector(id, EV_VEC_velocity, fVelocity)             }             else if(get_user_button(id) == IN_BACK){                 velocity_by_aim(id, maxSpeed, fVelocity)                 fVelocity[0] -= fVelocity[0]*2.0                 fVelocity[1] -= fVelocity[1]*2.0                 fVelocity[2] -= fVelocity[2]*2.0                 entity_set_vector(id, EV_VEC_velocity, fVelocity)             }             else if(get_user_oldbutton(id) == IN_FORWARD && get_user_button(id) == IN_ATTACK){                 velocity_by_aim(id, maxSpeed, fVelocity)                 entity_set_vector(id, EV_VEC_velocity, fVelocity)             }             else if(get_user_oldbutton(id) == IN_FORWARD && get_user_button(id) == IN_ATTACK2){                 velocity_by_aim(id, maxSpeed, fVelocity)                 entity_set_vector(id, EV_VEC_velocity, fVelocity)             }             else if(get_user_oldbutton(id) == IN_BACK && get_user_button(id) == IN_ATTACK){                 velocity_by_aim(id, maxSpeed, fVelocity)                 fVelocity[0] -= fVelocity[0]*2.0                 fVelocity[1] -= fVelocity[1]*2.0                 fVelocity[2] -= fVelocity[2]*2.0                 entity_set_vector(id, EV_VEC_velocity, fVelocity)             }             else if(get_user_oldbutton(id) == IN_BACK && get_user_button(id) == IN_ATTACK2){                 velocity_by_aim(id, maxSpeed, fVelocity)                 fVelocity[0] -= fVelocity[0]*2.0                 fVelocity[1] -= fVelocity[1]*2.0                 fVelocity[2] -= fVelocity[2]*2.0                 entity_set_vector(id, EV_VEC_velocity, fVelocity)             }             else if(get_user_button(id) == IN_MOVELEFT){                 entity_get_vector(id, EV_VEC_v_angle, v_angles)                 v_angles[0] += 90.0                 v_angles[1] += 90.0                 fVelocity[0] = floatcos(v_angles[1], degrees) * maxSpeed                 fVelocity[1] = floatsin(v_angles[1], degrees) * maxSpeed                 fVelocity[2] = floatsin(-v_angles[0], degrees) * maxSpeed                 entity_set_vector(id, EV_VEC_velocity, fVelocity)             }             else if(get_user_button(id) == IN_MOVERIGHT){                 entity_get_vector(id, EV_VEC_v_angle, v_angles)                 v_angles[0] += 270.0                 v_angles[1] += 270.0                 fVelocity[0] = floatcos(v_angles[1], degrees) * maxSpeed                 fVelocity[1] = floatsin(v_angles[1], degrees) * maxSpeed                 fVelocity[2] = floatsin(-v_angles[0], degrees) * maxSpeed                 entity_set_vector(id, EV_VEC_velocity, fVelocity)             }             else{                 fVelocity[0] = 0.0                 fVelocity[1] = 0.0                 fVelocity[2] = 1.0                 entity_set_vector(id, EV_VEC_velocity, fVelocity)             }         }     } }
__________________
GRR If only the amxmod programming were in Java.....
Java and C used to be two different languages, now Java is turning into another C. My logevent plugin
Batman/Gorlag is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 09-11-2005 , 02:49  
Reply With Quote #9

i thin its IN_LEFT/RIGHT but might be wrong
Freecode is offline
Batman/Gorlag
Senior Member
Join Date: Aug 2005
Old 09-11-2005 , 02:52  
Reply With Quote #10

Actually I have tried LEFT and RIGHT and it didn't work, the LEFT and RIGHT button I found out was just for turning, MOVELEFT and MOVERIGHT is what actually makes you move left and right. And I gave more info in my previous post, cause I'm thinking it's that else statement that's causing me to stand still if I fire a weapon. I'm not sure though...

EDIT: ALright I'm feeling proud of myself, no one helped me on this, but I fixed the whole firing weapon part while not moving in the air, so you can move again. Took a while for me to figure out though. Now all I got to worry about is the left and right operations.
__________________
GRR If only the amxmod programming were in Java.....
Java and C used to be two different languages, now Java is turning into another C. My logevent plugin
Batman/Gorlag is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode