Raised This Month: $ Target: $400
 0% 

Help! Ready o kick.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
jg_20
Senior Member
Join Date: Oct 2011
Old 12-12-2011 , 15:35   Help! Ready o kick.
Reply With Quote #1

Hi all! Well I have this code pug! Need to register if the player does not place. Ready the server gives a kick in some time. If you can help me or something to guide me will appreciate it. thanks
Excuse me for my bad English

PHP Code:

#include <amxmodx>
#include <amxmisc>

#include <yap_const>
#include <yap_stocks>
#include <yap_natives>
#include <yap_forwards>
#include <yap_modspecific>

new const plugin_author[] = "Twilight SuzukaAAA"
new const plugin_name[] = "YAP-RDY"
new const plugin_version[] = "0.0.1"

CREATE_GEN_FORW_ID(pug_forward_ready);

public 
plugin_init()
{
    
// Rukia: Plugin definition
    
new p_id register_plugin(plugin_name,plugin_version,plugin_author);

    
register_dictionary("yap.txt")
    
register_dictionary("yap_ready.txt")

    
register_pug_clcmd("ready","ready_up",_,"Tells the server player is ready")
    
register_pug_clcmd("notready","ready_down",_,"Tells the server player is not ready")

    
register_pug_admincmd("forceready","cmd_forceready",PUG_CMD_LVL,"<name or #userid> Forces a client to be ready")
    
register_pug_admincmd("forceunready","cmd_forceunready",PUG_CMD_LVL,"<name or #userid> Forces a client to be unready")

    
pug_forward_ready create_gen_forward("pug_all_ready",p_id,get_func_id("pug_ready_handler") )

    
//parse_header("BOE-E",pug_header,5)
    
register_event("ResetHUD","pug_keepup_menu","b")

    
pug_change_display(get_func_id("pug_ready_display_really") , -1)
}

// Rukia: Ready variables
new pug_players_ready[33]
new 
pug_total_ready 0;

