Raised This Month: $ Target: $400
 0% 

Questions About :Bool


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Merc3y
Member
Join Date: Dec 2009
Old 01-23-2010 , 22:19   Questions About :Bool
Reply With Quote #1

Target:

I was trying to make every round call a function that randomly pick randomly number of clients to become humans and change their team to "CT", the rest shall become zombies which it's team is "T". A human classes menu will appear only for humans.

Problem:

1. I not sure weither the function that randomly pick randomly number of clients is called or the human classes menu were called, because the human classes didn't show.

2. Should i use hook the speed or using playerthink will do ?

3. I can't figure how to change the remaining clients after the "CT" were pick to become "T".

4. How to use bool ?

5. Game hangs when using this plugin-in.

Codes:

PHP Code:
/*================================================================================ 
  
    -----------------------------------
    -*- Dead World -*-
    -----------------------------------
    
    ~~~~~~~~~~~~~~~
    - Description -
    ~~~~~~~~~~~~~~~
    
    Currently none.
 
    
================================================================================*/

/*================================================================================
 [ Include Customization ]
=================================================================================*/

#include < amxmodx >
#include < fakemeta >
#include < amxmisc >
#include < fun >
#include < cstrike >

/*================================================================================
 [ Game Variable Customization ]
=================================================================================*/

new g_iMsgSayTextg_iMaxPlayersg_iDelayg_iHumanClasses33 ]
new 
bool:g_iZombie33 ]

/*================================================================================
 [ Plugin ini Customization ]
=================================================================================*/

public plugin_init( )
{
    
register_plugin"Dead World" "1.0""Merc3y" )
    
register_forwardFM_PlayerPreThink"fw_PlayerPreThink" )
    
register_logevent"logevent_round_start"2"1=Round_Start" 
    
register_concmd"amx_deadworld""Toggle"ADMIN_LEVEL_D" < 1 = on | 0 = off >" )
    
register_cvar"deadworld_toggle""0" )
    
g_iDelay register_cvar"deadworld_delay""10.0" )
    
g_iMsgSayText get_user_msgid"SayText" )
    
g_iMaxPlayers get_maxplayers( )
}

/*================================================================================
 [ Game Customization ]
=================================================================================*/

public Game_Startid )
{
    
#define NUMS 4
    
new iNumplayers32 ]
    new 
randomnumsNUMS ]
    
get_playersplayersiNum"a" )
    
    for ( new 
i=0i<= sizeofrandomnums ); i++ )
    {
        
randomnums] = random_num1iNum )
        if ( 
!= )
        {
            for( new 
j=0j<ij++ )
            {
                if ( 
randomnums] == randomnums] )
                {
                    
i--
                    break
                }
            }
        }
    }
    
    for ( new 
a=0a<=iNuma++ )
    {
        for ( new 
b=0b<=NUMSb++ )
        {
            if ( 
players] == playersrandomnums] ] )
            {
                
cs_set_user_teamplayersrandomnums] ], CS_TEAM_CT )
                
g_iZombieid ] = false
            
}
            
            else
            {
                
cs_set_user_teamplayersrandomnums] ], CS_TEAM_T )
                
g_iZombieid ] = true
            
}
        }
    }

    if ( 
is_user_aliveid ) && !g_iZombieid ] )
    { 
        
set_task1.0"Human_Class_Menu"id )
        
g_iZombieid ] = false
    


    else if ( 
is_user_aliveid ) && g_iZombieid ] )
    {
        
g_iZombieid ] = true
        remove_task
id )
    }      
}  

/*================================================================================
 [ Human Class Customization ]
=================================================================================*/

public Human_Class_Menuid )
{
    new 
menu menu_create"Human Class Menu""Human_Class_Menu_Handler" )
    
menu_additemmenu"Sniper""1")
    
menu_additemmenu"Combat""2")
    
menu_setpropmenuMPROP_EXITMEXIT_ALL )
    
