AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Onos blocker (https://forums.alliedmods.net/showthread.php?t=10525)

Newbster 02-21-2005 22:53

Onos blocker
 
Ok, ive been working on this onos blocker because the current ones i dislike. It compiles, but itdoesnt work. It wont let me onos. Can anyone help me? The point is to have at least 3 rines to every 1 ono.
Code:

#include <amxmod>
#include <ns2amx>
#include <amxmodx>
#include <engine>

public plugin_init()
{
        if(is_combat())
        {
                register_plugin("Onos Blocker","1.0.123.1","Newbster & Riot")
                register_impulse(117, "checkBlock",0)
                register_event("Countdown","gameStarting","a")
        }
}

public checkBlock(id)
{
        new Players[32], Float:aliens, Float:marines, Float:playerCount, Float: numonos
        //gets the number of marines... i think
        marines = get_players(Players,playerCount,"e","1")
        //ns_get_ent ( classname[], value )
        //^ THAT, is what we need to get the number of onoses on field i think.
        numonos = find_ent_by_class (-1,"onos")
        if ((marines/3) < numonos)       
                {
                client_print(id,print_chat,"[ONOSBLOCKER] You need to have 3 marines for every 1 onos, sorry!")
                return PLUGIN_HANDLED
        }
        else        {
                return PLUGIN_CONTINUE
        }
        return PLUGIN_CONTINUE
}

public gameStarting()
{
        return PLUGIN_CONTINUE
}


Freecode 02-22-2005 01:50

remove the
if(is_combat())
{
}

thing

Newbster 02-22-2005 02:56

But, i only want it to work during combat. not co.

f1del1ty.oXi 02-22-2005 08:17

well that made no sense, work in combat, not co. =\

Why not use it for NS as well, so if it's 1v3 aliens, one might have the indecency to go onos..:o I know I've seen it done before... Doesn't hurt to see if free's right. :o

Newbster 02-22-2005 21:40

sorry, co not ns. But can aanyone help me with getting it to work? (for co only)

Freecode 02-22-2005 22:35

dont noe much about NS but the register_plugin is called only once every map so if when map is loaded register_plugin is called and i doubt that is_combat() is set to true at that moment. so in my mind u never get to register ur commands. but i might be wrong since i dont play ns much.

Newbster 02-24-2005 22:18

can someone who does play ns and knows how to script help me?

Twilight Suzuka 02-25-2005 11:57

FreeCode is right. You put the code in the wrong position.

Take it out of plugin_init, and put it in your functions, like this:

Code:

public checkBlock(id)
{
        if(is_combat())
          {
                  new Players[32], Float:aliens, Float:marines, Float:playerCount, Float: numonos
                  //gets the number of marines... i think
                  marines = get_players(Players,playerCount,"e","1")
                  //ns_get_ent ( classname[], value )
                  //^ THAT, is what we need to get the number of onoses on field i think.
                  numonos = find_ent_by_class (-1,"onos")
                  if ((marines/3) < numonos) 
                      {
                      client_print(id,print_chat,"[ONOSBLOCKER] You need to have 3 marines for every 1 onos, sorry!")
                      return PLUGIN_HANDLED
                  }
                  else  {
                      return PLUGIN_CONTINUE
                  }
        }       
          return PLUGIN_CONTINUE
}

You still have to register the commands, no matter if its combat or not. But the commands dont have to function unless its combat, if you so choose it.

Newbster 02-27-2005 21:32

How do you register the commands?

Twilight Suzuka 02-27-2005 21:51

Well you registered an impulse...


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

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