Raised This Month: $ Target: $400
 0% 

How to detect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 06-21-2010 , 13:31   Re: How to detect
Reply With Quote #1

Well, what are you trying to do to them if they aren't moving? That'll help us know what you want to trigger this.
RedRobster is offline
zombieplague
Veteran Member
Join Date: Apr 2009
Old 06-21-2010 , 15:08   Re: How to detect
Reply With Quote #2

Quote:
Originally Posted by RedRobster View Post
Well, what are you trying to do to them if they aren't moving? That'll help us know what you want to trigger this.
I want to add regen to them when they are not moving if they are cancel regen, they have to wait for the timing set for regen again.
zombieplague is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 06-21-2010 , 16:09   Re: How to detect
Reply With Quote #3

What do you mean the "timing set"? This shouldn't be too hard to set up once I understand what you mean. xD
RedRobster is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 06-21-2010 , 16:15   Re: How to detect
Reply With Quote #4

Quote:
Originally Posted by RedRobster View Post
What do you mean the "timing set"? This shouldn't be too hard to set up once I understand what you mean. xD
he wants it like this:

i stand still, wait for example 3 seconds, and the regen starts.
I move, regen stops and cooldown starts.
I stand still again, and the cooldown isn't over. Nothing happens.
I stand still and the cooldown is over. i have to wait 3 seconds again, regen starts.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 06-21-2010 , 16:18   Re: How to detect
Reply With Quote #5

So just set an infinite task when a player is put into the server, and use a connected and alive check, and if both are true, do the movement check. If the movement check comes back false, heal, otherwise do nothing. That would work, I guess.
RedRobster is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 06-21-2010 , 17:19   Re: How to detect
Reply With Quote #6

It will be something like this...of course there are other ways maybe better than this but this is just an e.g ->

Code removed.
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 06-25-2010 at 12:42. Reason: edit - fix.3
Alka is offline
zombieplague
Veteran Member
Join Date: Apr 2009
Old 06-22-2010 , 11:31   Re: How to detect
Reply With Quote #7

Quote:
Originally Posted by Alka View Post
It will be something like this...of course there are other ways maybe better than this but this is just an e.g ->

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fun>
 
#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Alka"
 
#define MAX_PLAYERS 32
 
//Modify here the wait time after stop moving
//for heal
#define HEAL_WAIT_TIME 3 //sec
 
//Heal amount per second
#define HEAL_AMOUNT 10 //hp
 
//Max Heal
#define MAX_HEAL 200 //hp
 
new g_iWaitTime[MAX_PLAYERS 1];
 
public 
plugin_init() {
 
    
register_plugin(PLUGINVERSIONAUTHOR);
 
    
set_task(1.0"task_CheckHeal", .flags="b");
}
 
public 
task_CheckHeal()
{
    static 
id;
    for(
id id <= MAX_PLAYERS id++)
    {
        if(!
is_user_alive(id)) //isn't this checking if player is connected? -.-'
        
{
            continue;
        }
 
        static 
Float:vVel[3];
        
pev(idpev_velocityvVel);
 
        if(
vector_length(vVel) > 0)
            
g_iWaitTime[id] = 0;
        else
        {
            if(
g_iWaitTime[id] >= HEAL_WAIT_TIME)
            {
                static 
iHealth;
                
iHealth get_user_health(id);
 
                if(
iHealth MAX_HEAL)
                {
                    
//start player regen and show a HUD msg at bottom of screen
                    
set_hudmessage(0255127, -1.00.906.01.1, .channel=1);
                    
show_hudmessage(id"Regeneration in progress...");
 
                    
set_user_health(idiHealth HEAL_AMOUNT);
                }
            }
            
g_iWaitTime[id]++;
        }
    }

This doesn't work.
zombieplague is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 06-21-2010 , 23:10   Re: How to detect
Reply With Quote #8

Sorry, that was a big failure.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 06-22-2010 , 13:19   Re: How to detect
Reply With Quote #9

I can't see nothing wrong...anyway try again with the code from above.
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
zombieplague
Veteran Member
Join Date: Apr 2009
Old 06-22-2010 , 15:41   Re: How to detect
Reply With Quote #10

Quote:
Originally Posted by Alka View Post
I can't see nothing wrong...anyway try again with the code from above.
Still not working.
zombieplague 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:49.


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