menu_displayidmenu)
}

public 
Human_Class_Menu_Handleridmenuitem )
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroymenu )
        return 
PLUGIN_HANDLED
    
}
    
    new 
data], iName64 ]
    new 
accesscallback
    menu_item_getinfo
menuitemaccessdata5iName63callback )
    new 
key str_to_numdata )
    
    switch( 
key )
    {
        case 
1:
        {
            
g_iHumanClasses id ] = 
    
            strip_user_weapons
id )
  
            
set_user_healthid100 )
            
set_user_armorid50 )
            
cs_set_user_nvgid)
            
give_itemid"weapon_awp" )
            
give_itemid"weapon_deagle" )
            
cs_set_user_bpammoidCSW_AWP30 )
            
cs_set_user_bpammoidCSW_DEAGLE56 )
            
client_printcolorid"/gYou have chosen sniper." )
        }

        case 
2:
        {
            
g_iHumanClassesid ] = 1

            strip_user_weapons
id )
            
set_user_healthid150 )
            
set_user_armorid35 )
            
give_itemid"weapon_m4a1" )
            
give_itemid"weapon_ak47" )
            
give_itemid"weapon_deagle" )
            
cs_set_user_bpammoidCSW_M4A190 )
            
cs_set_user_bpammoidCSW_AK4790 )
            
cs_set_user_bpammoidCSW_DEAGLE56 )
            
client_printcolorid"/gYou have chosen combat." )
        }
    }
    
menu_destroymenu )
    return 
PLUGIN_HANDLED
}

/*================================================================================
 [ Human Speed Customization ]
=================================================================================*/

public fw_PlayerPreThinkid )
{
    if ( 
g_iHumanClassesid ] == )
    {
        
set_user_maxspeedid250.0 )
    }

    if ( 
g_iHumanClassesid ] == )
    {
        
set_user_maxspeedid230.0 )
    }
}

/*================================================================================
 [ Toggle Customization ]
=================================================================================*/

public Toggleidlevelcid )
{
    if ( !
cmd_accessidlevelcid) )
    {
        return 
PLUGIN_HANDLED
    
}
    new 
arg132 ]
    
read_argv1arg131 )
    if ( 
str_to_numarg1 ) )
    {
        
set_cvar_num"deadworld_toggle")
        
server_cmd"sv_restartround 10" )
    } 
    else
    {
        
set_cvar_num"deadworld_toggle")
        
server_cmd"sv_restartround 10" )
    }       
    return 
PLUGIN_HANDLED
}

/*================================================================================
 [ Event Customization ]
=================================================================================*/

public logevent_round_start( )
{
    if ( 
get_cvar_num"deadworld_toggle" ) == )
    {
        for ( new 
1<= g_iMaxPlayersi++ )
        {
            
set_taskget_pcvar_floatg_iDelay ), "Game_Start" )
        }
    }
}

/*================================================================================
 [ Stock Customization ]
=================================================================================*/
stock client_printcolor( const id, const input[ ], any:... )
{
 new 
iCount 1iPlayers32 ]
 
 static 
szMsg191 ]
 
vformatszMsgcharsmaxszMsg ), input)
 
 
replace_allszMsg190"/g""^4" 
 
replace_allszMsg190"/y""^1" 
 
replace_allszMsg190"/ctr""^3" 
 
replace_allszMsg190"/w""^0" 
 
 if ( 
id iPlayers] = id
 
else get_playersiPlayersiCount"ch" )
 
 for ( new 
0iCounti++ )
 {
  if ( 
is_user_connectediPlayers] ) )
  {
   
message_beginMSG_ONE_UNRELIABLEg_iMsgSayText_iPlayers] )
   
write_byteiPlayers] )
   
write_stringszMsg )
   
message_end( )
  }
 }

__________________
How I Wish That I Can Host Without Any Problem.
Merc3y 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 07:23.


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