Raised This Month: $ Target: $400
 0% 

How do I...


Post New Thread Reply   
 
Thread Tools Display Modes
Zenith77
Veteran Member
Join Date: Aug 2005
Old 08-30-2006 , 19:02   Re: How do I...
Reply With Quote #11

Post code.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 08-30-2006 , 22:17   Re: How do I...
Reply With Quote #12

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

new maxplayers
new bombs

public plugin_init()
{
	register_plugin("All Ts have Bomb", "1.0", "Kensai")
	register_cvar("amx_max_bombs", "2")
	new mapname[32]
	get_mapname(mapname, 31)
	if(containi(mapname, "de_")== 0)
	{
		register_event("SendAudio", "newround", "a", "2=%!MRAD_terwin", "2=%!MRAD_ctwin", "2=%!MRAD_rounddraw")
		maxplayers = get_maxplayers()
	}
}

public bomb_planted(id)
{
	bombs += 1
	if(bombs >= get_cvar_num("amx_max_bombs"))
	{
		new players[32], pnum
		get_players(players, pnum ,"ae", "TERRORIST")
		for(new i=0; i<pnum; i++)
		{
			cs_set_user_plant(players[i], 0, 0)
			client_print(players[i], print_chat, "*Max bombs reached!*")
		}
	}
}	

public give_bombs(id)
{
	for(new i=1; i<=maxplayers; i++)
	{
		if(is_user_alive(i) && cs_get_user_team(i) == CS_TEAM_T)
		{
			give_item(i, "weapon_c4")
			cs_set_user_plant(i, 1, 1)
		}
	}
}

public bomb_carrier(id)
{
	if(user_has_weapon(id, CSW_C4))
	{
		cs_set_user_plant(id, 0, 0)
	}
	return 1
}

public newround()
{
	bombs = 0
	set_task(6.0, "bomb_carrier")
	set_task(8.0, "give_bombs")
}
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 08-31-2006 , 00:16   Re: How do I...
Reply With Quote #13

I suggest checking how many bombsites the map contains then if there is more than one, devide maxbombs by two..


EDIT: wait damn, that would mean you can only use even numbers...Would also require fakemeta.
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
VEN
Veteran Member
Join Date: Jan 2005
Old 08-31-2006 , 05:32   Re: How do I...
Reply With Quote #14

Quote:
register_event("SendAudio", "newround", "a", "2=%!MRAD_terwin", "2=%!MRAD_ctwin", "2=%!MRAD_rounddraw")
This is round end event. And you actually need round start: http://forums.alliedmods.net/showthread.php?t=42159

Quote:
I only want 2 for the whole map
You already have that in your code.

Code:
public bomb_carrier(id) {         if(user_has_weapon(id, CSW_C4))         {                 cs_set_user_plant(id, 0, 0)         }         return 1 } public newround() {         bombs = 0         set_task(6.0, "bomb_carrier")         set_task(8.0, "give_bombs") }
bomb_carrier task index is 0, so id of the bomb_carrier(id) is always 0, you will have "Invalid player id" every function call.

Last edited by VEN; 08-31-2006 at 05:38.
VEN is offline
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 09-01-2006 , 18:03   Re: How do I...
Reply With Quote #15

Quote:
Originally Posted by VEN View Post
This is round end event. And you actually need round start: http://forums.alliedmods.net/showthread.php?t=42159

You already have that in your code.

Code:
public bomb_carrier(id) {         if(user_has_weapon(id, CSW_C4))         {                 cs_set_user_plant(id, 0, 0)         }         return 1 } public newround() {         bombs = 0         set_task(6.0, "bomb_carrier")         set_task(8.0, "give_bombs") }
bomb_carrier task index is 0, so id of the bomb_carrier(id) is always 0, you will have "Invalid player id" every function call.
Notice that I have tasks set in that round end. So it works the same.
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 09-01-2006 , 18:54   Re: How do I...
Reply With Quote #16

Quote:
Originally Posted by Kensai View Post
Notice that I have tasks set in that round end. So it works the same.
Do you have any clue what you are talking about there. VEN is right your going to get invalid player everytime.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
VEN
Veteran Member
Join Date: Jan 2005
Old 09-02-2006 , 05:39   Re: How do I...
Reply With Quote #17

Kensai, why use tasks while it's absolutely not needed?
You have to catch certain events.
Don't you like: 1. Efficient and 2. Accurate code/plugin?
VEN 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 05:21.


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