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

auto switch player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
generals
Senior Member
Join Date: Aug 2018
Old 02-10-2020 , 09:16   auto switch player
Reply With Quote #1

hi guys

i want this simple plugin:

Auto Switch only 1 player of ct with 1 player of t every round. Switch will be random (In other words, switch 1 player in both teams)

i waiting for your help, this is important for me. tnx

Last edited by generals; 02-10-2020 at 09:19.
generals is offline
Pilo
AlliedModders Donor
Join Date: Jan 2019
Location: Israel
Old 02-15-2020 , 04:58   Re: auto switch player
Reply With Quote #2

Message me on discord : Pilo#8253
__________________

Taking Private(PAID) Plugins In PM
Feel free to Donate with PayPal
Feel free to message me in Discord Pilo#8253
Total donated : 25$
Pilo is offline
LuqS
AlliedModders Donor
Join Date: Jun 2019
Location: Israel
Old 02-21-2020 , 16:13   Re: auto switch player
Reply With Quote #3

Hey generals!

Here is the plugin you asked for
(Tested with a bot, use "bot_quota 1" so it wont add more than one bot)
Attached Files
File Type: sp Get Plugin or Get Source (PlayerSwitch.sp - 116 views - 1,020 Bytes)
LuqS is offline
Cruze
Veteran Member
Join Date: May 2017
Old 02-22-2020 , 01:19   Re: auto switch player
Reply With Quote #4

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

#pragma newdecls required
#pragma semicolon 1

public Plugin myinfo 
{
    
name "Team Switcher",
    
author "LuqS, Cruze",
    
description "Switching one player of both team every round.",
    
version "1.1",
    
url ""
};

public 
void OnPluginStart()
{
    
HookEvent("round_prestart"Event_RoundStartEventHookMode_Pre);
}

public 
void Event_RoundStart(Event event, const char[] namebool dontBroadcast)
{
        
int count 0;
        
int clients[MAXPLAYERS+1];
        for(
int i 1<= MaxClientsi++)
        {
                if(
IsClientInGame(i) && GetClientTeam(i) == 3)
                {
                        
clients[count++] = i;
                }
        }

        if(
count 0)
        {
                
int ranT clients[GetRandomInt(0count-1)];
                
CS_SwitchTeam(ranTCS_TEAM_T);
        }
        
count 0;
        for(
int i 1<= MaxClientsi++)
        {
                if(
IsClientInGame(i) && GetClientTeam(i) == 2)
                {
                        
clients[count++] = i;
                }
        }

        if(
count 0)
        {
                
int ranCT clients[GetRandomInt(0count-1)];
                
CS_SwitchTeam(ranCTCS_TEAM_CT);
        }

I think he needs this. Didn't try to compile and didn't test.
__________________
Taking paid private requests! Contact me

Last edited by Cruze; 02-22-2020 at 01:24. Reason: Spacing ~_~
Cruze is offline
generals
Senior Member
Join Date: Aug 2018
Old 02-28-2020 , 07:46   Re: auto switch player
Reply With Quote #5

hi brothers .. tnx for help but i have error on startup

error log with sourcemod 1.8:

PHP Code:
L 02/28/2020 16:15:40: [SMFailed to load plugin "PlayerSwitch.smx"Unable to load plugin (no debug string table). 
sourcemod 1.11

PHP Code:
L 02/28/2020 16:12:27: [SMException reportedGame event "round_prestart" does not exist
L 02
/28/2020 16:12:27: [SMBlamingPlayerSwitch.smx
L 02
/28/2020 16:12:27: [SMCall stack trace:
L 02/28/2020 16:12:27: [SM]   [0HookEvent
L 02
/28/2020 16:12:27: [SM]   [1Line 19PlayerSwitch.sp::OnPluginStart
L 02
/28/2020 16:12:27: [SMUnable to load plugin "PlayerSwitch.smx"Error detected in plugin startup (see error logs
Edit:

i change round_prestart to round_start . plugin working.. but it have more bug

first plugin (LuqS): sourcetv joined to t

second plugin (Cruze): Replaced the player but remain the same team (switched me from ct to terror .but just changed ct skin to terror skin..im just now in ct)

can u help?

Edit2:

i changed round_start to round_end (second plugin fixed).. tnx

Cruze..can you add 1 cvar to this plugin?

sm_number_of_players_to_switch "value"

Last edited by generals; 02-28-2020 at 08:17.
generals is offline
Reply


Thread Tools
Display Modes

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 19:42.


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