Im trying to write a plugin that will check the total deaths of each team in a combat map and if there is a big gap boost the losing teams experience. I cant get this to compile:
Code:
/*
co_xpbalance
by: Rorthic
Purpose: balance a co match by adding xp to the team that is losing by a lot,
checked by deaths.
*/
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <engine>
#include <ns>
#define DEATHRATIO = 5
#define BALANCETIME = 60.0
#define XPBONUS = 10
new PLUGIN[]="co_xp_balance"
new AUTHOR[]="Rorthic"
new VERSION[]="1.00"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
if (!(ns_is_combat()))
return PLUGIN_CONTINUE
}
//set_task(1.0, "xpbalance",_,_,_,"b")
public xpbalance()
{
new aliendeaths //alien teams total deaths
new marinedeaths //marine teams total death
new pdeathcount //how many deaths the player has
new class //used to check team
new i //counter
for (i = 1; i <= get_maxplayers(); i++)
{
class = ns_get_class(i)
if (!(class == CLASS_MARINE || class == CLASS_JETPACK || class == CLASS_HEAVY)) //alien team check
{
pdeathcount = ns_get_deaths(i)
aliendeaths = aliendeaths + pdeathcount
}
else //marine team only thing left
{
pdeathcount = ns_get_deaths(i)
marinedeaths = marinedeaths + pdeathcount
}
}
if (marinedeaths > aliendeaths + DEATHRATIO)
{
for (i = 1; i <= get_maxplayers(); i++)
new class = ns_get_class(i)
{
if (class == CLASS_MARINE || class == CLASS_JETPACK || class == CLASS_HEAVY)
{
new xp = ns_get_exp(i)
new newxp = xp + XPBONUS
ns_set_exp(i, newxp)
}
}
if (aliendeaths > marinedeaths + DEATHRATIO)
{
for (i = 1; i <= get_maxplayers(); i++)
new class = ns_get_class(i)
{
if (!(class == CLASS_MARINE || class == CLASS_JETPACK || class == CLASS_HEAVY))
{
new xp = ns_get_exp(i)
new newxp = xp + XPBONUS
ns_set_exp(i, newxp)
}
}
return PLUGIN_HANDLED
}
line 59 error 029: invalid expression, assumed zero
line 59 warning 215: expression has no effect
line 59 error 002 expected token: ";", but found ")"
line 59 error 029: invalid expression, assumed 0
line 59 fatal error 107: to many errors
line 59 is
Code:
if (marinedeaths > aliendeaths + DEATHRATIO)
i also know ill get the same errors on line 72 its basically the same.
also i dont understand how to get set_task to work, i had this
Code:
small set_task(60.0, "xpbalance",_,_,_,"b")
i thought that made xpbalance run every 60 seconds, but i commented it out to get everything else working first.
my questions:
1) whats with the "error 029: invalid expression, assumed 0" error
2) whats with the "error 002 expected token: ";", but found ")"" error
3) whats wrong with the set_task line, besides the comments "//"
any help is appreciated.