AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   player outside? (https://forums.alliedmods.net/showthread.php?t=220586)

Blizzard_87 07-12-2013 06:40

player outside?
 
is there an easy way to detect if a player it outside or inside of a building?

Arkshine 07-12-2013 06:47

Re: player outside?
 
Throwing a traceline and checking if you can hit sky ? I vaguely remember someone asking something similar, try to search.

Blizzard_87 07-12-2013 06:56

Re: player outside?
 
Quote:

Originally Posted by Arkshine (Post 1989246)
Throwing a traceline and checking if you can hit sky ? I vaguely remember someone asking something similar, try to search.

ive tried searching but i must be using the wrong keywords since all the results show tracelines for aiming straight or users aiming, etc... cant find one they states JUST if player is outside... :(

EDIT: ok found this but doesnt explain anything in a way i understand http://forums.alliedmods.net/showthread.php?t=69817

bael 07-12-2013 07:04

Re: player outside?
 
Search for auto weather plugin or something similar. I remember some of them had check if you are outside so there could be rain around you etc.

Blizzard_87 07-12-2013 07:16

Re: player outside?
 
ok ive got this so far.. but its obviously wrong as its not working

Code:
public fwd_PlayerPreThink(id) {     if( !is_user_alive( id ) )         return FMRES_IGNORED;         if( pev(id, pev_flags) & FL_ONGROUND && is_user_outside(id) ) {         client_cmd( id, "speak ambience/rain.wav");     } else {         client_cmd( id, "speak NULL");     }     return FMRES_IGNORED; } stock Float:is_user_outside(id) {     new Float:vOrigin[3], Float:fDist;     pev(id, pev_origin, vOrigin);         fDist = vOrigin[2];         while(engfunc(EngFunc_PointContents, vOrigin) == CONTENTS_EMPTY)         vOrigin[2] += 5.0;         if(engfunc(EngFunc_PointContents, vOrigin) == CONTENTS_SKY)         return (vOrigin[2] - fDist);         return 0.0; }

EDIT: ok got it working to play sound but it executes the client_cmd like 1000X... which means the sound is all fuzzy instead of playing Once.


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

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