This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Strange issue with timer


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
VsX
AlliedModders Donor
Join Date: Jul 2007
Old 11-16-2015 , 17:23   Strange issue with timer
Reply With Quote #1

Hi.
I have a strange issue.

Code:
public Event_OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    CreateTimer(1.0, Stuff, client);

}


public Action Stuff(Handle timer, any client) 
{
    if (client > 0 && IsPlayerAlive(client) && IsClientConnected(client))
    {
        if (IsPlayerGenericAdmin(client))
        {
            SetEntProp(client, Prop_Send, "m_ArmorValue", 100, 1); //armor
            SetEntProp(client, Prop_Send, "m_bHasHelmet", 1); //helmet
            GivePlayerItem(client, "weapon_hegrenade"); //grenade
            GivePlayerItem(client, "weapon_flashbang"); //flash
            CPrintToChatAll("{red}%N {orange} jest graczem {purple}Premium{orange}!", client);

        }else
        {
            SetEntProp(client, Prop_Send, "m_ArmorValue", 100, 1); //armor
            SetEntProp(client, Prop_Send, "m_bHasHelmet", 0); //helmet
        }
    }
}
I create timer on event spawn. It should run only once, yes?
In the first round, I get my grenades once. But in second round and later, procedure Stuff is called twice. Why?
VsX is offline
 



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 10:56.


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