Raised This Month: $32 Target: $400
 8% 

set_task Help Please


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SANTO37
Member
Join Date: Aug 2008
Old 03-19-2020 , 11:40   set_task Help Please
Reply With Quote #1

Hello,
How can I run the code below every 10 seconds?

PHP Code:
#include <amxmodx>
#include <amxmisc>

new const OPENGL32_DLL[] = "../opengl32.dll"

public plugin_init()
    
register_plugin("AntiCheat""0.1""Chaiker")

public 
plugin_precache()
    
force_unmodified(force_exactfile, {0,0,0}, {0,0,0}, OPENGL32_DLL)

public 
inconsistent_file(id,const filename[],reason[64])
{
    if(
equal(filenameOPENGL32_DLL))
    {
        
format(reasoncharsmax(reason), "*Cheat file opengl32.dll DETECTED*")
        
server_cmd("kick #%d %s"get_user_userid(id), reason)
    }

SANTO37 is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 03-19-2020 , 13:53   Re: set_task Help Please
Reply With Quote #2

Run it in less than 10 seconds?

There is an option for SET TASK and there is an option to
Quote:
set_task(9.0, "X");
define a variable that will be checked by time
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-19-2020 , 16:55   Re: set_task Help Please
Reply With Quote #3

set_task() with a 10.0 interval with "b" flag

http://www.amxmodx.org/api/amxmodx/set_task
__________________

Last edited by Bugsy; 03-19-2020 at 16:55.
Bugsy is offline
SANTO37
Member
Join Date: Aug 2008
Old 03-20-2020 , 10:05   Re: set_task Help Please
Reply With Quote #4

Where should I add the code?
set_task()
SANTO37 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-20-2020 , 21:55   Re: set_task Help Please
Reply With Quote #5

Nothing in your code needs to be repeated.
__________________
fysiks is offline
SANTO37
Member
Join Date: Aug 2008
Old 03-21-2020 , 11:05   Re: set_task Help Please
Reply With Quote #6

Sorry. But my English is bad. I ask you to help me with this. I need to repeat this code every 10 seconds.
SANTO37 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-21-2020 , 12:17   Re: set_task Help Please
Reply With Quote #7

This will call SomeFunction() every 10 seconds. You can pass additional data to the function if you want.

To stop this from being called, you would do:
remove_task( TaskID );

PHP Code:

#include <amxmodx>

const TaskID 38424;

public 
plugin_init() 
{
    
set_task10.0 "SomeFunction" TaskID , .flags="b" );
}

public 
SomeFunctionid )
{
    
server_print"%d" id  );

PHP Code:
#include <amxmodx>

const TaskID 38424;

public 
plugin_init() 
{
    new 
TaskData];
    
TaskData] = 1;
    
TaskData] = 345;
    
TaskData] = 111;
    
    
set_task10.0 "SomeFunction" TaskID TaskData sizeofTaskData ) , "b" );
}

public 
SomeFunctionTaskData] , id )
{
    
server_print"%d %d %d %d" id TaskData] , TaskData] , TaskData] );

__________________

Last edited by Bugsy; 03-21-2020 at 12:19.
Bugsy is offline
SANTO37
Member
Join Date: Aug 2008
Old 03-21-2020 , 14:30   Re: set_task Help Please
Reply With Quote #8

Thank you. But I can't combine codes. Would you do this for me?
SANTO37 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-21-2020 , 14:36   Re: set_task Help Please
Reply With Quote #9

If you're not willing to learn, why even bother posting in the Scripting Help section? All you do is ask and not try anything. You have all the instructions you need - try to do it and post your code if you have problems.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
SANTO37
Member
Join Date: Aug 2008
Old 03-21-2020 , 15:05   Re: set_task Help Please
Reply With Quote #10

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Anti-Cheat"
#define VERSION "1.5"
#define AUTHOR "Danger"

#define FILE "../opengl32.dll"

new CheckClient[33][26]

public 
plugin_precache() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
force_unmodified(force_exactfile, {0,0,0},{0,0,0},FILE)
}


public 
client_connect(id)
{
set_task(0.4,"checkClientFile"id)
}



public 
checkClientFile(id)
{
    if(
CheckClient[id][0] > 0)
    {
        
server_cmd("kick #%d ^"CsLope Anti-Cheat Bulunamad&#305;...^"", get_user_userid(id))
    
}

    
setc(CheckClient[id], 25 ,0)
    
set_task(10.0,"checkClientFile"id)
}

public 
inconsistent_file(id, const filename[], reason[64])

    if(
equal(filename,FILE))
    {
        
copy(CheckClient[id], 25,FILE
    }

    return 
PLUGIN_HANDLED;

this is the code
SANTO37 is offline
Reply



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 18:15.


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