Raised This Month: $ Target: $400
 0% 

If a player join late


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Claw
Member
Join Date: Sep 2004
Old 11-20-2007 , 08:30   If a player join late
Reply With Quote #1

So im using this plugin which gives everyone a chance to get a random item at start of each round, but if it happens that a player joins about 5 seconds after the round starts, he doesnt get the use of this plugin.

How can i make it execute the same random chance on players if they join the game a few seconds after round starts?

Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>

#define TIME_TO_WAIT 2.0

public plugin_init()
{
	register_logevent("round_start", 2, "1=Round_Start")
}

public main_func()
{ 
	new players[32], num
	get_players(players, num) 
	new player
	for(new i = 0; i < num; i++)
	{
		player = players[i]
		new health = get_user_health(player); 

		if(random_num(0, 100) <= 1)
		{			
			give_item(player, "weapon_scout")
			
			cs_set_user_bpammo(player, CSW_SCOUT, 0)
			client_print(player, print_chat, "[Lottery] you just won a scout with 1 bullet (1 percent chance)")
		}
		
		if(random_num(0, 100) <= 2)
		{
			give_item(player, "weapon_deagle")	
			
			cs_set_user_bpammo(player, CSW_DEAGLE, 0)
			client_print(player, print_chat, "[Lottery] you just won a deagle with 1 bullet (2 percent chance)")
		}
		
		if(random_num(0, 100) <= 15)
		{
			give_item(player, "weapon_hegrenade")
			client_print(player, print_chat, "[Lottery] you just won a HE-grenade (15 percent chance)")
		}
		
		if(random_num(0, 100) <= 10)
		if (cs_get_user_team(player) == CS_TEAM_T)
		{
  			give_item(player, "weapon_shield")
   			client_print(player, print_chat, "[Lottery] you just won a shield (10 percent chance)")
		} 
		
		if(random_num(0, 100) <= 1)
		{
			health += 100;
			set_user_health(player,health);  
			client_print(player, print_chat, "[Lottery] you just won 100 extra health (1 percent chance)")
		}

		if(random_num(0, 100) <= 5)
		{
			health += 50;
			set_user_health(player,health);  
			client_print(player, print_chat, "[Lottery] you just won 50 extra health (5 percent chance)")
		}

		if(random_num(0, 100) <= 10)
		{
			health += 25;
			set_user_health(player,health);  
			client_print(player, print_chat, "[Lottery] you just won 25 extra health (10 percent chance)")
		}

		if(random_num(0, 100) <= 25)
		{
			cs_set_user_armor(player, 100, CS_ARMOR_VESTHELM)	
			client_print(player, print_chat, "[Lottery] you just won a kevlar and helmet (25 percent chance)")
		}
}
}

public round_start()
{
	set_task(TIME_TO_WAIT, "main_func")
}
Claw is offline
 


Thread Tools
Display Modes

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 01:16.


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