Page 2 of 2
Re: teamswap - komandu keitimo optimizacija
Posted: 2012 Dec 09 19:55
by Tetusis
newb wrote:InvIs wrote:Kur tu matai 32 task'us ?

Aš matau tik 5
Nu tai neziurek vien tik i zodzius
set_task, o ziurek kaip sitas dalykas veiks...
*mindfuck* , kaip supratau jei keicia 32 zmones kiekvienam priskiria po task'a nesvarbu, kad kode rasome kas 5 - 1task? O_o, vistiek turi daugiau patirties paaiskink kaip tai veikia, idomu.
Re: teamswap - komandu keitimo optimizacija
Posted: 2012 Dec 09 19:57
by newb
Nu tai kiekvienam zaidejui uzdedamas naujas taskas su skirtingais intervalais.
Re: teamswap - komandu keitimo optimizacija
Posted: 2012 Dec 09 20:23
by InvIs
Atsiprašau, apsirikau.
Vistiek, exolent kode taip pat būtų skiriami 32taskai, tiesa?
Jei klystu, paaiškinkit, nes ten įžvelgiu kažką panašaus, tik parašyta taip, jog pradedantysis nichuja nieko nesuprastų

Re: teamswap - komandu keitimo optimizacija
Posted: 2012 Dec 09 21:26
by newb
Pas ji 5 zaidejai keicia teama iskarto, o visi kas toliau gauna irgi atskira taska, su skirtingais intervalais.
Re: teamswap - komandu keitimo optimizacija
Posted: 2012 Dec 09 21:50
by Tetusis
newb wrote:Pas ji 5 zaidejai keicia teama iskarto, o visi kas toliau gauna irgi atskira taska, su skirtingais intervalais.
so last decision... ?

Re: teamswap - komandu keitimo optimizacija
Posted: 2012 Dec 09 21:55
by InvIs
Tai taip išeina, kad pas jį maksimumas: 32 - 5 = 27 Task'ai? Skirtumas????.....
Code: Select all
switchinam(id){switch(id){case 1..7: keiciam(id)case 8..15: set_task(0.2, "keiciam", id)case 16..24: set_task(0.3, "keiciam", id)case 25..32: set_task(0.4, "keiciam", id)}{}}keiciam(id){switch(get_user_team(id)){case 1: cs_set_user_team(id, 2)case 2: cs_set_user_team(id, 1)}}
Vuolia, 24 Task'ai....
Re: teamswap - komandu keitimo optimizacija
Posted: 2012 Dec 09 21:57
by hleV
Geriausia modulis, nes ten jokių delay nereikia daryt. O su plugin'u tai kažkas tokio būtų (bet irgi nelabai suprantamas kodas bus):
Code: Select all
#include <amxmodx>#include <cstrike> #define TEAM_SWAP_GROUP 5#define TEAM_SWAP_DELAY 0.1 SwapTeams(){ new players[32], playerCount; get_players(players, playerCount, "ch"); if (playerCount) _SwapTeams(players, playerCount);} public _SwapTeams(players[], playerCount){ for (new i = playerCount - 1, player; i >= 0 && i >= playerCount - TEAM_SWAP_GROUP; i--) { player = players[i]; if (!is_user_connected(player)) continue; switch (cs_get_user_team(player)) { case CS_TEAM_T: cs_set_user_team(player, CS_TEAM_CT); case CS_TEAM_CT: cs_set_user_team(player, CS_TEAM_T); } } playerCount -= TEAM_SWAP_GROUP; if (playerCount > 0) set_task(TEAM_SWAP_DELAY, "_SwapTeams", playerCount, players, playerCount);}