AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Question] (https://forums.alliedmods.net/showthread.php?t=294503)

Akka3223 02-28-2017 12:13

[Question]
 
Is there any command that can repeat script every 10min

Like i need to repeat this script every 10mins:

Code:
} public round_start() {   new ent = FM_NULLENT static string_class[] = "classname" while ((ent = engfunc(EngFunc_FindEntityByString, ent, string_class, item_class_name)))     {     set_pev(ent, pev_effects, 0)     set_pev(ent, pev_solid, SOLID_BBOX)     } }

DarthMan 02-28-2017 12:17

Re: [Question]
 
Yes, u can use set_task and make it repeat every 10 minutes. Tha means 600.0 seconds

Do it like that : set_task(600.0, "taskname",_,_,_,"b") and then on the public taskname put your code.

Akka3223 02-28-2017 12:31

Re: [Question]
 
Quote:

Originally Posted by DarthMan (Post 2499437)
Yes, u can use set_task and make it repeat every 10 minutes. Tha means 600.0 seconds

Do it like that : set_task(600.0, "taskname",_,_,_,"b") and then on the public taskname put your code.

can you give me example of public taskname?

DarthMan 02-28-2017 12:40

Re: [Question]
 
Quote:

Originally Posted by Akka3223 (Post 2499442)
can you give me example of public taskname?

On public_init add this line set_task(600.0, "taskname",_,_,_,"b"); and then:

Code:

public taskname(id)
{
      //put your code here
}

Replace taskname with anything you'd like :)

Akka3223 02-28-2017 12:50

Re: [Question]
 
got it ty

Akka3223 02-28-2017 13:08

Re: [Question]
 
dude >:(
Code:
//// Dzzpres.sma // C:\Games\Counter-Strike\cstrike\addons\amxmodx\scripting\Dzzpres.sma(296) : error 010: invalid function or declaration // C:\Games\Counter-Strike\cstrike\addons\amxmodx\scripting\Dzzpres.sma(340) : warning 203: symbol is never used: "ent" // C:\Games\Counter-Strike\cstrike\addons\amxmodx\scripting\Dzzpres.sma(340) : warning 203: symbol is never used: "string_class"

Code:
} public round_start() {       set_task(30.0, "round_start",_,_,_,"b") } new ent = FM_NULLENT static string_class[] = "classname" while ((ent = engfunc(EngFunc_FindEntityByString, ent, string_class, item_class_name)))     {     set_pev(ent, pev_effects, 0)     set_pev(ent, pev_solid, SOLID_BBOX)     client_print(0, print_chat, "Cubes has been spawned!.")     } }

Fuck For Fun 02-28-2017 13:16

Re: [Question]
 
@Akka3223

what you excatly trying to do?

why you using 30 sec from start round?

I do not see any Public. So it does have problems with ENT

maybe:?
Code:

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
   
    set_task(600.0, "taskname",_,_,_,"b") // 10 minute
}

public taskname(id)
{
    new ent = FM_NULLENT
    static string_class[] = "classname"
    while ((ent = engfunc(EngFunc_FindEntityByString, ent, string_class, item_class_name)))
    {
        set_pev(ent, pev_effects, 0)
        set_pev(ent, pev_solid, SOLID_BBOX)
        client_print(0, print_chat, "Cubes has been spawned!.")
    }
}


edon1337 02-28-2017 13:19

Re: [Question]
 
Code:
#include <amxmodx> #include <fakemeta> #include <engine> #define TIME_TASK 30.0 public plugin_init() {     set_task(TIME_TASK, "task_repeat", 0, _, _, "b") } public task_repeat() {         new ent = -1     while ((ent = find_ent_by_class(ent, "classname")))     {         set_pev(ent, pev_effects, 0)         set_pev(ent, pev_solid, SOLID_BBOX)         client_print(0, print_chat, "Cubes has been spawned!.")     } }

Akka3223 02-28-2017 13:21

Re: [Question]
 
Quote:

Originally Posted by Fuck For Fun (Post 2499461)
@Akka3223

what you excatly trying to do?

why you using 30 sec from start round?

I do not see any Public. So it does have problems with ENT

maybe:?
Code:

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
   
    set_task(600.0, "taskname",_,_,_,"b") // 10 minute
}

public taskname(id)
{
    new ent = FM_NULLENT
    static string_class[] = "classname"
    while ((ent = engfunc(EngFunc_FindEntityByString, ent, string_class, item_class_name)))
    {
        set_pev(ent, pev_effects, 0)
        set_pev(ent, pev_solid, SOLID_BBOX)
        client_print(0, print_chat, "Cubes has been spawned!.")
    }
}


round_start is a menu command that respawns my cubes

Akka3223 02-28-2017 13:28

Re: [Question]
 
Quote:

Originally Posted by edon1337 (Post 2499465)
Code:
#include <amxmodx> #include <fakemeta> #include <engine> #define TIME_TASK 30.0 public plugin_init() {     set_task(TIME_TASK, "task_repeat", 0, _, _, "b") } public task_repeat() {         new ent = -1     while ((ent = find_ent_by_class(ent, "classname")))     {         set_pev(ent, pev_effects, 0)         set_pev(ent, pev_solid, SOLID_BBOX)         client_print(0, print_chat, "Cubes has been spawned!.")     } }

even more bugging :(



public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)

register_forward(FM_Touch, "fwd_Touch")

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

register_clcmd("dm_menu", "display_items_menu")

g_Menu = menu_create("DM Item's Menu","menu_item")

set_task(TIME_TASK, "task_repeat", 0, _, _, "b")
} <----------- MUST?


All times are GMT -4. The time now is 21:04.

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