Raised This Month: $ Target: $400
 0% 

Delay script with 10 seconds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
erkz
Junior Member
Join Date: Jun 2012
Old 06-20-2012 , 19:11   Delay script with 10 seconds
Reply With Quote #1

Is it possible to delay this script with 10 secons? It runs on the start of every rounds. I have Hide N' Seek plugin which drops/delete all weapons on the start of every round, so it doesn't work well together. Tips?

Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta_util>

#define WAIT 0.1

new PLUG[] = "HNSExtras"
new VERS[] = "1.2"
new AUTH[] = "Stewie!"

new hnse_on;

new awp_on;
new fiveseven_on;
new deagle_on;
new scout_on;
new nade_on;

public plugin_init()
{
	register_plugin(PLUG, VERS, AUTH);
	register_cvar("HNSExtras", VERS, FCVAR_SERVER|FCVAR_UNLOGGED);
	
	register_logevent("round_start", 2, "1=Round_Start");
	
	register_forward(FM_ClientKill, "client_kill")
	
	hnse_on = register_cvar("hnse_on", "1");
	
	awp_on = register_cvar("hnse_awp_on", "1", ADMIN_ADMIN);
	fiveseven_on = register_cvar("hnse_fiveseven_on", "1", ADMIN_ADMIN);
	deagle_on = register_cvar("hnse_deagle_on", "1", ADMIN_ADMIN);
	scout_on = register_cvar("hnse_scout_on", "1", ADMIN_ADMIN);
	nade_on = register_cvar("hnse_nade_on", "1", ADMIN_ADMIN);
}

public round_start()
{
	set_task(WAIT, "strip")
}

public strip()
{
	if(get_pcvar_num(hnse_on))
	{
		new players[32], num;
		get_players(players, num, "ah");
		new player;
		for(new i = 0; i < num; i++)
		{
			player = players[i];
			
			fm_strip_user_weapons(player);
			cs_set_user_money(player, 0);
			fm_give_item(player, "weapon_knife");
		}
	}
	set_task(WAIT, "weapon_chance");
}

public weapon_chance()
{
	new Players[32], playerCount, i, id;
	get_players(Players, playerCount, "ah");
	for(i=0; i<playerCount; i++)
	{
		id = Players[i];
		
		new number = random_num(0, 100);
		
		switch(number)
		{
			case 1 .. 5:
			{
				if(get_pcvar_num(scout_on))
				{
					new scout = fm_give_item(id, "weapon_scout");
					cs_set_user_bpammo(id, CSW_SCOUT, 0);
					cs_set_weapon_ammo(scout, 1);
					client_print(id, print_chat, "[5%%] You have been awarded a scout with 1 bullet!");
				}
			}
			case 6 .. 15:
			{
				if(get_pcvar_num(deagle_on))
				{
					new deagle = fm_give_item(id, "weapon_deagle");
					cs_set_user_bpammo(id, CSW_DEAGLE, 0);
					cs_set_weapon_ammo(deagle, 2);
					client_print(id, print_chat, "[10%%] You have been awarded a deagle with 2 bullets!");
				}
			}
			case 16 .. 20:
			{
				if(get_pcvar_num(fiveseven_on))
				{
					new fiveseven = fm_give_item(id, "weapon_fiveseven");
					cs_set_user_bpammo(id, CSW_FIVESEVEN, 0);
					cs_set_weapon_ammo(fiveseven, 3);
					client_print(id, print_chat, "[5%%] You have been awarded a fiveseven with 3 bullets!");
				}
			}
			case 21 .. 22:
			{
				if(get_pcvar_num(awp_on))
				{
					new awp = fm_give_item(id, "weapon_awp");
					cs_set_user_bpammo(id, CSW_AWP, 0);
					cs_set_weapon_ammo(awp, 1);
					client_print(id, print_chat, "[1%%] You have been awarded an awp with 1 bullet!");
				}
			}
			case 23 .. 37:
			{
				if(get_pcvar_num(nade_on))
				{
					new nade = fm_give_item(id, "weapon_hegrenade");
					cs_set_user_bpammo(id, CSW_HEGRENADE, 0);
					cs_set_weapon_ammo(nade, 1);
					client_print(id, print_chat, "[15%%] You have been awarded a HE grenade!")
				}
			}
			case 38 .. 100:
			{
				client_print(id, print_chat, "You have not been awarded any items");
			}
		}
	}
}

public client_kill(id)
{
	if(is_user_alive(id))
	{
		console_print(id, "You cannot kill yourself at this moment in time!");
		
		return PLUGIN_HANDLED;
	}
	else
	{
		console_print(id, "You can only kill yourself when you are alive!")
		
		return PLUGIN_HANDLED;
	}
	
	return PLUGIN_CONTINUE;
}
erkz is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-20-2012 , 19:14   Re: Delay script with 10 seconds
Reply With Quote #2

Modify the time in the set_task
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
erkz
Junior Member
Join Date: Jun 2012
Old 06-21-2012 , 11:21   Re: Delay script with 10 seconds
Reply With Quote #3

Can you please show me?
erkz is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-21-2012 , 11:36   Re: Delay script with 10 seconds
Reply With Quote #4

You're in Scripting Help. You should be able to change the time of a task.

If you do not know how to code, then the topic will be moved to Suggestions/Requests where you should post your topics from then on out.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-21-2012 , 14:14   Re: Delay script with 10 seconds
Reply With Quote #5

A small hint:
Code:
#define WAIT 0.1

Last edited by Backstabnoob; 06-21-2012 at 14:14.
Backstabnoob is offline
Waleed
Senior Member
Join Date: May 2012
Location: Pakistan
Old 06-21-2012 , 14:29   Re: Delay script with 10 seconds
Reply With Quote #6

Just change the set_task to 10 seconds I guess?? O_O
or

#Define wait 0.1 to 10.0

Check if it works
__________________
Working On:
  1. Gameplay 1 - 0% [PAUSED]

Last edited by Waleed; 06-21-2012 at 14:30. Reason: More description
Waleed is offline
Send a message via Skype™ to Waleed
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-21-2012 , 14:36   Re: Delay script with 10 seconds
Reply With Quote #7

This code is terrible.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Reply


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 06:14.


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