Raised This Month: $ Target: $400
 0% 

Confused, extended spawn connect


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Len
Senior Member
Join Date: Dec 2007
Old 01-08-2011 , 12:35   Confused, extended spawn connect
Reply With Quote #1

I'm trying to extend the spawn time, IE someone connects joins a team and can spawn if it's less then X% of time into the round.
Also it's meant to block clcmd jointeam whilst already in a team unless the other team has 0 players or wants to join spectator.


Will my vars be permanent in my plugin or only when the plugin is called for example event RoundTime is called so the plugin is executed then handled or will it be working throughout server uptime?
Im going to make a listing of players that have been spawned already so they can't die then jointeam again inside the 40% of round time and spawn again, OR reconnect and do it again so I can't have that^


Also im unsure if I should call sort_players which loops get_players every time a new person connects or if I should set a var to count them as this could mean if the server isn't empty, I won't have a true list?



Also there is some compile errors if you look below:


(P.S there's alot of things I've done that I'm not sure about so if you see anything obvious please could you explain)


Script:
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <cstrike> #include <hamsandwich> /* Not nessecary as script does it by default */ #define mp_limitteams "0" /* vars that will definitely be used */ new time, team_select, Float:spawn_time, no_spawning, new players_ct[32], players_t[32], player[64] /* set the time they can still spawn after round started */ Float:spawn_time = get_cvar_num(mp_roundtime) * 60 Float:spawn_time = Float:spawn_time / 40% public plugin_init() {     register_plugin("Connect waiting", "1.0", "Len")     register_event(RoundTime, round_time(&time), a)     register_event(TeamInfo, select_team(&player), a, 2=TEAM_UNASSIGNED)     register_event(DeathMsg, no_spawn(&no_spawning), a)     register_event(RoundStart,round_start, a)     register_clcmd("jointeam", "block_jointeam") } /* set wether they have already spawned once this round */ public no_spawn() {     no_spawning = get_data(2)     player[no_spawning]_spawned = 1 } /* reset if they have spawned */ public round_start() {     new i     for (i = 1,i <= 32, i++)         players[i]_spawned = 0 } /* set if they already have connected and issue them a team*/ public select_team(&player) {     new id = get_data(1)     sort_players(players_ct, players_t)     player[id]_spawned = 1     if (players_t > players_ct) spawn_player(id, CS_TEAM_CT)         else if (players_t < players_ct) spawn_player(id, CS_TEAM_T)         else cs_set_user_team(id, CS_TEAM_CT)     return PLUGIN_HANDLED } /* block joining team unless, the team they want to join has no players */ public block_jointeam(id) {     new team[2]     read_argv(1, team, 1)         if (team[0] == '3')     {         cs_set_user_team(id, CS_TEAM_SPECTATOR)         return PLUGIN_CONTINUE     }         switch (cs_get_user_team(id)) {         case CS_TEAM_T:         {             if (!players_ct)                 spawn_player(id, CS_TEAM_CT)             else return PLUGIN_HANDLED         }         case CS_TEAM_CT:         {             if (!players_t)                 spawn_player(id, CS_TEAM_T)             else return PLUGIN_HANDLED         }     } } /* Save how many players are on teams CT and T */ public sort_players(&players_ct, &players_t) {     new players[32], num, i     get_players(players[32], num)         for(i = 1,i <= num,i++) {         switch (cs_get_user_team(players[i])         {                 case CS_TEAM_CT:             players_ct++                     case CS_TEAM_T:             players_t++         }     } } /* Save how much time has pasted since round started*/ public round_time(&time)     time = get_data(1) /* Set the players team and spawn if nessecary */ public spawn_player(id, team_select) {     cs_set_user_team(id, team_select)     public spawn_player(id, team_select) {     cs_set_user_team(id, team_select)         if ((time <= Float:spawn_time) && (!player[id]_spawned) &&     (cs_get_user_team(id) == TEAM_UNASSIGNED))     {         ExecuteHamB(Ham_CS_RoundRespawn, id)         return PLUGIN_HANDLED     } }
Compile Errors:
Quote:
/groups/amxmodx/tmp3/textyhDWwp.sma(10) : error 021: symbol already defined: "time"
/groups/amxmodx/tmp3/textyhDWwp.sma(11) : error 020: invalid symbol name ""
/groups/amxmodx/tmp3/textyhDWwp.sma(14) : error 010: invalid function or declaration
/groups/amxmodx/tmp3/textyhDWwp.sma(20) : error 017: undefined symbol "RoundTime"
/groups/amxmodx/tmp3/textyhDWwp.sma(20) : error 029: invalid expression, assumed zero
/groups/amxmodx/tmp3/textyhDWwp.sma(20) : error 029: invalid expression, assumed zero
/groups/amxmodx/tmp3/textyhDWwp.sma(20) : fatal error 107: too many error messages on one line
Len is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:12.


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