AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   set_task executing when it should not. (https://forums.alliedmods.net/showthread.php?t=253607)

fcastro16 12-25-2014 00:12

set_task executing when it should not.
 
Hello guys,

I am having a problem with my code. The set_task is executing when it should not, randomly.
From my understanding, the code should execute every 10 minutes 4 times.

Code:

public client_putinserver(id)
{
      set_task(600.0, "creditSystem", id, _, _, "a", 4)
}

public creditSystem(id)
{
        static team
        team = fm_cs_get_user_team(id)
       
        if (team == FM_CS_TEAM_SPECTATOR || team == FM_CS_TEAM_UNASSIGNED)
                return PLUGIN_HANDLED;
        else
        {
                if (is_user_connected(id))
                {
                        zp_colored_print(id, "^x04[GDL] ^x01Ganaste un^x03 CREDITO ^x01!")
                        g_creditos[id]++
                }
        }
       
        return PLUGIN_HANDLED;
}

thanks and merry christmas

zmd94 12-25-2014 01:33

Re: set_task executing when it should not.
 
PHP Code:

public client_putinserver(id)
{
    if(
is_user_connected(id))
    {
        
set_task(600.0"creditSystem"id__"b")
    }
}

public 
creditSystem(id)
{
    if(
is_user_alive(id))
    {
        
// Print message
        
zp_colored_print(id"^x04[GDL] ^x01Ganaste un^x03 CREDITO ^x01!")
        
        
// We give 4 credits. ;)
        
g_creditos[id] += 4
    
}



fcastro16 12-25-2014 04:43

Re: set_task executing when it should not.
 
I want for every 10 minutes of play, players gain one credit.

zmd94 12-25-2014 04:48

Re: set_task executing when it should not.
 
Just change g_creditos[id] += 4 into g_creditos[id] ++ .


All times are GMT -4. The time now is 15:22.

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