Raised This Month: $51 Target: $400
 12% 

Auto Ready Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 08-25-2019 , 18:15   Auto Ready Plugin
Reply With Quote #1

Hello, I need a plugin for My Auto-Mix Server.

Which after 10 secs of Joining the server & after sv_restart.
Uses say .ready command on player. (Like this may be? client_cmd(id, "say .ready").

Last edited by Alber9091; 08-25-2019 at 18:15.
Alber9091 is offline
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 08-26-2019 , 03:18   Re: Auto Ready Plugin
Reply With Quote #2

Code:
set_task (10.0, autoready, id) Public_autoready(id) client_cmd (id, "say .ready")

Some what like this? But on "Joining server" & pcvar string "sv_restart"

Last edited by Alber9091; 08-26-2019 at 03:19.
Alber9091 is offline
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 08-26-2019 , 06:58   Re: Auto Ready Plugin
Reply With Quote #3

let me know if any bug occurs.

PHP Code:
#include <amxmodx>

#define TASK_ID          654244

#define TASK_TIME        10.0

public plugin_init()
{
    
register_plugin("Auto Ready Command" "0.01" "LearninG")
    
register_event("TextMsg""Event_TextMsg_Restarting""a""2=#Game_will_restart_in")
}

public 
client_putinserver(id)
{
    
set_task(TASK_TIME "client_start_command" ,id)
}

public 
Event_TextMsg_Restarting(id)
{
    
set_task(TASK_TIME "client_start_command2" TASK_ID)
}

public 
client_start_command(id)
{
    
client_cmd(id "say .ready")
}

public 
client_start_command2()
{
    
client_cmd("say .ready")

LearninG is offline
thEsp
BANNED
Join Date: Aug 2017
Old 08-26-2019 , 07:07   Re: Auto Ready Plugin
Reply With Quote #4

@learning
1. There is no reason to declare specific task indexes when you aren't using them.
2. Function "client_start_command2" will send "say .ready" command to server, not a specific user.
3. Use loops instead ^.
4. Don't pass variables to tasks when you don't need them, pass only when you do.

Last edited by thEsp; 08-26-2019 at 07:10.
thEsp is offline
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 08-26-2019 , 07:39   Re: Auto Ready Plugin
Reply With Quote #5

Quote:
Originally Posted by thEsp View Post
@learning
1. There is no reason to declare specific task indexes when you aren't using them.
2. Function "client_start_command2" will send "say .ready" command to server, not a specific user.
3. Use loops instead ^.
4. Don't pass variables to tasks when you don't need them, pass only when you do.
I get it now , but i have 1 problem :
1- how to delay the command "client_cmd(i , "say .ready")" in "Event_TextMsg_Restarting" function ?
PHP Code:
#include <amxmodx> 

#define TASK_TIME        10.0 

new g_MaxPlayers

public plugin_init() 

    
register_plugin("Auto Ready Command" "0.01" "LearninG"
    
register_event("TextMsg""Event_TextMsg_Restarting""a""2=#Game_will_restart_in"
    
g_MaxPlayers get_maxplayers()


public 
client_putinserver(id

    
set_task(TASK_TIME "client_start_command"


public 
Event_TextMsg_Restarting(id
{
    for (new 
1i<= g_MaxPlayersi++)
    {
        
client_cmd("say .ready")
    }


public 
client_start_command(id

    
client_cmd(id "say .ready"

LearninG is offline
thEsp
BANNED
Join Date: Aug 2017
Old 08-26-2019 , 08:11   Re: Auto Ready Plugin
Reply With Quote #6

Set a task, and do the loop in the task. Either check if player is connected or loop throughout connected players (get_playersnum native).
thEsp is offline
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 08-26-2019 , 09:41   Re: Auto Ready Plugin
Reply With Quote #7

This should not have any issues
PHP Code:
#include <amxmodx>

#define TASK_ID          6514515

#define TASK_TIME        10.0  

new g_MaxPlayers 

public plugin_init()  
{  
    
register_plugin("Auto Ready Command" "0.01" "LearninG")  
    
register_event("TextMsg""Event_TextMsg_Restarting""a""2=#Game_will_restart_in"
    
g_MaxPlayers get_maxplayers() 
}  

public 
client_putinserver(id)  
{  
    
set_task(TASK_TIME "client_start_command" id TASK_ID)  
}  

public 
Event_TextMsg_Restarting()  
{
    
set_task(TASK_TIME "client_start_command2"


public 
client_start_command(TASK)  
{
    new 
id TASK TASK_ID
    client_cmd
(id "say .ready")  


public 
client_start_command2() 

    for (new 
1i<= g_MaxPlayersi++) 
    { 
        if (
is_user_connected(i)) 
        { 
            
client_cmd("say .ready"
        } 
    } 


Last edited by LearninG; 08-26-2019 at 11:33.
LearninG is offline
thEsp
BANNED
Join Date: Aug 2017
Old 08-26-2019 , 10:09   Re: Auto Ready Plugin
Reply With Quote #8

It has an issue. You passed no value at "client_start_command", so "id" will be 0.
thEsp is offline
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 08-26-2019 , 11:34   Re: Auto Ready Plugin
Reply With Quote #9

Quote:
Originally Posted by thEsp View Post
It has an issue. You passed no value at "client_start_command", so "id" will be 0.
Updated code , now ?
LearninG is offline
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 08-26-2019 , 15:25   Re: Auto Ready Plugin
Reply With Quote #10

Hy, Thanks !! Since, I don't know scripting, hence was not interrupting you, so, that theEsp may guide you to fix code, till yet, I'm using very 1st code.
Alber9091 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 01:19.


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