AlliedModders

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

RuleBreaker 07-28-2011 20:13

invisibility
 
Can somebody make me just like in furion, if user is CT and he stays in one place few sec he become invisible, and if he crouch he become invisible faster :)
Thanks ;)

delayedCoder 07-29-2011 00:30

Re: invisibility
 
Here's something to get you going:
This will detect if a user has been idle for 5 seconds, if so, they will be invisible.

Note: There is no team detection or crouch method.

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <fakemeta> #define PLUGIN "Blah" #define VERSION "1.0" #define AUTHOR "delayedCoder" new Float:lastMove[33]; public plugin_init() {         register_forward(FM_PlayerPreThink, "fw_playerprethink", 1);     } public fw_playerprethink(id) {         static Float:velocity[3];         pev(id,pev_velocity,velocity);         new Float:time = get_gametime();         if(velocity[1] || velocity[0] || velocity[2] || !(pev(id,pev_frags) & FL_ONGROUND))         lastMove[id] = time;         if(time-lastMove[id] >= 5.0)     {         set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 20);         lastMove[id] = time;     }         return FMRES_IGNORED; }

Exolent[jNr] 07-29-2011 02:45

Re: invisibility
 
Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <engine> #define PLUGIN "Blah" #define VERSION "1.0" #define AUTHOR "delayedCoder" new Float:lastMove[33]; new visible; public client_PreThink(id) {     static Float:velocity[3];         entity_get_vector(id,EV_VEC_velocity,velocity);         new Float:time = get_gametime();         new flags = get_entity_flags(id);     if(velocity[1] || velocity[0] || velocity[2] || ~flags & FL_ONGROUND)     {         if(~visible & (1<<(id&31)))         {             visible |= (1<<(id&31));             set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 0);         }         lastMove[id] = time;     }     else     {         visible &= ~(1<<(id&31));                 new Float:maxStillTime = (flags & FL_DUCKING) ? 3.0 : 5.0;         new Float:stillTime = floatmin(maxStillTime, lastMove[id] - time);                 set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, floatround(255.0 - (255.0 * stillTime / maxStillTime)));     } }

Fixed never making player visible again.
Added fading, duck support, and converted to engine.

RuleBreaker 07-29-2011 06:28

Re: invisibility
 
I just tested it and it doesn`t work :\


All times are GMT -4. The time now is 00:47.

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