Raised This Month: $ Target: $400
 0% 

CSGO auto join


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
driftz6969
New Member
Join Date: Jan 2015
Old 01-10-2015 , 13:51   CSGO auto join
Reply With Quote #1

Basically need a plugin that disables the team menu and forces the player to spawn even though they are afk and viewing the motd. I saw that panda has two things that are supposed to do something similar. The realeased plugin does do what I need it to, and I can't get the code he posted in another thread to actually do anything. Would appreciate the help, thanks!
Pandas code that I cant get to work below so you dont have to search.

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

public OnPluginStart()
{
    
HookEvent("player_connect_full"Event_OnFullConnectEventHookMode_Pre);
    
HookEvent("cs_match_end_restart"Event_OnMatchRestartEventHookMode_Pre);
    
HookEvent("player_team"Event_OnPlayerTeamEventHookMode_Pre);
    
HookEvent("player_death"Event_OnPlayerDeathEventHookMode_Pre);
    
AddCommandListener(Command_Join"jointeam");
}

public 
Action:Event_OnFullConnect(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if(!
client || !IsClientInGame(client))
        return 
Plugin_Continue;

    new 
iRediBlue;
    for(new 
1<= MaxClientsi++)
    {
        if(!
IsClientInGame(i))
            continue;

        new 
iTeam GetClientTeam(i);
        if(
iTeam == CS_TEAM_T)
            
iRed++;
        else if(
iTeam == CS_TEAM_CT)
            
iBlue++;
    }

    if(
iRed iBlue)
        
SetEntProp(clientProp_Send"m_iTeamNum"CS_TEAM_T);
    else
        
SetEntProp(clientProp_Send"m_iTeamNum"CS_TEAM_CT);

    
ForcePlayerSuicide(client);
    
CS_RespawnPlayer(client);
    return 
Plugin_Continue;
}

public 
Action:Event_OnMatchRestart(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
iRediBlueiJoin;
    for(new 
1<= MaxClientsi++)
    {
        if(!
IsClientInGame(i))
            continue;

        switch(
GetClientTeam(i))
        {
            case 
CS_TEAM_T:
                
iRed++;
            case 
CS_TEAM_CT:
                
iBlue++;
        }
    }

    for(new 
1<= MaxClientsi++)
    {
        if(!
IsClientInGame(i))
            continue;

        if(
iRed iBlue)
            
iJoin CS_TEAM_T;
        else if(
iBlue iRed)
            
iJoin CS_TEAM_CT;
        else
            
iJoin GetRandomInt(CS_TEAM_TCS_TEAM_CT);

        switch(
iJoin)
        {
            case 
CS_TEAM_T:
                
iRed++;
            case 
CS_TEAM_CT:
                
iBlue++;
        }

        
ChangeClientTeam(iiJoin);
    }
}

public 
Action:Event_OnPlayerTeam(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if(!
client || !IsClientInGame(client))
        return 
Plugin_Continue;

    if(!
IsPlayerAlive(client))
        
CreateTimer(0.1Timer_RespawnGetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
    return 
Plugin_Continue;
}

public 
Action:Timer_Respawn(Handle:timerany:userid)
{
    new 
client GetClientOfUserId(userid);
    if(!
client)
        return 
Plugin_Continue;

    new 
iTeam GetClientTeam(client);
    if(
iTeam <= CS_TEAM_SPECTATOR)
        return 
Plugin_Continue;

    if(
IsPlayerAlive(client))
        return 
Plugin_Continue;

    
CS_RespawnPlayer(client);

    return 
Plugin_Continue;
}

public 
Action:Command_Join(client, const String:command[], argc)
{
    
decl String:sJoining[8];
    
GetCmdArg(1sJoiningsizeof(sJoining));
    new 
iJoining StringToInt(sJoining);
    if(
iJoining == CS_TEAM_SPECTATOR)
        return 
Plugin_Continue;

    new 
iTeam GetClientTeam(client);
    if(
iJoining == iTeam)
        return 
Plugin_Handled;
    else
    {
        
SetEntProp(clientProp_Send"m_iTeamNum"iJoining);
        
ForcePlayerSuicide(client);
        
CS_RespawnPlayer(client);
    }

    return 
Plugin_Continue;
}


public 
Action:Event_OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if(!
client || !IsClientInGame(client))
        return 
Plugin_Continue;

    
CreateTimer(0.1Timer_RespawnGetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);

    return 
Plugin_Continue;

driftz6969 is offline
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 05:08.


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