// Rukia: make sure we keep up menu as much as possible, so that it updates correctly
public client_connect(idset_task(15.0,"pug_keepup_menu")
public 
client_putinserver(idpug_keepup_menu()

// Rukia: If someone disconnects, we need to take them out of the line up, and make sure that everything is cool
public client_disconnect(id)
{
    if( 
GET_PUG_STAGE() != PUG_STAGE_READY ) return;

    if(
pug_players_ready[id]) 
    {
        
pug_players_ready[id] = 0;
        
pug_total_ready--;
    }
    
    
pug_keepup_menu()
}

// Rukia: Make sure to change HUD when people change names
public client_infochanged(idset_task(0.1,"pug_keepup_menu")

// Rukia: Dynamic native code
public plugin_natives()
{
    
register_native("pug_ready_players","native_pug_ready_players")
    
register_native("register_ready_display","native_register_ready_display")
}

public 
native_pug_ready_players(id,params)
{
    new 
p_id get_param(2)
    
pug_ready_players(get_param(1),(p_id == -1) ? id p_id)
}

public 
native_register_ready_display(id,params)
{
    new 
p_id get_param(2)
    
pug_change_display(get_param(1),(p_id == -1) ? id p_id)
}

public 
cmd_forceready(id,level,cid)
{
    if (!
cmd_access(idlevelcid2) ) return PLUGIN_HANDLED;

    static 
victim_arg[32]
    
read_argv(1,victim_arg,31)

    if(
equali(victim_arg,"all")) return cmd_force_all_ready(id);

    new 
target cmd_target(id,victim_arg,1)
    if (!
target) return PLUGIN_HANDLED

    pug_admin_cmd_c
(id,"PugForceReady","PUG_FORCE_READY",target,ready_up(target));
    return 
PLUGIN_HANDLED;
}

public 
cmd_forceunready(id,level,cid)
{
    if (!
cmd_access(idlevelcid2) ) return PLUGIN_HANDLED;

    static 
victim_arg[32]
    
read_argv(1,victim_arg,31)

    if(
equali(victim_arg,"all")) return cmd_force_all_unready(id);

    new 
target cmd_target(id,victim_arg,1)
    if (!
target) return PLUGIN_HANDLED

    pug_admin_cmd_c
(id,"PugForceUnReady","PUG_FORCE_UNREADY",target,ready_down(target));
    return 
PLUGIN_HANDLED;
}

public 
cmd_force_all_ready(id)
{
    static 
Players[32]
    new 
playerCounti
    get_players
(PlayersplayerCount"h")

    for (
i=0i<playerCounti++) ready_up(Players[i])

    
pug_admin_cmd(id,"PugForceAllReady","PUG_FORCE_ALL_READY",1);
    return 
PLUGIN_HANDLED
}

public 
cmd_force_all_unready(id)
{
    static 
Players[32]
    new 
playerCounti
    get_players
(PlayersplayerCount"h")

    for (
i=0i<playerCounti++) ready_down(Players[i])

    
pug_admin_cmd(id,"PugForceAllUnReady","PUG_FORCE_ALL_UNREADY",1);
    return 
PLUGIN_HANDLED
}


// Rukia: Ready code

public pug_ready_funcid;
public 
pug_ready_plugin_id;
public 
pug_ready_prev_stage;

// Rukia: save the handler function
pug_ready_players(f_idp_id = -1)
{
    if(
GET_PUG_STAGE() == PUG_STAGE_READY) return;
    
pug_ready_funcid f_id;
    
pug_ready_plugin_id p_id;

    
pug_start_ready_players()
}

// Rukia: Save state, sub in our own, and start the ready!
public pug_start_ready_players()
{
    if(
GET_PUG_STATUS() != PUG_STATUS_LIVE) return pug_set_pause_call(get_func_id("pug_start_ready_players"));

    
pug_ready_prev_stage GET_PUG_STAGE();
    
SET_PUG_STAGE(PUG_STAGE_READY);
    
SET_PUG_STATUS(PUG_STATUS_WAITING);

    
arrayset(pug_players_ready,0,33)
    
pug_total_ready 0;

    
pug_msg_tmp_empty(0,"PUG_READY_UP")
    
pug_keepup_menu()

    return 
1;
}

public 
ready_up(id)
{
    if((
pug_players_ready[id] == 1
        || 
GET_PUG_STATUS() != PUG_STATUS_WAITING || GET_PUG_STAGE() != PUG_STAGE_READY 
        
|| is_user_hltv(id
    )     
    {
        return 
pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED")
    }

    
pug_players_ready[id] = 1;
    
pug_total_ready++;

    static 
name[32]
    
get_user_name(id,name,31)
    
client_print(0,print_chat,"%s %L",pug_headerLANG_PLAYER"PUG_PLAYER_READYED",name);

    
pug_check_ready();

    return 
PLUGIN_HANDLED;
}

public 
ready_down(id)
{
    if((
pug_players_ready[id] == 0
        || 
GET_PUG_STATUS() != PUG_STATUS_WAITING || GET_PUG_STAGE() != PUG_STAGE_READY 
        
|| is_user_hltv(id)
    )
    {
        return 
pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED")
    }

    
pug_players_ready[id] = 0;
    
pug_total_ready--;

    
pug_ready_display(9999.0)

    static 
name[32]
    
get_user_name(id,name,31)
    
client_print(0,print_chat,"%s %L",pug_headerLANG_PLAYER"PUG_PLAYER_UNREADYED",name);

    return 
PLUGIN_HANDLED;
}

public 
pug_keepup_menu()
{
    if(
GET_PUG_STAGE() == PUG_STAGE_READY)
    {
        
pug_ready_display(99999.0)
    }
}
    

public 
pug_check_ready()
{
    if(
pug_total_ready >= GET_CVAR_MINPLAYERS() )
    {
        
pug_ready_display(1.0)
        
pug_ready()
    }
    else 
pug_ready_display(9999.0)
}


public 
pug_ready_display_funcid
public pug_ready_display_plugin_id

public pug_change_display(f_idp_id)
{
    
pug_ready_display_funcid f_id;
    
pug_ready_display_plugin_id p_id;
    
pug_keepup_menu()
}

// Rukia: NOTE TO DO: Allow for subbing in own ready display in other plugins.
public pug_ready_display(Float:hold_time)
{
    
callfunc_begin_i(pug_ready_display_funcid,pug_ready_display_plugin_id)
    
callfunc_push_float(hold_time)
    
callfunc_end()
}

public 
pug_ready_display_really(Float:hold_time)
{
    static 
readys[1056], notreadys[1056], name[32]

    
readys[0] = '^0'
    
notreadys[0] = '^0'

    
static Players[32]
    new 
playerCountiplayer
    get_players
(PlayersplayerCount"ch")
    for (
i=0i<playerCounti++)
    {
        
player Players[i]
        
get_user_name(player,name,31)

        if(
pug_players_ready[player]) format(readys,1054,"%s%s^n",readys,name)
        else 
format(notreadys,1054,"%s%s^n",notreadys,name)
    }

    new 
minplayers GET_CVAR_MINPLAYERS()

    
set_hudmessage(025500.80.0700.0hold_time0.00.03)
    
show_hudmessage(0,"Player Not Ready:",pug_get_players() - pug_total_ready,minplayers )

    
set_hudmessage(025500.80.5000.0hold_time0.00.02)
    
show_hudmessage(0,"Player Ready:",pug_total_ready,minplayers)

    
set_hudmessage(2552552250.800.5300.0hold_time0.00.01)
    
show_hudmessage(0,readys,1055)

    
set_hudmessage(2552552250.800.1000.0hold_time0.00.04)
    
show_hudmessage(0,notreadys,1055)
}

// Rukia: We are ready to go! Tell everyone!
public pug_ready()
{
    if(
GET_PUG_STAGE() != PUG_STAGE_READY) return 0;
    else if(
GET_PUG_STATUS() != PUG_STATUS_WAITING) return pug_set_pause_call(get_func_id("pug_ready"));

    
execute_gen_forward(pug_forward_ready)
    return 
1;
}

// Rukia: Restore state, tell everyone we are ready, and call the handler function!
public pug_ready_handler()
{
    if(
GET_PUG_STATUS() != PUG_STATUS_WAITING) return pug_set_pause_call(get_func_id("pug_ready_handler"));

    
SET_PUG_STATUS(PUG_STATUS_LIVE);
    
SET_PUG_STAGE(pug_ready_prev_stage);

    
pug_msg_tmp_empty(0,"PUG_IS_READY")

    
callfunc_begin_i(pug_ready_funcid,pug_ready_plugin_id)
    
callfunc_end()

    return 
1;

jg_20 is offline
Send a message via Skype™ to jg_20
 



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 11:54.


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