Raised This Month: $51 Target: $400
 12% 

Solved CS:S Script problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kshishu
Junior Member
Join Date: Mar 2016
Location: Opole
Old 03-09-2017 , 11:24   CS:S Script problem
Reply With Quote #1

Hello,

I have plugin which is: moving all players to spec then getting random 2 players and moving them to CT and TT then is knife fight between these to players and next is choosing players from spec(menu -> respawn).
AND this is what I need = These two random players must be protected from:
AddCommandListener(change_team_block, "chooseteam");
AddCommandListener(change_team_block, "joinclass");
AddCommandListener(change_team_block, "jointeam");

Why I need to protect changing teams? Some people are new at my server and they don't know all the rules. I want to help them and have nice automatic pug/mix system.

Here is some code:

1. This is how can I get 2 random people from SPEC
Code:
              
else if(StrEqual(Item, "Choosing"))
    {
        for(int client = 1; client <= MaxClients; client++)
        if (IsClientInGame(client))
            ChangeClientTeam(client, 1);
                    
        PrintToChatAll("%c[MD WAR]%c Choosing player WON!",GREEN,YELLOW);
        PrintToChatAll("%c[MD WAR]%c Choosing two random players!", GREEN,YELLOW);
                
        ChooseAcces_ID = GetRandomClientFromSpect();
        ChangeClientTeam(ChooseAcces_ID, 2);
        ChooseAcces_Next = GetRandomClientFromSpect();
                
        if(ChooseAcces_Next == ChooseAcces_ID)
        {
            ChooseAcces_Next = GetRandomClientFromSpect();
            if(ChooseAcces_Next == ChooseAcces_ID)
        {
            ChooseAcces_Next = GetRandomClientFromSpect();
        }
    }
    
    PrintToChatAll("%c[MD WAR]%c Selecting: %c%N%c i %c%N %c!", GREEN,YELLOW, GREEN, ChooseAcces_ID, YELLOW, GREEN, ChooseAcces_Next, YELLOW);
                
    ServerCommand("mp_restartgame 1");
    
    CreateTimer(3.0, Timer_MoveClients, _, TIMER_FLAG_NO_MAPCHANGE);
}
            
public Action Timer_MoveClients(Handle timer)
{    
    ChangeClientTeam(ChooseAcces_Next, 3);
    
    PrintToChatAll("%c[MD WAR]%c Selecting will start after knifefight !", GREEN, YELLOW);
    
    KnifeBattle = 1;
    CreateTimer(1.5, ko3settings);
}
Code:
stock int GetRandomClientFromSpect()
{
    int[] clients = new int[MaxClients+1];
    int iCount;
    
    for (int i = 1; i <= MaxClients; i++)
        if(i > 0 && IsValidClient(i) && !IsFakeClient(i) && GetClientTeam(i) == 1) clients[iCount++] = i;
    
    return (iCount == 0) ? 0 : clients[GetRandomInt(0, iCount-1)];
}
blocking:

AddCommandListener(change_team_block, "chooseteam");
AddCommandListener(change_team_block, "joinclass");
AddCommandListener(change_team_block, "jointeam");

Code:
public Action:change_team_block(client, const String:command[], argc)
{
    if (GetConVarInt(sm_mdam_block_change_team) == 1)
    {
        if(!ChooseAcces_ID || !ChooseAcces_Next)
        {
            PrintToChat(client, "%c[MD WAR]%c You can't change team while choosing players is on.",GREEN,YELLOW);
            return Plugin_Handled;
        }
    }
    return Plugin_Continue;
}
This what I wrote don't work... and I have no idea how can I protect these two guys...
__________________




Last edited by kshishu; 03-12-2017 at 18:12. Reason: @closed
kshishu is offline
Send a message via Skype™ to kshishu
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 16:44.


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