Raised This Month: $32 Target: $400
 8% 

Detect last alive ct/tt


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Apb hq
Senior Member
Join Date: Apr 2014
Old 12-13-2018 , 03:17   Detect last alive ct/tt
Reply With Quote #1

Hi guys can someone send me a code where i will be able to detect the last alive ct / tt i wanted to add a death spirit on the last tt/ct’s origin thanks in advance
Apb hq is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 12-13-2018 , 06:19   Re: Detect last alive ct/tt
Reply With Quote #2

PHP Code:

stock get_last_alive_ct_player
()
{
     new 
players[32], pnumlast_alive_ct;
     
get_players(playerspnum,"ahe""CT")

     if(
pnum == 1last_alive_ct players[0];

     return 
last_alive_ct;

It will return 0 if the last ct player wasnt found. Otherwise it will return his index(1-32)

For terrorist just replace the CT with TERRORIST in get_players native.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 12-13-2018 at 08:36.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Apb hq
Senior Member
Join Date: Apr 2014
Old 12-14-2018 , 14:11   Re: Detect last alive ct/tt
Reply With Quote #3

Bro thanks for the stock i have tried to implement in my code but it never works (the sprite doesn't appear when the last ct / t is killed)

How to add your stock in this code thanks in advance
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <engine>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new Snow//g_iLastId;
new const SpriteSnow[  ] = "sprites/sprt.spr"
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event"DeathMsg",  "event_DeathMsg",  "a" );
}

public 
plugin_precache()
{
    
Snow precache_modelSpriteSnow );

}

public 
event_DeathMsg(  ) {    
    
    new 
iVictim  read_data);
    

        new 
Origin];
        
get_user_originiVictimOrigin );
        
            
message_beginMSG_BROADCAST,SVC_TEMPENTITY );
    
write_byteTE_SPRITETRAIL );
    
write_coordOrigin] );                // start position (X)
    
write_coordOrigin] );                // start position (Y)
    
write_coordOrigin] );                // start position (Z)
    
write_coordOrigin] );                // end position (X)
    
write_coordOrigin] );                // end position (Y)
    
write_coordOrigin] + random_num4060 ) );    // end position (Z)
    
write_shortSnow );                // sprite index
    
write_byte5);                // number of snow
    
write_byte);                    // life in 0.1's
    
write_byte);                // scale in 0.1's
    
write_byte20 );                    // velocity along vector in 10's
    
write_byte(10 );            // randomness of velocity in 10's
    
message_end(  );
    


Last edited by Apb hq; 12-14-2018 at 14:12.
Apb hq is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 12-14-2018 , 14:20   Re: Detect last alive ct/tt
Reply With Quote #4

PHP Code:

stock get_last_player_alive
()
{
     new 
players[32], pnum;
     
get_players(playerspnum,"ah")

     if(
pnum == 1) return players[0];

     return 
0;
}  

public 
event_DeathMsg(  ) {    
    
    new 
iVictim  get_last_player_alive();

    if(!
iVictim) return;


      ...... 
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 06:58.


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