AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   3 questions. (https://forums.alliedmods.net/showthread.php?t=20144)

LynX 11-02-2005 13:51

3 questions.
 
1. I need to do a function the moment player hits water. How can I do that ?
2. Is there a way to set rendering mode on all water on map ( set_rendering or smthing ).
3. Let's say I have player in air flying. I need to find out his origin as he wasn't flying ( ground ). I just want to find out ground origin of him, that its exactly ground, not few feet down of ground, etc.

Thanks.

Zenith77 11-02-2005 13:55

1.


Code:
new bool:isinWater[id] public client_PreThink(id) {   new flags = get_user_flags(id)   if( (flags &FL_INWATER) && !isinWater[id]) { // make sure we only execute the function once!              isinWaTer[id]  = true                    myFunc() // execute the function    }    if( !(flags  &FL_INWATER) ) {          isinWater[id] = false     } }

2. Dont know

3.

Code:
new iOrigin[3] get_user_origin(id, iOrigin, 0) origin[1] -= origin [1]

LynX 11-02-2005 14:10

1. Ok, thanks.

2. Anybody?

3. I just need origin on GROUND. Not on all the way to ground >.<

Zenith77 11-02-2005 14:19

Quote:

3. I just need origin on GROUND. Not on all the way to ground >.<

huh?

LynX 11-02-2005 14:25

[img]http://img328.**************/img328/4162/newacdsee60bmpimage1mo.jpg[/img]

I need to know just origin on ground, that I spawn something on it.

v3x 11-02-2005 15:02

Code:
new origin1[3]; get_user_origin(id,origin1); new origin2[3]; origin2[0] = origin1[0]; origin2[1] = origin1[1]; origin2[2] = origin1[2] + 20;
Use origin2

LynX 11-02-2005 15:25

Thanks v3x. I'm gonna try.

Btw, second question. Anybody knows how to do stuff on water? I mean, water is entity so I should be able to render it and such.
If its possible please gimme a snippet.

XxAvalanchexX 11-02-2005 18:10

Just spawn something at the player's origin and use drop_to_floor

LynX 11-03-2005 04:26

I think that is better idea then v3x, I'm gonna use it.

Anyone to help with water ( how can I use set_rendering on water ? )

Hawk552 11-03-2005 07:52

Code:
new ent; while((ent = find_ent_by_class(ent,"func_water")) != 0) // forgot if it's func water or not {     set_rendering(whatever); }

If it's not that, then I think it's just a func_wall with solid turned off on it. You could cycle through all ents and if a keyval is solid 0, and some other stuff that's water specific, render it.


All times are GMT -4. The time now is 23:44.

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