PDA

View Full Version : Action when 1 T Left and when round is over.


shavit
01-27-2012, 07:24
Heyyy, its me, shavit.
i Wanna learn how to make the conVar sm_parachute_enabled2 to 0 when 1 T is left.
and when round is over (best) or when its starting it will switch the conVar to "1" instead of "0".

i know its hooks like round_start or round_end or something, but i dont know how to use it.

An Example would be great, Thanks. Shavit.

Bacardi
01-27-2012, 16:33
Heyyy, its me, shavit.
i Wanna learn how to make the conVar sm_parachute_enabled2 to 0 when 1 T is left.
and when round is over (best) or when its starting it will switch the conVar to "1" instead of "0".

i know its hooks like round_start or round_end or something, but i dont know how to use it.

An Example would be great, Thanks. Shavit.
What you mean "when 1 T left" ? (Last terrorist alive ??)

Ok, try look this code.

- But this could mostly fail, because when round end and have delay before restart, now if someone make kill/suicide in this time = cvar disable.
You can try change "round_end" to "round_start" (not need edit rest),
this could also fail 1st round when map changed and players spawn, someone change team making suicide etc. etc....
You could try change again to this "round_freeze_end", happens when player can move after round_start (mp_freezetime)

But anyway, go test.

public OnPluginStart() // plugin load
{
HookEvent("round_end", CallBack_end); // Hook event
HookEvent("player_death", CallBack_death);
}

public CallBack_end(Handle:event, const String:name[], bool:dontBroadcast)
{
/* When round end */
ServerCommand("sm_parachute_enabled2 1");
}

public CallBack_death(Handle:event, const String:name[], bool:dontBroadcast)
{
/* When player death */

new a = 0; // variable where storage player count

for(new i = 1; i <= MaxClients; i++) // Loop all player indexs from 1 to server maxplayers
{
if(IsClientInGame(i)) // Is player
{
if(GetClientTeam(i) == 2) // From team 2 (terrorist)
{
if(IsPlayerAlive(i)) // Alive
{
a += 1; // Add 1 in count
}
}
}
}

if(a <= 1) // When there 1 or less player alive in team terrorist
{
ServerCommand("sm_parachute_enabled2 0");
}
}

shavit
01-27-2012, 17:50
thats making it 0 when 1 terrorist alive and when round is over to 1?

Bacardi
01-27-2012, 17:58
yep

gucio1200
02-13-2012, 18:40
hi i'm trying to implement this but could not, can you help me with this please.
I would like to do not blow zombi up when wins the turn. This how it looks like.
#include <amxmodx>

#define VERSION "1.0"

public plugin_init() {
register_plugin("Kill all Terrorist", VERSION, "Muzzi")
register_logevent("LogeventRoundEnd", 2, "1=Round_End");
}

public LogeventRoundEnd()
{
new iPlayers[32], iNum;
get_players(iPlayers, iNum);
new a=0;
for(new i=0; i<iNum; i++)
{
new id = iPlayers[i];
if(get_user_team(id) = 1)
{
if(is_user_alive(id))
{
a += 1;
}
}
if(a <= 1)
continue;
if(!is_user_connected(id) || !is_user_alive(id) || get_user_team(id) != 1)
continue;
user_silentkill(id)
}
}

Gate
02-14-2012, 08:43
May you open a own thread and put the code like that: CODE

Powerlord
02-14-2012, 16:26
hi i'm trying to implement this but could not, can you help me with this please.
I would like to do not blow zombi up when wins the turn. This how it looks like.
#include <amxmodx>

#define VERSION "1.0"

public plugin_init() {
register_plugin("Kill all Terrorist", VERSION, "Muzzi")
register_logevent("LogeventRoundEnd", 2, "1=Round_End");
}

public LogeventRoundEnd()
{
new iPlayers[32], iNum;
get_players(iPlayers, iNum);
new a=0;
for(new i=0; i<iNum; i++)
{
new id = iPlayers[i];
if(get_user_team(id) = 1)
{
if(is_user_alive(id))
{
a += 1;
}
}
if(a <= 1)
continue;
if(!is_user_connected(id) || !is_user_alive(id) || get_user_team(id) != 1)
continue;
user_silentkill(id)
}
}

Not only should you start a new thread, you should start it on the AMXModX part of the forum, as this board is for SourceMod.