AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   NS co experience boost plugin problems (https://forums.alliedmods.net/showthread.php?t=13267)

Rorthic 05-10-2005 03:40

NS co experience boost plugin problems
 
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.

Sandstorm 05-12-2005 01:01

Remove the = from your #defines

Rorthic 05-12-2005 03:02

thanks, i got it all working the #defines were part of the problem. Now ive noticed another small problem, when i check the team using the class it ignores the dead players. I dont want it to ignore them.

check for alien team using the class. This is the way i have it for aliens.
Code:
if (c == CLASS_SKULK || c == CLASS_GORGE || c == CLASS_LERK || c == CLASS_FADE || c == CLASS_ONOS || c == CLASS_GESTATE) //alien team check


check for team using get_user_team function
Code:
if( get_user_team( i ) == 2 ) //alien team check
if i change it to == 1 it works for mairines so im guessing 2 isnt the alien team number?!

any ideas how to keep it from ignoring the dead players?

karlos 05-12-2005 04:53

get_user_team(id) is almost the same as ns_get_class(id), ONLY for NS

EITHER use
team = entity_get_int(id,EV_INT_team) [ or pev(id,pev_team) ]

team 1 = rines, 2 = aliens
in MvM
1 = rines , 2 = rines2

OR:
teamname[32]
get_user_team(id,teamname,31)
and check if teamname is equal to
marine1team, alien1team, marine2team, alien2team ( names are self explaining which tam is which )

Rorthic 05-12-2005 18:54

thanks, i used
Code:
team = entity_get_int(id,EV_INT_team)
and it works perfectly now.


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

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