AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Timed Rank Display (https://forums.alliedmods.net/showthread.php?t=320221)

iclassdon 12-10-2019 10:12

Timed Rank Display
 
PHP Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init() 
{
    
register_plugin"Timed Rank""1.0""Noone_lol" )
}
public 
server_changelevel()
{
    for( new 
1<= get_maxplayers(); i++ )
    {
        if( !
is_user_connected) )
            continue
        
        
client_cmdi"say /rank" )
    }


How could I time this to run every 10 minutes with set task?

Fyi I'm running gameME stats and not stats from amxmodx.

https://github.com/gamemedev/plugin-...me_cstrike.sma

ZaX 12-10-2019 13:25

Re: Timed Rank Display
 
You want to display rank every 10minutes?
If so, use set_task, put the time 600.0, with "b" flags in plugin_init

OciXCrom 12-10-2019 13:44

Re: Timed Rank Display
 
Also, instead of the entire code you put in the function, you can simply run "client_cmd" with index 0 - this will execute the command for all connected players and you don't need any checks nor loops.

iclassdon 12-10-2019 13:48

Re: Timed Rank Display
 
PHP Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init() 
{
    
register_plugin"Timed Rank""1.0""Noone_lol" )
    
set_task 600.0"setit"0,_,_,"b"
}

public 
setit()
{
    for( new 
1<= get_maxplayers(); i++ )
    {
        if( !
is_user_connected) )
            continue
        
        
client_cmdi"say /rank" )
    }


Thanks! Why am I getting loose indentation warning?

DjSoftero 12-10-2019 13:59

Re: Timed Rank Display
 
Quote:

Originally Posted by iclassdon (Post 2676500)
PHP Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init() 
{
    
register_plugin"Timed Rank""1.0""Noone_lol" )
    
set_task 600.0"setit"0,_,_,"b"
}

public 
setit()
{
    for( new 
1<= get_maxplayers(); i++ )
    {
        if( !
is_user_connected) )
            continue
        
        
client_cmdi"say /rank" )
    }


Thanks! Why am I getting loose indentation warning?

I don't get any warnings. using visual studio for editing and 1.9 build 5263 compiler.

JocAnis 12-10-2019 14:01

Re: Timed Rank Display
 
That warning doesnt matter, what matter is: did steam blocked also say command sent from plugins, i didnt test it yet

OciXCrom 12-10-2019 14:04

Re: Timed Rank Display
 
Just do this:

PHP Code:

#include <amxmodx>

public plugin_init() 
{
    
register_plugin"Timed Rank""1.0""Noone_lol" )
    
set_task 600.0"setit"0,_,_,"b"
}

public 
setit()
{
    
client_cmd0"say /rank" )


AFAIK "say" is not blocked (yet).

You're getting indentation error because your indentation (spaces/tabs in the beginning of lines) is not consistent.

iclassdon 12-10-2019 15:36

Re: Timed Rank Display
 
Thanks guys, I'll load this up OciXCrom and test it. I used notepad++ for editing.

OciXCrom 12-10-2019 16:54

Re: Timed Rank Display
 
Quote:

Originally Posted by iclassdon (Post 2676517)
Thanks guys, I'll load this up OciXCrom and test it. I used notepad++ for editing.

Make sure you use TAB instead of manually typing in spaces.

DjSoftero 12-10-2019 17:32

Re: Timed Rank Display
 
I can't recommend this one enough instead of notepad: https://forums.alliedmods.net/showthread.php?t=300661


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

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