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

Delay of the GivePlayerItem condition


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
szogun
Senior Member
Join Date: Apr 2016
Old 05-20-2018 , 13:55   Delay of the GivePlayerItem condition
Reply With Quote #1

Is there anyone able to change the code to let the GivePlayerItem allocate things delayed by the timer

PHP Code:
public Action PlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    if(!
IsPlayerVIP(client)) return;
    if(
GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
        
SetEntProp(clientProp_Send"m_ArmorValue"100);
    if(
GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
        
SetEntProp(clientProp_Send"m_bHasHelmet"1);
    
int money GetEntProp(clientProp_Send"m_iAccount");
    if(
GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
    
SetEntProp(clientProp_Send"m_iAccount"money+200);
    if(
GetClientTeam(client) == CS_TEAM_CT)
        if(
GetEntProp(clientProp_Send"m_bHasDefuser") == 0GivePlayerItem(client"item_defuser");
    for(
int x 01x++)
            if(
GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
        if(
GetEntProp(clientProp_Send"m_iAmmo"_offsetHe) < 1GivePlayerItem(client"weapon_hegrenade");
    for(
int x 01x++)
            if(
GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
        if(
GetEntProp(clientProp_Send"m_iAmmo"_offsetFlash) < 1GivePlayerItem(client"weapon_flashbang");
    for(
int x 01x++)
            if(
GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
        if(
GetEntProp(clientProp_Send"m_iAmmo"_offsetSmoke) < 1GivePlayerItem(client"weapon_smokegrenade");
    if(
GetClientTeam(client) == CS_TEAM_CT)
    {
        for(
int x 01x++)                                            // ilosc inc 
            
if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
            if(
GetEntProp(clientProp_Send"m_iAmmo"_offsetInc) < 1GivePlayerItem(client"weapon_incgrenade");
    }
    else if(
GetClientTeam(client) == CS_TEAM_T)
    {
        for(
int x 01x++)
                if(
GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
            if(
GetEntProp(clientProp_Send"m_iAmmo"_offsetMol) < 1GivePlayerItem(client"weapon_molotov");
    }

szogun is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 05-20-2018 , 19:19   Re: Delay of the GivePlayerItem condition
Reply With Quote #2

Code:
public Action PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
	int client = GetClientOfUserId(GetEventInt(event, "userid"));
	if(!IsPlayerVIP(client)) return Plugin_Continue;
	CreateTimer(1.0, Timer_DelaySpawn, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
	return Plugin_Continue;
}

public Action Timer_DelaySpawn(Handle timer, any data)
{
	int client;
	
	if ((client = GetClientOfUserId(data)) == 0)
	{
		return Plugin_Stop;
	}
	
	if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
	SetEntProp(client, Prop_Send, "m_ArmorValue", 100);
	if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
	SetEntProp(client, Prop_Send, "m_bHasHelmet", 1);
	int money = GetEntProp(client, Prop_Send, "m_iAccount");
	if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
	SetEntProp(client, Prop_Send, "m_iAccount", money+200);
	if(GetClientTeam(client) == CS_TEAM_CT)
	if(GetEntProp(client, Prop_Send, "m_bHasDefuser") == 0) GivePlayerItem(client, "item_defuser");
	for(int x = 0; x < 1; x++)
	if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
	if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetHe) < 1) GivePlayerItem(client, "weapon_hegrenade");
	for(int x = 0; x < 1; x++)
	if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
	if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetFlash) < 1) GivePlayerItem(client, "weapon_flashbang");
	for(int x = 0; x < 1; x++)
	if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
	if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetSmoke) < 1) GivePlayerItem(client, "weapon_smokegrenade");
	if(GetClientTeam(client) == CS_TEAM_CT)
	{
		for(int x = 0; x < 1; x++)                                            // ilosc inc
		if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0) 
		if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetInc) < 1) GivePlayerItem(client, "weapon_incgrenade");
	}
	else if(GetClientTeam(client) == CS_TEAM_T)
	{
		for(int x = 0; x < 1; x++)
		if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
		if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetMol) < 1) GivePlayerItem(client, "weapon_molotov");
	}
	
	return Plugin_Stop;
}
Could be better.

Last edited by Drixevel; 05-20-2018 at 19:19.
Drixevel 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 09:03.


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