Raised This Month: $32 Target: $400
 8% 

Simple question, why delay doesn't work ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 06-26-2013 , 07:44   Simple question, why delay doesn't work ?
Reply With Quote #1

Hi

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

new Float:LastGambleTime[33]

public 
plugin_init() {
register_cvar("amx_glowdelay","40")
}

public 
client_putinserver(id){
    
LastGambleTime[id] = -1000.0
    
return PLUGIN_CONTINUE
}

public 
client_disconnect(id){
    
LastGambleTime[id] = -1000.0
    
return PLUGIN_CONTINUE
}

public 
myfunction(id) {
    if(
get_gametime() < LastGambleTime[id] + get_cvar_float("amx_glowdelay"))
    {
        
client_print(id,print_chat"[AMXX] <Painter> Hey, i ain't no machine! Let me have some rest!")
            return 
PLUGIN_HANDLED
    
}

I can use the command whenever I want.. flooding it and whatever.

there's no delay.. help ?

Last edited by Moody92; 06-26-2013 at 09:00.
Moody92 is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 06-26-2013 , 08:11   Re: Simple question, why delay doesn't work ?
Reply With Quote #2

You never assign LastGambleTime a value.
__________________
hleV is offline
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 06-26-2013 , 08:50   Re: Simple question, why delay doesn't work ?
Reply With Quote #3

Oh right forgot that, edited the code.

same problem
Moody92 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-26-2013 , 09:12   Re: Simple question, why delay doesn't work ?
Reply With Quote #4

Setting -1000 doesn't make sense, it sounds you put randomly a number.
And you still doesn't do what said helV.
__________________
Arkshine is offline
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 06-26-2013 , 09:32   Re: Simple question, why delay doesn't work ?
Reply With Quote #5

Quote:
Originally Posted by Arkshine View Post
Setting -1000 doesn't make sense, it sounds you put randomly a number.
And you still doesn't do what said helV.
An example would be appreciated, I did what helv said and I still haven't got any result.
Moody92 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-26-2013 , 09:34   Re: Simple question, why delay doesn't work ?
Reply With Quote #6

The entire code would be helpful and knowledge of what you are trying to accomplish
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 06-26-2013 , 09:41   Re: Simple question, why delay doesn't work ?
Reply With Quote #7

I'm actually editing a plugin that already has been released ( for my own purposes )

as in topic 'read before post' it says
HTML Code:
Do NOT post scripting questions that relate 
to an already released plugin. Post that in the plugin's thread.
but I'm going to post because it has nothing to do with the plugin ( I guess )

EDIT: Thank you all, I got it working using Necro (Blockmaker) delay script.

Appreciate the tries for help, code uploaded in case someone wanted to do such a thing

EDIT 2 : The reply below explaining how to do it

Last edited by Moody92; 07-03-2013 at 13:07.
Moody92 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-26-2013 , 16:42   Re: Simple question, why delay doesn't work ?
Reply With Quote #8

You needed to change the less than to greater than and then set LastGamebleTime to get_gametime().

I generally find it easier to understand when I save the 'next use time'. So, you only get the cvar when the command is successfully used (and you are setting a new 'next use time') as opposed to getting the cvar EVERY TIME the function is called.

Also, use pcvars.
__________________

Last edited by fysiks; 06-26-2013 at 16:46.
fysiks is offline
Reply


Thread Tools
Display Modes

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 19:19.


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