Raised This Month: $ Target: $400
 0% 

[Request] Replace Disconnected T EDIT


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sigerman
Senior Member
Join Date: Aug 2013
Location: Argentina, Bs.As.
Old 12-16-2019 , 09:34   [Request] Replace Disconnected T EDIT
Reply With Quote #1

I've put in the original thread (https://forums.alliedmods.net/showpo...1&postcount=53) a report of the problem I've been having. As none was interested in my text and time has passed by, I am forced to create a request

The plugin is useful to deathrun mod. It replaces a disconnected T with a random player of the CT team.

The problem (as explained in here: https://forums.alliedmods.net/showpo...1&postcount=53 ) and I quote

Quote:
This plugin shouldn't work with 2 players connected on the server. It should work with 3 or more players only

Why? Because when there are 2 players, If the tt quit, the ct should remain playing as a ct, deathrun won't start with 1 player connected, none wants to be tt if the server is empty
Extra Info: Just to clarify, the edit should ignore bots and hltv users.
sigerman is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 12-16-2019 , 09:53   Re: [Request] Replace Disconnected T EDIT
Reply With Quote #2

Did you not explained if player that will be moved need to be alive?

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>

public plugin_init()
{
    
register_plugin("Deahrun Test","0.1","SmileY");
}

public 
client_disconnected(id,bool:bDrop,szMsg[],iLen)
{
    if(
get_playersnum() > 2)
    {
        if(
get_ent_data(id,"CBasePlayer","m_iTeam") == 1)
        {
            new 
iPlayers[MAX_PLAYERS],iNum;
            
get_players(iPlayers,iNum,"che","CT");
            
            if(
iNum)
            {
                new 
iPlayer iPlayers[random(iNum)];
            
                
cs_set_user_team(iPlayer,CS_T_LEET);
            
                new 
szName[MAX_NAME_LENGTH];
                
get_user_name(iPlayer,szName,charsmax(szName));
            
                
client_print_color(0,iPlayer,"[DEATHRUN] ^3%s^1 was replaced into Terrorists team..",szName);
            }
        }
    }

Ps. Not tested
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 12-17-2019 at 06:23.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Natsheh
Veteran Member
Join Date: Sep 2012
Old 12-17-2019 , 05:42   Re: [Request] Replace Disconnected T EDIT
Reply With Quote #3

PHP Code:
new iPlayer random(iNum); 
::
PHP Code:
if(!iNum ) return;
 new 
iPlayer iPlayers[random(iNum)]; 
__________________
@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-17-2019 at 05:43.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 12-17-2019 , 06:21   Re: [Request] Replace Disconnected T EDIT
Reply With Quote #4

Quote:
Originally Posted by Natsheh View Post
PHP Code:
new iPlayer random(iNum); 
::
PHP Code:
if(!iNum ) return;
 new 
iPlayer iPlayers[random(iNum)]; 
Yes my fault, i guess iNum aways will have an player since get_playersnum() is being used, thanks!
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 12-17-2019 at 06:23.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
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:39.


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