AlliedModders

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

DaniDin 01-09-2009 10:13

global var ?
 
hi i want to do timer that i can change the time how to do it ?
PHP Code:

#include <amxmodx>
#include <amxmisc>

new Gtime 10;

public 
plugin_init()
{
set_task(Gtime ,"HelloMSG",0,_,_,"b")
}
public 
HelloMSG(id)
{
    
server_cmd("amx_say Hi , Welcome to my server .")
     
Gtime 300;



kyler 01-09-2009 10:38

Re: global var ?
 
try this instead the 1 on the end represents repeating, put to 0 to do this once
the 10 is the ammount of time in seconds i believe so that task will do the Function HelloMSG every 10 seconds
PHP Code:

set_task(10"HelloMSG"0""0""1


DaniDin 01-09-2009 10:46

Re: global var ?
 
i want it will say the hello 5 times (timer 10 sec) and if it over the 5 so the timer will be 300 sec
like this
PHP Code:

#include <amxmodx>
#include <amxmisc>

new Gtime 10;
new 
GTMSEC 1;
public 
plugin_init()
{
set_task(Gtime ,"HelloMSG",0,_,_,"b")
}
public 
HelloMSG(id)
{
    
server_cmd("amx_say Hi , Welcome to my server .")
GTMSEC GTMSEC +1;
if(
GTMSEC >= 5)
     
Gtime 300;



Spunky 01-09-2009 23:30

Re: global var ?
 
PHP Code:

#include <amxmodx>
#include <amxmisc>

new g_iCount

public plugin_init()
{
    
set_task(100.0"fnHello"1337__"b")
}

public 
fnHello()
{
    
server_cmd("amx_say Hi, welcome to my server.")

    if (
g_iCount 5)
        
g_iCount++
    else
        
remove_task(13370)

    return 
PLUGIN_HANDLED



Emp` 01-10-2009 00:44

Re: global var ?
 
PHP Code:

#include <amxmodx>
#include <amxmisc>

new Float:Gtime 10;
new 
GTMSEC 1;
public 
plugin_init()
{
    
set_task(Gtime ,"HelloMSG")
}
public 
HelloMSG()
{
    
server_cmd("amx_say Hi , Welcome to my server .")
    if( ++
GTMSEC )
        
Gtime 300.0;
    
set_task(Gtime ,"HelloMSG")



AntiBots 01-10-2009 19:55

Re: global var ?
 
PHP Code:

#include <amxmodx>
 
new contador[33]
 
public 
client_putinserver(id)
{
         
contador[id] = 0
         set_task
(10.0"mensaje"id__"b")
}
 
public 
client_disconnect(id)
         
remove_task(id)
 
public 
mensaje(id)
{
         if( 
contador[id] <= )
         {
                  
change_task(id300.0)
         }
         else
         {
                  
contador[id]++;
         }
 
         
client_print(idprint_chat"amx_say Hi , Welcome to my server .")




All times are GMT -4. The time now is 09:10.

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