Round time 0:00

Šiame forume rašomi vartotojų klausimai/problemos su kuriomis jie susidūrė kuriant pluginus.
KamiN
Gana aktyvus vartotojas
Posts: 227
Joined: 2011 Apr 23 13:17

Round time 0:00

Post by KamiN »

Kaip padaryti, kad kai round time pasibaige, 0:00, kintamieji hns ir catch pasidarytu false.

sitas netinka

Code: Select all

public Event_Roundend(){    if(hns)        hns = false     if(catch)        catch = false....            }
Meginau sitaip, bet irgi neveikia

Code: Select all

 pointnum = get_cvar_pointer("mp_roundtime"); public roundtimezero() {     g_roundtime = get_pcvar_num(pointnum);     if(g_roundtime == 0)     {         if(hns)            hns = false                else if(catch)            catch = false     }} 
Attachments
jb_days_lr.sma
(23.49 KiB) Downloaded 617 times
Last edited by KamiN on 2011 Jun 10 10:32, edited 1 time in total.

User avatar
psychical
Viršininkas
Posts: 2094
Joined: 2011 Mar 12 22:19
Skype: tautvydas11
Location: Linksmakalnis
Contact:

Re: Round time 0:00

Post by psychical »

Code: Select all

    register_logevent("round_start", 2, "1=Round_Start")

Code: Select all

public round_start(){    set_task(float(floatround(get_pcvar_float(g_pcvar_mp_roundtime) * 60.0, floatround_floor)), "time_is_up", TASK_ID)}

Code: Select all

public time_is_up() {    //darai ka nori}

KamiN
Gana aktyvus vartotojas
Posts: 227
Joined: 2011 Apr 23 13:17

Re: Round time 0:00

Post by KamiN »

O jeigu pas mane jau yra

Code: Select all

register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
tai padarius sitaip ar tiks?

Code: Select all

public event_round_start(){set_task(float(floatround(get_pcvar_float(g_pcvar_mp_roundtime) * 60.0, floatround_floor)), "time_is_up", TASK_ID)}
Last edited by KamiN on 2011 Jun 10 10:59, edited 4 times in total.


KamiN
Gana aktyvus vartotojas
Posts: 227
Joined: 2011 Apr 23 13:17

Re: Round time 0:00

Post by KamiN »

Alliedmoduose toki pati radau

http://forums.alliedmods.net/showthread.php?p=559412

Ka sitas daro gal lietuviskai paaiskint su kokiu pavyzdiu galit. Ar reikalingas cia jis man butu?

Code: Select all

public remove_existing_task() {    if (task_exists(TASK_ID))        remove_task(TASK_ID)}
Ir kodel toks didelis skaicius? Ar cia jis neturi visiskai reiksmes?

Code: Select all

#define TASK_ID 934279423
Last edited by KamiN on 2011 Jun 10 11:14, edited 1 time in total.

User avatar
aurimasko
Flooderis arba specialistas
Posts: 736
Joined: 2010 Sep 04 08:45

Re: Round time 0:00

Post by aurimasko »

skaičius neturi reikšmės, tik jis turi būti nevienodas su kitas task define.

o dėl pirmo, tai jis sunaikina pradėtą taską.

-- 2011 Bir 10 12:32 --

daryk pagal psychical pavizdį ir kur yra time_up funkcija įterpk į ją task sunaikinimo kodą t.y. remove_task(TASK_ID)

User avatar
psychical
Viršininkas
Posts: 2094
Joined: 2011 Mar 12 22:19
Skype: tautvydas11
Location: Linksmakalnis
Contact:

Re: Round time 0:00

Post by psychical »

aurimasko wrote:skaičius neturi reikšmės, tik jis turi būti nevienodas su kitas task define.

o dėl pirmo, tai jis sunaikina pradėtą taską.

-- 2011 Bir 10 12:32 --

daryk pagal psychical pavizdį ir kur yra time_up funkcija įterpk į ją task sunaikinimo kodą t.y. remove_task(TASK_ID)

task remove riektu deti i round_end, nes kai round prasides ir jei taskas nebaigtas, gali pradet bugintis, todel reik:

Code: Select all

     register_event("HLTV", "remove_existing_task", "a", "1=0", "2=0")

Code: Select all

public remove_existing_task() {        if (task_exists(TASK_ID))                remove_task(TASK_ID)}

User avatar
aurimasko
Flooderis arba specialistas
Posts: 736
Joined: 2010 Sep 04 08:45

Re: Round time 0:00

Post by aurimasko »

tai galima ir taip:

Code: Select all

 public event_round_start(){    remove_task(TASK_ID)    set_task(float(floatround(get_pcvar_float(g_pcvar_mp_roundtime) * 60.0, floatround_floor)), "time_is_up", TASK_ID)} 

User avatar
psychical
Viršininkas
Posts: 2094
Joined: 2011 Mar 12 22:19
Skype: tautvydas11
Location: Linksmakalnis
Contact:

Re: Round time 0:00

Post by psychical »

aurimasko wrote:tai galima ir taip:

Code: Select all

 public event_round_start(){    remove_task(TASK_ID)    set_task(float(floatround(get_pcvar_float(g_pcvar_mp_roundtime) * 60.0, floatround_floor)), "time_is_up", TASK_ID)} 
Galima, bet set_Task naujai nedek, nes naujai prasideda pradzioje round'o

KamiN
Gana aktyvus vartotojas
Posts: 227
Joined: 2011 Apr 23 13:17

Re: Round time 0:00

Post by KamiN »

Tai dabar as padariau taip, ar bus gerai?

Code: Select all

#define TASK_ID 934279423

Code: Select all

new g_pcvar_mp_roundtime

Code: Select all

public plugin_init() {....    register_event("HLTV", "event_round_start", "a", "1=0", "2=0")     g_pcvar_mp_roundtime = get_cvar_pointer("mp_roundtime")         register_logevent("Event_Roundend", 2, "1=Round_End") ....}

Code: Select all

public event_round_start(){...    set_task(float(floatround(get_pcvar_float(g_pcvar_mp_roundtime) * 60.0, floatround_floor)), "time_is_up", TASK_ID)}

Code: Select all

public time_is_up(){       if(specialday[20] == DAY_HNS)        hns = false     if(specialday[20] == DAY_CATCH)        catch = false}

Code: Select all

public Event_Roundend(){     if (task_exists(TASK_ID))                remove_task(TASK_ID)....}

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests