AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Only 1 Terrorist (https://forums.alliedmods.net/showthread.php?t=242983)

skatzfz 06-27-2014 17:45

Only 1 Terrorist
 
I have this code

get_players( players, num, "ae", "CT" );

for( new i = 0; i > num; i++ )
{
player = players[i];

if( !is_user_alive( player ) )
continue;

set_user_godmode( player, 1 );
}


Can anyone change this to if is only 1 terrorist alive left godmode is set off?

Flick3rR 06-27-2014 18:04

Re: Only 1 Terrorist
 
First, change the team tag to "TERRORIST" se we will get only terrorists. Then remove that loop, and just check if the player number is 1. If it is, set godmode with index players[num-1].

skatzfz 06-27-2014 20:30

Re: Only 1 Terrorist
 
public HideNSeek( id )
{

new players[32], num, player;
get_players( players, num, "ae", "TERRORIST" );

for( new i = 0; i < num; i++ )
{
player = players[i];

if( !is_user_alive( player ) )
continue;

set_user_rendering( player, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 16 );

set_user_footsteps( player, 1 );

}

get_players( players, num, "ae", "CT" );

for( new i = 0; i < num; )
{
player = players[i];

if( !is_user_alive( player ) )
continue;

set_user_godmode( player, 1 );
}
get_players( players, num, "ae", "TERRORIST" );

if( num <= 1 )
{
set_user_godmode( player, 0 );
}

This way works?

hornet 06-27-2014 22:33

Re: Only 1 Terrorist
 
For the sake of users trying to help you, please wrap your code in tags ( such as code, php, etc. ).

Freezo Begin 06-28-2014 05:50

Re: Only 1 Terrorist
 
if you wan't to do it for 1 terrorist then don't make loop . remove for (new i=0.....) and add if ( num == 1 ) and when you wan't to give something like ColorChat(players[0] ....
Code:
public HideNSeek( id ) {         new player[32], num;     get_players( player, num, "ae", "TERRORIST" );         if(num == 1)     {         if( !is_user_alive( player[0] ) )             return 1;                 set_user_godmode(  player[0], 1 );             }     return 0; }

skatzfz 06-28-2014 14:43

Re: Only 1 Terrorist
 
Thanks a lot!

Can anyone help me in one more thing? I want to block T killing CT but without giving them godmode, for example T can't kill CT but CT can die if they fall in the ground.

Flick3rR 06-28-2014 15:00

Re: Only 1 Terrorist
 
Ham_TakeDamage with return HAM_SUPERCEDE will do the work for you.

skatzfz 06-28-2014 15:15

Re: Only 1 Terrorist
 
can you edit the plugin with that?

Flick3rR 06-28-2014 15:20

Re: Only 1 Terrorist
 
I can't now, I'm not on my PC. But here is scripting help section, so you can't wait someone to make it for you. Try yourself, or post in suggestions/requests section. I'm sure someone will make it, since it's quite easy.

Freezo Begin 06-28-2014 19:21

Re: Only 1 Terrorist
 
idk if "Ham_TakeDamage" is the best way but i give a try !
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <hamsandwich> public plugin_init() {     register_plugin("Block Terrorist Kill Ct", "1.0", "Flicker")         RegisterHam(Ham_TakeDamage, "player", "Fwd_PlayerDamage")     } public Fwd_PlayerDamage(victim, ent, attacker, Float:damage, bits) {     if (get_user_team(attacker) == 1 && get_user_team(victim) == 2)     {         return HAM_SUPERCEDE;     }     return HAM_IGNORED; }


All times are GMT -4. The time now is 21:08.

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