AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Random Command every 10 sec (https://forums.alliedmods.net/showthread.php?t=308022)

ultimatgold 06-03-2018 21:53

Random Command every 10 sec
 
Hi!

I'm looking for a plugin that randomly time(10-20sec) executes a command I've made on players.
amx_slay <name or #userid> or amx_kick <name or #userid> etc..

Thank you very mutch for help!

akcaliberg 06-04-2018 04:40

Re: Random Command every 10 sec
 
Create an array of the commands you would like to be executed randomly.
Set a timed task that will be executed every 10-20 seconds.
Get a random number between 0 and the size of your commands array.
Use that number as the index of the commands array.
=> You have a random command.

ultimatgold 06-04-2018 08:55

Re: Random Command every 10 sec
 
Give me the code pls, i don't understand you :( :cry:

Quote:

Originally Posted by akcaliberg (Post 2595189)
Create an array of the commands you would like to be executed randomly.
Set a timed task that will be executed every 10-20 seconds.
Get a random number between 0 and the size of your commands array.
Use that number as the index of the commands array.
=> You have a random command.


ddhoward 06-04-2018 11:44

Re: Random Command every 10 sec
 
Quote:

Originally Posted by ultimatgold (Post 2595228)
Give me the code pls, i don't understand you :( :cry:

https://forums.alliedmods.net/forumdisplay.php?f=12

ultimatgold 06-04-2018 12:31

Re: Random Command every 10 sec
 
What this pause and unpause? Random player kick 20sec. This code is good, or not?

PHP Code:

#include < amxmodx >

public plugin_init()
{
    
register_plugin("PausePlugin","1.0","Deidara");
    
register_logevent("round_end"2"1=Round_End");
    
register_event("TextMsg""round_restart""a""2&#Game_C""2&#Game_w");
    
register_logevent("round_start"2"1=Round_Start")
    
register_logevent("round_draw"2"1=Round_Draw");
}

public 
round_start(id)
{
    
set_task 20.0"x1"id );    
}

public 
x1()
{
        
unpause("ac","amx_kick");    


Quote:

Originally Posted by 4ever16 (Post 2595260)
Not the perfect one but you can remake this.
Instead of "unpause("ac","a2.amxx"); " you make the command you want to run.

When freezetime is over 1 second later it will run a command, 20 seconds later it will run command 2, 40 seconds later it will run command 3.


PHP Code:

#include < amxmodx >

public plugin_init()
{
    
register_plugin("PausePlugin","1.0","Deidara");
    
register_logevent("round_end"2"1=Round_End");
    
register_event("TextMsg""round_restart""a""2&#Game_C""2&#Game_w");
    
register_logevent("round_start"2"1=Round_Start")
    
register_logevent("round_draw"2"1=Round_Draw");
}

public 
round_start(id)
{
    
set_task 1.0"x1"id );
        
set_task 20.0"x2"id );   
        
set_task 40.0"x3"id );     
}

public 
x1()
{
        
unpause("ac","a2.amxx");    
}

public 
x2()
{
        
pause("ac","a2.amxx"); 
}

public 
x3()
{
        
your command




4ever16 06-04-2018 20:20

Re: Random Command every 10 sec
 
Try this one instead.
6 seconds after round has ended it will run a command.
Change the command and time to what you want.

PHP Code:

#include <amxmodx> 
#include <amxmisc> 
#include <cstrike> 

#define PLUGIN "New Plug-In" 
#define VERSION "1.0" 
#define AUTHOR "bugsy" 

public plugin_init()  

    
register_plugin(PLUGINVERSIONAUTHOR
    
register_logevent("logevent_round_end"2"1=Round_End")  

  
public 
logevent_round_end()  

    
set_task(6.0"x1" 

  
public 
x1()  

server_cmd("amx_kick STEAMid")



eyal282 06-05-2018 02:19

Re: Random Command every 10 sec
 
Should the command execute on all players?

allroundernaman 05-20-2020 07:54

Re: Random Command every 10 sec
 
Hello!
Can someone help me? Just add a condition that this wont work on admins. Admins must be safe from this random commands.

thanks!


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

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