Raised This Month: $ Target: $400
 0% 

Misstake in the code


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
KamiN
Senior Member
Join Date: Jun 2011
Old 12-10-2011 , 12:42   Misstake in the code
Reply With Quote #1

Sometimes (not all the time, i guess this "bug" pops up when in server are 14 - 16~ players) some of the players dont get things they must to (debends on the chosen day).
For e.g. they dont get guns on DAY_CTSHIELD, heres the code:

Code:
#define IsPlayer(%1) (1<=%1<=g_max_clients)

new g_max_clients

public plugin_init() {
    g_max_clients = get_maxplayers()
}

public do_specialday(id)
{
    new name[33]; get_user_name(id, name, charsmax(name))

    for(new i = 0; i < g_max_clients; i++)
    {
        switch(specialday[20])
        {

            case DAY_CTSHLD:
            {    
                if(IsPlayer(i) && is_user_alive(i))
                {
                    switch(cs_get_user_team(i))
                    {
                        case CS_TEAM_T:
                        {
                            strip_weapons(i)

                            give_item(i, "weapon_deagle")
                            give_item(i, "weapon_m4a1")
                            
                            cs_set_user_bpammo(i, CSW_DEAGLE, 9999)
                            cs_set_user_bpammo(i, CSW_M4A1, 9999)

                            if(!(pev(i, pev_flags) & FL_FROZEN))
                            {
                                client_print(i, print_center, "U'v been frozen for 6s!");
                                freeze = true
                                set_pev(i, pev_flags, (pev(i, pev_flags) | FL_FROZEN));
                                set_task(7.0, "unfreeze", TASK_unfreeze + id)
                            }
                        }
                        
                        case CS_TEAM_CT:
                        {
                            strip_weapons(i)
                            
                            give_item(i, "weapon_deagle")
                            give_item(i, "weapon_shield")
                            
                            cs_set_user_bpammo(i, CSW_DEAGLE, 35)

                
                        }
                    }
                }

                client_print(i, print_chat, "%s started CT SHIELD day", name)

                set_task(2.0, "specdaytxtprad", id, "", 0, "b", TASK_specd)
                set_task(6.0, "specdaytxtprad1", id)
                jail_open()
            }
        }
    }
}
Is there any misstake??

Im basicly talking about this part of code, becouse the rest of code i think is fine.

Code:
#define IsPlayer(%1) (1<=%1<=g_max_clients)

new g_max_clients

public plugin_init() {
    g_max_clients = get_maxplayers()
}

public do_specialday(id)
{
    new name[33]; get_user_name(id, name, charsmax(name))

    for(new i = 0; i < g_max_clients; i++)
    {
        switch(specialday[20])
        {

Last edited by KamiN; 12-10-2011 at 12:44.
KamiN is offline
 



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:47.


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