Raised This Month: $ Target: $400
 0% 

If you don't type .rdy in 2 minutes, you get kicked.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 07-13-2011 , 14:41   If you don't type .rdy in 2 minutes, you get kicked.
Reply With Quote #1

Hey guys.
I'm trying to make a pug mode that when a player connects it reads from a file if the pug is running, if its not running it tells him to type .rdy, if he's not typing it after 2 minutes he's getting kicked. The wierd problem is that 2 minutes after plugin precache the 'server' is getting kicked o.0

for example, if the server was name Allied Modders Pug, you'd see 2 minutes after plugin precache in chat

Allied Modders Pug was kicked for not typing .rdy within 2 minutes (i did a client_print that when someone gets kicked it types it).

Why is this...? How do I prevent it? I did an array of timeleft for everyone that when a player connects it reads his STEAM_ID into a cell in the array and then gives him his own timeleft, cuz if there would be 1 variable of timeleft then any player that will connect will have the remaining time the first player who joined has left.
Diegorkable is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 07-13-2011 , 14:47   Re: If you don't type .rdy in 2 minutes, you get kicked.
Reply With Quote #2

The ready thing is easy.

1. Detect Connect
2. Set Task (id + 841) for example
3. Detect say: .rdy
4. If he said, remove task (id + 841)
5. if he didn't say u handle it in the Handler of the task.
__________________
Retired.
Xalus is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-13-2011 , 15:15   Re: If you don't type .rdy in 2 minutes, you get kicked.
Reply With Quote #3

Show the code.
__________________
fysiks is offline
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 07-13-2011 , 15:32   Re: If you don't type .rdy in 2 minutes, you get kicked.
Reply With Quote #4

PHP Code:
public client_connect(id)
{
    new 
playername[32]
    
    
get_user_name(idplayername31)
    
    new 
pug fopen(pug_ini_file"r")
    
    
fseek(pug, -1SEEK_END)
    
getchar fgetc(pug)
    
    if (
getchar == '0')
    {
    
        
client_print(idprint_chat"%s Please type .rdy to be Ready! You will be kicked in %d seconds if you don't type it."PREFIXtimeleft)
        
timeleft -= 30
        set_task
(30.0"Continue")
        
    }
    
    else
    {
        
client_print(idprint_chat"%s You have entered to this match as it has already started, you will be used as a substitution."PREFIX)
        return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_HANDLED
}

public Continue(
id)
{
    
    new 
playersteam[30]
    
get_user_authid(idplayersteam29)
    
    for (new 
kk<typedalrdycounter k++)
    {
        if (
equali(playersteamtypedalrdy[k]))
        {
            return 
PLUGIN_HANDLED;
        }
        
        else
        {
            continue;
        }
    }
    new 
playername[32]
    
    
get_user_name(idplayername31)
    
    
client_print(idprint_chat"%s Please type .rdy to be Ready! You will be kicked in %d seconds if you don't type it."PREFIXtimeleft)
    switch(
timeleft)
    {
        case 
90:
        {
            
timeleft -= 30
            set_task
(30.0"Continue")
        }
        
        case 
60:
        {
            
timeleft -= 30
            set_task
(30.0"Continue")
        }
        
        case 
30:
        {
            
timeleft -= 20
            set_task
(20.0"Continue")
        }
        
        case 
10:
        {
            
timeleft 0
            set_task
(10.0"Continue")
        }
        
        case 
0:
        {
            
client_cmd(id"disconnect")
            
client_print(0print_chat"%s %s have been kicked for not typing .rdy for 2 minutes."PREFIXplayername)
        }
    }
    
    return 
PLUGIN_HANDLED
}

public 
Prepare(id)
{
    new 
playersteam[30]
    
get_user_authid(idplayersteam29)
    
    for (new 
kk<typedalrdycounter k++)
    {
        if (
equali(playersteamtypedalrdy[k]))
        {
            
client_print(idprint_chat"%s You have already typed .rdy!"PREFIX)
            return 
PLUGIN_HANDLED;
        }
        
        else if ((
iszero[k] != 1))
        {
            
client_print(idprint_chat"%s You are now ready!"PREFIX)
            
copy(typedalrdy[k], 29playersteam)
            
typedalrdycounter++
            
playersleft--
            
iszero[typedalrdycounter] = 1
        
}
        
    }
        
    if (
iszero[typedalrdycounter] != 1)
    {
        
copy(typedalrdy[typedalrdycounter], 29playersteam)
        
typedalrdycounter++
        
playersleft--
    } 
Diegorkable is offline
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 07-13-2011 , 15:57   Re: If you don't type .rdy in 2 minutes, you get kicked.
Reply With Quote #5

Can I just set then the first client that connects (which will be the server itself)'s time to unlimited?
Diegorkable is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-13-2011 , 16:18   Re: If you don't type .rdy in 2 minutes, you get kicked.
Reply With Quote #6

YOu have to provide a task id, in your case it would be the id variable.

PHP Code:
set_task(30.0"Continue"id
However, I'm having trouble understanding your code. Setting all those recursive tasks is confusing and you have unnecessary repeated code (getting the auth id).
__________________
fysiks is offline
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 07-13-2011 , 18:00   Re: If you don't type .rdy in 2 minutes, you get kicked.
Reply With Quote #7

its not unnecessary, you should understand the logic behind my code, thats why you should come on steam more often so i can bug you with questions, fysiks
Diegorkable is offline
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 07-13-2011 , 18:04   Re: If you don't type .rdy in 2 minutes, you get kicked.
Reply With Quote #8

And I'll ask again, can I just set the first client that connects's timeleft to unlimited? or something that won't let him continue to any 'kicking' action? Because I make a guess now using my sense that the first client that will log in the server is the server itself (that was getting kicked after 2 minutes)
Diegorkable is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-14-2011 , 00:03   Re: If you don't type .rdy in 2 minutes, you get kicked.
Reply With Quote #9

Quote:
Originally Posted by Diegorkable View Post
its not unnecessary, you should understand the logic behind my code
It is unnecessary to check someones SteamID several times since it doesn't change while they are on the server. If you think it is necessary then there is some sort of flaw in your logic (or it's bad logic). IMO

Quote:
Originally Posted by Diegorkable View Post
And I'll ask again, can I just set the first client that connects's timeleft to unlimited? or something that won't let him continue to any 'kicking' action? Because I make a guess now using my sense that the first client that will log in the server is the server itself (that was getting kicked after 2 minutes)
The server never joins the game. You keep refering to "timeleft" but I have no idea where this number comes from (you don't show enough code).
__________________
fysiks is offline
Old 07-14-2011, 10:26
^SmileY
This message has been deleted by ^SmileY. Reason: Double, sorry
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:09.


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