AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Light level (https://forums.alliedmods.net/showthread.php?t=17229)

v3x 08-27-2005 22:55

Light level
 
( Damn I'm posting a lot of topics in here lately )

I'm trying to make the player's footsteps silent in darker areas and in the opposite in lighter areas. Here's what I came up with but it gives the player silent footsteps 24/7:
Code:
    if(entity_get_int(id,EV_INT_light_level) <= LIGHT_LEVEL) {     set_user_footsteps(id,1); } else {     set_user_footsteps(id,0); }
I have LIGHT_LEVEL set to 25 atm.

Zenith77 08-27-2005 23:05

its most likely just checking the whole map instead of that specifix area...so both become true and since the last if statements makes it where nobody has foot steps...


you need to get the origin of the light and light areas somehow and then contrast it with the player origin...


hope this help ;)

v3x 08-27-2005 23:27

No, I've already tested it:
Code:
#include <amxmodx> #include <engine> public plugin_init() {     register_plugin("Light Test","0.1","v3x")     register_clcmd("lights","ClCmd_Lights",0) } public ClCmd_Lights(id) {     client_print(id,print_chat,"Light level: %i",entity_get_int(id,EV_INT_light_level))     return PLUGIN_HANDLED }
Please don't reply to anything else I've started in Scripting Help, Zenith.

XxAvalanchexX 08-27-2005 23:53

How is this check ran?

v3x 08-28-2005 00:09

PreThink.. Not sure if that's the best way.. :P

Xanimos 08-28-2005 00:52

Try testing in prethink by showing the light levels to see if it would effect server play.

Freecode 08-28-2005 01:08

vex what does it print out in dark areas as to light areas?

v3x 08-28-2005 01:10

Quote:

Originally Posted by Freecode
vex what does it print out in dark areas as to light areas?

Well, in the tunnel in dust1 it's usually around 25 or less in the darker areas. I forget what it is in the lighter areas..

Freecode 08-28-2005 02:05

also whats LIGHT_LEVEL defined as?
Code:
if(entity_get_int(id,EV_INT_light_level) <= LIGHT_LEVEL)
should it be =>

v3x 08-28-2005 02:17

As I said before, LIGHT_LEVEL is defined as 25 :P.

Do you want me to change it to =>?

Low light = no footsteps
High light = footsteps


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

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