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

set_task executing when it should not.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fcastro16
Member
Join Date: Mar 2009
Old 12-25-2014 , 00:12   set_task executing when it should not.
Reply With Quote #1

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
fcastro16 is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-25-2014 , 01:33   Re: set_task executing when it should not.
Reply With Quote #2

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
    
}

zmd94 is offline
fcastro16
Member
Join Date: Mar 2009
Old 12-25-2014 , 04:43   Re: set_task executing when it should not.
Reply With Quote #3

I want for every 10 minutes of play, players gain one credit.
fcastro16 is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-25-2014 , 04:48   Re: set_task executing when it should not.
Reply With Quote #4

Just change g_creditos[id] += 4 into g_creditos[id] ++ .
zmd94 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 11:58.


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