AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Why Does My Plugin not work? (https://forums.alliedmods.net/showthread.php?t=64267)

xsamar 12-11-2007 19:34

Why Does My Plugin not work?
 
Hello,

I have been coding a plugin for CS 1.6 to CONSTANTLY be monitoring to balance teams. When there is 2 people more on one team than the other, it should move one player over when they die.

Here is what i have so far, and i cant seem to see whats missing:

Code:

#include <amxmodx>
#include <engine>

#define MAXPLAYERS 32

new g_MaxPlayers
new g_UserTeam[MAXPLAYERS+1]

public plugin_init()
{
    register_plugin("Munda Team balancer","1.0.0","GGW")
 
    g_MaxPlayers = get_maxplayers()
}

public client_putinserver(id)
{
    if(is_user_hltv(id))
        return PLUGIN_CONTINUE
    else
    {
        g_UserTeam[id] = -1
        AutoAssignPlayer(id)
    }
    return PLUGIN_CONTINUE
}

stock get_team(id) return entity_get_int(id,EV_INT_team)
stock AutoAssignPlayer(id)
{
    //client_cmd(id,"autoassign")
    engclient_cmd(id,"autoassign")
    g_UserTeam[id] = -1
   
    new Name[32]
    get_user_name(id,Name,31)
}

public Event_RoundEnd()
{
    remove_task(1)
}


Vet 12-12-2007 00:44

Re: Why Does My Plugin not work?
 
Looks a lot like pieces EKS' NS Team Balancer code. I believe its customary to give credit where credit's due.

purple_pixie 12-12-2007 05:33

Re: Why Does My Plugin not work?
 
There is no way that plugin was written from scratch.

new g_MaxPlayers
new g_UserTeam[MAXPLAYERS+1]

When are either of these used?
What is that task for?

Have you realised this only does anything on client-put-in-server?

And why do you have a "get user team" stock, which is never used?
(And could be done more efficiently with a #DEFINE)

Why do you get the user's name into a variable and then never use it?

And last but not least: Do you have a clue?

xsamar 12-12-2007 19:33

Re: Why Does My Plugin not work?
 
It is bits and pieces from the NS plugin, and he will be given credit, when it works. No i dont have a clue what im doing.


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

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