Raised This Month: $ Target: $400
 0% 

Only 1 Terrorist


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
skatzfz
Senior Member
Join Date: Apr 2014
Old 06-27-2014 , 17:45   Only 1 Terrorist
Reply With Quote #1

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?
skatzfz is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-27-2014 , 18:04   Re: Only 1 Terrorist
Reply With Quote #2

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].
__________________

Last edited by Flick3rR; 06-28-2014 at 06:05.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
skatzfz
Senior Member
Join Date: Apr 2014
Old 06-27-2014 , 20:30   Re: Only 1 Terrorist
Reply With Quote #3

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?

Last edited by skatzfz; 06-27-2014 at 20:31.
skatzfz is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 06-27-2014 , 22:33   Re: Only 1 Terrorist
Reply With Quote #4

For the sake of users trying to help you, please wrap your code in tags ( such as code, php, etc. ).
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
Freezo Begin
BANNED
Join Date: Mar 2014
Location: Morocco
Old 06-28-2014 , 05:50   Re: Only 1 Terrorist
Reply With Quote #5

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; }

Last edited by Freezo Begin; 06-28-2014 at 05:56.
Freezo Begin is offline
skatzfz
Senior Member
Join Date: Apr 2014
Old 06-28-2014 , 14:43   Re: Only 1 Terrorist
Reply With Quote #6

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.
skatzfz is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-28-2014 , 15:00   Re: Only 1 Terrorist
Reply With Quote #7

Ham_TakeDamage with return HAM_SUPERCEDE will do the work for you.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
skatzfz
Senior Member
Join Date: Apr 2014
Old 06-28-2014 , 15:15   Re: Only 1 Terrorist
Reply With Quote #8

can you edit the plugin with that?
skatzfz is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-28-2014 , 15:20   Re: Only 1 Terrorist
Reply With Quote #9

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.
__________________

Last edited by Flick3rR; 06-28-2014 at 15:21.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Freezo Begin
BANNED
Join Date: Mar 2014
Location: Morocco
Old 06-28-2014 , 19:21   Re: Only 1 Terrorist
Reply With Quote #10

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; }
Freezo Begin 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 21:08.


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