AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Check last player (https://forums.alliedmods.net/showthread.php?t=244601)

pob18 07-20-2014 20:38

Check last player
 
How to check every round the last player?

Flick3rR 07-20-2014 20:40

Re: Check last player
 
What do you exactly mean by "last player"?

pob18 07-20-2014 20:42

Re: Check last player
 
When the last player is alone, no mather if TT/CT, do some function...

Phant 07-20-2014 20:50

Re: Check last player
 
Study "miscstats.sma":
PHP Code:

public client_death(killervictimwpnindexhitplaceTK)
{
    new 
cts[32], ts[32], ctsnumtsnum
    get_players
(ctsctsnum"ae""CT")
    
get_players(tstsnum"ae""TERRORIST")
    
    if(
ctsnum == && tsnum == 1)
    {
        
// hi
    
}



pob18 07-20-2014 20:54

Re: Check last player
 
Also, what are the function to mute ct/tt/all players?

mottzi 07-20-2014 21:48

Re: Check last player
 
This is not the way this forums work. You are allowed to ask questions about scripting. And by that I dont mean random and multiple questions in one thread.

Flick3rR 07-21-2014 06:16

Re: Check last player
 
OP, you can simply use get_playersnum() and check if it's 1 when you need. If you need to check if the player is alone in the server, you can do it when player disconnects. AFAIK it's called when player is already disconnected, but you can set a little task to avoid getting the wrong number.

pob18 07-25-2014 20:31

Re: Check last player
 
does not work correctly

PHP Code:

#include <amxmodx> 
#include <amxmisc> 

#include <fakemeta> 
#include <cstrike> 

new MuteTeams[CsTeams


public 
plugin_init() { 
     
    
register_forwardFM_Voice_SetClientListening"MetaSetClientListeningPre"


public 
MetaSetClientListeningPreinspkbool:CanListen 

    if( 
is_user_connectedspk ) && MuteTeams[cs_get_user_teamspk )] ) 
    { 
        
engfuncEngFunc_SetClientListeninginspkfalse 
        
forward_returnFMV_CELLfalse 
         
        return 
FMRES_SUPERCEDE
    } 
     
    return 
FMRES_IGNORED


public 
lastPlayer(id

    new 
menu menu_create("You are the last player in your team! ^nMute all players?""lastPlayer_handler"

    new 
TeamMuted[32
    
formatexTeamMuted32"Mute all is: \y%s", ( MuteTeams[CS_TEAM_T] && MuteTeams[CS_TEAM_CT] ) ? "Enabled" "Disabled" 
    
menu_additemmenuTeamMuted"0" 
     
    
formatexTeamMuted32"Mute T is: \y%s"MuteTeams[CS_TEAM_T] ? "Enabled" "Disabled" 
    
menu_additemmenuTeamMuted"1" 
     
    
formatexTeamMuted32"Mute CT is: \y%s"MuteTeams[CS_TEAM_CT] ? "Enabled" "Disabled" 
    
menu_additemmenuTeamMuted"2" 
     
    
menu_setpropmenuMPROP_EXITMEXIT_ALL 
    
menu_displayidmenu
     
    return 
PLUGIN_HANDLED



public 
lastPlayer_handleridmenuitem 

    if( 
item == MENU_EXIT 
    { 
        
menu_destroymenu 
     
        return 
PLUGIN_HANDLED
    } 
     
    new 
accesscallbackdata[6
    
menu_item_getinfomenuitemaccessdata5__callback 
         
    new 
choice str_to_numdata 
         
    switch( 
choice 
    { 
        case 
12
        { 
            
MuteTeams[CsTeams:choice] = !MuteTeams[CsTeams:choice
        } 
                 
        default: 
        { 
            if( !
MuteTeams[CS_TEAM_T] || !MuteTeams[CS_TEAM_CT] ) 
            { 
                
MuteTeams[CS_TEAM_T] = 
                MuteTeams
[CS_TEAM_CT] = 
            

                         
            else 
            { 
                
MuteTeams[CS_TEAM_T] = 
                MuteTeams
[CS_TEAM_CT] = 
            

        } 
    } 
         
    
lastPlayer(id
         
    return 
PLUGIN_HANDLED


public 
client_death(killervictimwpnindexhitplaceTK

    new 
cts[32], ts[32], ctsnumtsnum 
    get_players
(ctsctsnum"ae""CT"
    
get_players(tstsnum"ae""TERRORIST"
     
    if(
ctsnum == && tsnum == 1
    { 
        
// Show mute menu to the last player 
        
lastPlayer(killer
    } 



pob18 07-30-2014 12:24

Re: Check last player
 
anyone?

baneado 07-30-2014 12:47

Re: Check last player
 
make a loop with all players and use set_speak


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

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