AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   auto switch player (https://forums.alliedmods.net/showthread.php?t=321421)

generals 02-10-2020 09:16

auto switch player
 
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

Pilo 02-15-2020 04:58

Re: auto switch player
 
Message me on discord : Pilo#8253

LuqS 02-21-2020 16:13

Re: auto switch player
 
1 Attachment(s)
Hey generals!

Here is the plugin you asked for :D
(Tested with a bot, use "bot_quota 1" so it wont add more than one bot)

Cruze 02-22-2020 01:19

Re: auto switch player
 
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.

generals 02-28-2020 07:46

Re: auto switch player
 
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"


All times are GMT -4. The time now is 15:44.

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