AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   id of died player in team (https://forums.alliedmods.net/showthread.php?t=232579)

xxxperts 01-01-2014 20:51

id of died player in team
 
when the player is died and he is terrorist then wht will be his Team Name when he is spectating someone..i want to loop msg to all that player who are died in that team which is winner of that round..

PHP Code:

UNASSIGNED 0,
1,
CT 2,
SPECTATOR 

here is my code this works but not for players who died in winning team..
PHP Code:

public Round_End()
{
    static 
textmsg[22];
    
get_msg_arg_string(2textmsg21);
        
    if(
equal(textmsg"#Terrorists_Win"))
    {
        new 
iPlayers[32], iNumplayer
        
get_players(iPlayersiNum"a"); 
        
        for(new 
i<= iNumi++) 
        { 
            
player iPlayers[i]; 
            
            if(
get_user_team(player) == 1
            {
                
here is msg when t wins
            
}
            
            if(
get_user_team(player) == 2)
            {
                
when t wins this msg display to all ct players
            
}
        }
    }
    else if(
equal(textmsg"#CTs_Win"))
    {
        new 
iPlayers[32], iNumplayer
        
get_players(iPlayersiNum"a"); 
        
        for(new 
i<= iNumi++) 
        { 
            
player iPlayers[i]; 
            
            if(
get_user_team(player) == 2
            {
                
// here is msg when ct wins
            
}
            
            if(
get_user_team(player) == 1)
            {
                
// when ct wins this msg display to all terrorist players
            
}
        }
    }
    return 
PLUGIN_CONTINUE;



11922911 01-01-2014 21:59

Re: id of died player in team
 
Quote:

/* Sets indexes of players.
* Flags:
* "a" - don't collect dead players.
* "b" - don't collect alive players.
* "c" - skip bots.
* "d" - skip real players.
* "e" - match with team.
* "f" - match with part of name.
* "g" - ignore case sensitivity.
* "h" - skip HLTV.
* Example: Get all alive CTs: get_players(players,num,"ae","CT") */
Since you aim for dead players, so:
Code:
get_players(iPlayers, iNum, "b");

Use flag "b" instead of "a"


Also, or you can just do:
Code:
get_players(iPlayers, iNum, "be", "TERRORIST");

It means find all player who is died and in Terrorist team. so if you use that, you don't need check again the team inside the loop.

xxxperts 01-01-2014 23:27

Re: id of died player in team
 
TYSM..... i will try and response...:D

^SmileY 01-02-2014 16:21

Re: id of died player in team
 
PHP Code:

#include <amxmodx>

public plugin_init()
{
    
register_plugin("Test",AMXX_VERSION_STR,"AMXX Dev Team");
    
    
register_event("SendAudio","ev_SendAudio","a","2=%!MRAD_terwin","2=%!MRAD_ctwin");
}

public 
ev_SendAudio()
{
    new 
sTeam[22];
    
read_data(2,sTeam,charsmax(sTeam));
    
    new 
iPlayers[32],iNum,iPlayer;
    
get_players(iPlayers,iNum,"bche",(containi(sTeam,"terwin") != -1) ? "TERRORIST" "CT");
    
// b = DEAD Players, ch will remove BOTs and HLTVs, e Option will based on Teams
    
    
for(new i;iNum;i++)
    {
        
iPlayer iPlayers[i];
        
        
client_print
        
(
            
iPlayer,
            
print_chat,
            
"Dead Boys and Girls your team has won the round!"
        
);
    }




All times are GMT -4. The time now is 10:13.

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