Raised This Month: $ Target: $400
 0% 

Solved Wait N amount of seconds?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 08-05-2018 , 09:00   Re: Wait N amount of seconds?
Reply With Quote #1

PHP Code:
#include < amxmodx >
#include < fun >

new g_iUseTime;

const 
g_iFreq 15;

public 
plugin_init( )
{    
    
register_clcmd"say /healme""@HealMe" );
}

@
HealMeid )
{
    new 
iTime floatroundget_gametime( ) );
    
    if( 
iTime >= g_iUseTime )
    {
        
g_iUseTime iTime g_iFreq;
        
        
set_user_healthidget_user_healthid ) + 15 );
    }
    
    else
    {
        
client_printidprint_center"You have to wait %d seconds until you can use this again."g_iUseTime iTime );
    }
    
    return 
PLUGIN_HANDLED;

__________________
edon1337 is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 08-05-2018 , 09:35   Re: Wait N amount of seconds?
Reply With Quote #2

Quote:
Originally Posted by edon1337 View Post
PHP Code:
#include < amxmodx >
#include < fun >

new g_iUseTime;

const 
g_iFreq 15;

public 
plugin_init( )
{    
    
register_clcmd"say /healme""@HealMe" );
}

@
HealMeid )
{
    new 
iTime floatroundget_gametime( ) );
    
    if( 
iTime >= g_iUseTime )
    {
        
g_iUseTime iTime g_iFreq;
        
        
set_user_healthidget_user_healthid ) + 15 );
    }
    
    else
    {
        
client_printidprint_center"You have to wait %d seconds until you can use this again."g_iUseTime iTime );
    }
    
    return 
PLUGIN_HANDLED;

Notice 1: g_iUseTime is single variable so in players this will mess things up
Notice 2: Better use float variable than converting float to int
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM

Last edited by Ghosted; 08-05-2018 at 09:35.
Ghosted is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 08-05-2018 , 10:12   Re: Wait N amount of seconds?
Reply With Quote #3

Quote:
Originally Posted by Ghosted View Post
Notice 1: g_iUseTime is single variable so in players this will mess things up
Notice 2: Better use float variable than converting float to int
1. It was just an example, this is Scripting help section after all.
2. Doesn't really matter.
__________________
edon1337 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-05-2018 , 10:55   Re: Wait N amount of seconds?
Reply With Quote #4

Quote:
Originally Posted by edon1337 View Post
1. It was just an example, this is Scripting help section after all.
2. Doesn't really matter.
1. If it was just an example it's a really bad one. What's the point of providing a non working code?
2. It matters, you are loosing precision.
__________________
HamletEagle is offline
Old 08-05-2018, 13:26
edon1337
This message has been deleted by edon1337.
blAck.
Member
Join Date: Jun 2018
Old 08-05-2018 , 13:43   Re: Wait N amount of seconds?
Reply With Quote #6

Quote:
Originally Posted by HamletEagle View Post
1. If it was just an example it's a really bad one. What's the point of providing a non working code?
2. It matters, you are loosing precision.
Hey, chill. I tried the code and it works.
blAck. is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-05-2018 , 13:53   Re: Wait N amount of seconds?
Reply With Quote #7

Quote:
Originally Posted by blAck. View Post
Hey, chill. I tried the code and it works.
Hey, chill, it doesn't work. But you can decide not to trust me and Ghosted. Test with 2 players or more. It is going to store everybody's time in the same variable.

edon, please, just stop. You made a mistake, it's not the end of the world. Stop arguing for the sake of arguing, it is much better if you simply say "yeah, my bad" or move on, instead of coming with silly excuses.
Anyway, it's not going to ever work properly, be it first or last round. That's not the issue.
__________________

Last edited by HamletEagle; 08-05-2018 at 13:58.
HamletEagle is offline
blAck.
Member
Join Date: Jun 2018
Old 08-05-2018 , 13:57   Re: Wait N amount of seconds?
Reply With Quote #8

Quote:
Originally Posted by HamletEagle View Post
Hey, chill, it doesn't work. But you can decide not to trust me and Ghosted. Test with 2 players or more. It is going to store everybody's time in the same variable.

edon, please, just stop. You made a mistake, it's not the end of the world. Stop arguing for the sake of arguing, it is much better if you simply say "yeah, my bad" or move on, instead of coming with silly excuses.
Anyway, it's not going to ever work properly, be it first or last round. That's not the issue.
Ok then.. Can you tell me what's the right code for what I'm looking?

Last edited by HamletEagle; 08-05-2018 at 13:58.
blAck. is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 08-05-2018 , 13:59   Re: Wait N amount of seconds?
Reply With Quote #9

Quote:
Originally Posted by HamletEagle View Post
edon, please, just stop. You made a mistake, it's not the end of the world. Stop arguing for the sake of arguing, it is much better if you simply say "yeah, my bad" and move on, instead of coming with silly excuses.
Anyway, it's not going to ever work properly, be it first or last round. That's not the issue.
Perhaps you should see that I instantly deleted the comment.

PHP Code:
#include < amxmodx > 
#include < fun > 

new Float:g_fUseTime33 ];

const 
Float:g_fFreq 15.0

public 
plugin_init( ) 
{     
    
register_clcmd"say /healme""@HealMe" ); 


public 
client_connectid )
g_fUseTimeid ] = 0.0;

@
HealMeid 

    new 
Float:fTime get_gametime( ); 
     
    if( 
fTime >= g_fUseTimeid ] ) 
    { 
        
g_fUseTimeid ] = fTime g_fFreq
         
        
set_user_healthidget_user_healthid ) + 15 ); 
    } 
     
    else 
    { 
        
client_printidprint_center"You have to wait %d seconds until you can use this again."floatroundg_fUseTimeid ] - fTime ) ); 
    } 
     
    return 
PLUGIN_HANDLED

Happy now?
__________________

Last edited by edon1337; 08-05-2018 at 14:01.
edon1337 is offline
blAck.
Member
Join Date: Jun 2018
Old 08-05-2018 , 10:10   Re: Wait N amount of seconds?
Reply With Quote #10

Quote:
Originally Posted by edon1337 View Post
PHP Code:
#include < amxmodx >
#include < fun >

new g_iUseTime;

const 
g_iFreq 15;

public 
plugin_init( )
{    
    
register_clcmd"say /healme""@HealMe" );
}

@
HealMeid )
{
    new 
iTime floatroundget_gametime( ) );
    
    if( 
iTime >= g_iUseTime )
    {
        
g_iUseTime iTime g_iFreq;
        
        
set_user_healthidget_user_healthid ) + 15 );
    }
    
    else
    {
        
client_printidprint_center"You have to wait %d seconds until you can use this again."g_iUseTime iTime );
    }
    
    return 
PLUGIN_HANDLED;

This works perfectly! Ty
blAck. 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 12:37.


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