This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Method to check last CT


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
danielo_o
Member
Join Date: Mar 2011
Old 08-19-2012 , 20:11   Method to check last CT
Reply With Quote #1

Anyone knows a method to check the last CT and give him health and armour?
I tried many ways but my server is crashing.
danielo_o is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 08-19-2012 , 20:37   Re: Method to check last CT
Reply With Quote #2

Hook DeathMsg and check the total amount of alive players using get_players. Flags for that function can be found on the wiki.
Backstabnoob is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-20-2012 , 04:59   Re: Method to check last CT
Reply With Quote #3

Like Backstabnoob said, check this every DeathMsg event
Code:
new iPlayers[33], iNum;
get_players(iPlayers, iNum, "ahe", "CT");

if(iNum == 1) {
    //do something
}
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 08-20-2012 at 07:03.
Alka is offline
zekStein
Member
Join Date: Feb 2011
Location: Romania :(
Old 08-20-2012 , 07:01   Re: Method to check last CT
Reply With Quote #4

Quote:
Originally Posted by Alka View Post
Like Backstabnoob said, check this every DeathMsg event
Code:
int iPlayers[33], iNum;
get_players(iPlayers, iNum, "ahe", "CT");

if(iNum == 1) {
    //do something
}
Oh my dear Alka, int ? )) What times ... what times ...
__________________
DUMITRU
zekStein is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-20-2012 , 07:03   Re: Method to check last CT
Reply With Quote #5

Quote:
Originally Posted by zekStein View Post
Oh my dear Alka, int ? )) What times ... what times ...
xD excuse me
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 08-20-2012 , 09:05   Re: Method to check last CT
Reply With Quote #6

you should add a global boolean to check if CT already received hp and armor, otherwise last CT will receive health and armour every time he kills a terrorist
jimaway is offline
hyphen
Senior Member
Join Date: Aug 2011
Old 08-20-2012 , 09:06   Re: Method to check last CT
Reply With Quote #7

Just an added note. Hook HLTV event for deathmsg.

And Alka I used to do the same mistakes few times.. int vs new

Last edited by hyphen; 08-20-2012 at 09:06.
hyphen is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 08-20-2012 , 12:44   Re: Method to check last CT
Reply With Quote #8

Quote:
Originally Posted by jimaway View Post
you should add a global boolean to check if CT already received hp and armor, otherwise last CT will receive health and armour every time he kills a terrorist
Can also be done using automatons.

Code:
public EventDeathMsg( ) < not_given_yet > {      //...      if( iNum == 1 )      {           //... give items           state given      } } public EventDeathMsg( ) < given > { } public Round_Start( )      state not_given_yet

Last edited by Backstabnoob; 08-20-2012 at 12:44.
Backstabnoob is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-20-2012 , 20:08   Re: Method to check last CT
Reply With Quote #9

@Backstabnoob - useless? Why give a certain state when you can include the code you want to execute in that if() ...
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 08-21-2012 , 06:46   Re: Method to check last CT
Reply With Quote #10

Please read the post I quoted...
Backstabnoob 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 16:41.


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