AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need someone to Edit Script (https://forums.alliedmods.net/showthread.php?t=133541)

Kantel 07-26-2010 13:34

Need someone to Edit Script
 
Need help editing. Fairly new to coding, took reasoning from tutorials and other works.
Scenario: Player joins server, if the teams are 10T : 5CT, switch to T based on 2:1 ratio.
Switching teams it must be 13T : 5CT or else stay whichever team player is at.
Did I script this right to follow the scenario?

Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <cstrike>

#define PLUGIN "Ratio Manager"
#define VERSION "1.1"
#define AUTHOR "T3A"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
}
enum CsTeams {
    CS_TEAM_UNASSIGNED = 0,
    CS_TEAM_T,
    CS_TEAM_CT,
    CS_TEAM_SPECTATOR,
};
stock get_new_team(iCvar)
{
    switch(iCvar)
    {
        new iTeam;
       
        new iTCount = g_iPlayers[TEAM_T];
        new iCTCount = g_iPlayers[TEAM_CT];
        if (iTCount /2 +2 < iCTcount)
        {
            return TEAM_T;
        }
        else
        return iTeam;
    }
}
stock get_switch_team(id)
{
    new iTeam;
   
    new iTCount = g_iPlayers[TEAM_T]
    new iCTCount = g_iPlayers[TEAM_CT]
    {
        case TEAM_T: iTCount
        case TEAM_CT: iCTCount
    }
    if (iTCount /2 +3 > iCTCount)
    {
        return iTeam
    }
    else
    {
        return TEAM_T
    }
}


fysiks 07-26-2010 18:24

Re: Ratio'ing teams help
 
Quote:

Originally Posted by Kantel (Post 1252434)
Bump ):

You can wait.

Kantel 07-27-2010 16:11

Re: Need someone to Edit Script
 
Help please

Bugsy 07-27-2010 16:28

Re: Need someone to Edit Script
 
Your code is will not work. There are a few team management plugins that already exist and code on the forums that can help with catching team changes and acting on them.

Kantel 07-27-2010 16:35

Re: Need someone to Edit Script
 
The ones on forums are not the ones I'm looking for. It sorts the team, not let the person choose what team they want to be on.

fysiks 07-27-2010 19:30

Re: Need someone to Edit Script
 
Quote:

Originally Posted by Kantel (Post 1253402)
The ones on forums are not the ones I'm looking for. It sorts the team, not let the person choose what team they want to be on.

He was saying that you can learn from the code of those plugin to figure out how to do certain things that they already do. This is Scripting Help. That's one of the ways to learn. :)

Bugsy 07-27-2010 20:04

Re: Need someone to Edit Script
 
Take a look at this

http://forums.alliedmods.net/showthread.php?t=112256

Kantel 07-27-2010 20:57

Re: Need someone to Edit Script
 
I saw that thread, but as the author mentions, that script does not work. So learning from a script that doesn't work = pointless. I did see however the other ratio someone else posted within the thread, but that too isn't what I'm looking for.
I'll attempt to learn from those scripts though, I'll post back with what I come up with and see if you guys can further my knowledge maybe? Thanks for the help


All times are GMT -4. The time now is 00:14.

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