Raised This Month: $51 Target: $400
 12% 

Use a command once in few hours


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
The Inhabitant Of Heavens
Member
Join Date: Aug 2011
Old 01-13-2012 , 04:49   Use a command once in few hours
Reply With Quote #1

who can write a code, that allows me to use a specific command once in 2 hours ?
The Inhabitant Of Heavens is offline
MyPc
Senior Member
Join Date: Sep 2011
Old 01-13-2012 , 05:45   Re: Use a command once in few hours
Reply With Quote #2

Quote:
Originally Posted by The Inhabitant Of Heavens View Post
who can write a code, that allows me to use a specific command once in 2 hours ?
Code:
#include < amxmodx > #include < nvault > #define KEY "time" new g_iTime, g_iVault; public plugin_init( ) {     g_iVault = nvault_open( "vault" );     g_iTime = nvault_get( g_iVault, KEY );     set_task( 1.0, "count" ); } public count( ) {     if( g_iTime == 7200 )     {         // What Happens After 2 Hours         g_iTime = 0;         return PLUGIN_HANDLED;     }     ++g_iTime;     new szTime[ 5 ];     num_to_str( g_iTime, szTime, sizeof(szTime) - 1 );     nvault_set( g_iVault, KEY, szTime );     return PLUGIN_CONTINUE; } public plugin_end( ) {     nvault_close( g_iVault ); }
MyPc is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 01-13-2012 , 05:52   Re: Use a command once in few hours
Reply With Quote #3

You should set the flag "b" to the task.
__________________
You can do anything you set your mind to, man.

Devil259 is offline
The Inhabitant Of Heavens
Member
Join Date: Aug 2011
Old 01-13-2012 , 06:34   Re: Use a command once in few hours
Reply With Quote #4

how to format this so it can show the correct value when debugging with client_print ? Right now, it displays 127361764714 and not the correct time
The Inhabitant Of Heavens is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 01-13-2012 , 07:16   Re: Use a command once in few hours
Reply With Quote #5

client_print(id,print_chat,"Time before using command : %d",(7200-g_iTime))
__________________
You can do anything you set your mind to, man.


Last edited by Devil259; 01-13-2012 at 07:16.
Devil259 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 08:34.


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