Raised This Month: $ Target: $400
 0% 

Questions About :Bool


Post New Thread Reply   
 
Thread Tools Display Modes
Merc3y
Member
Join Date: Dec 2009
Old 01-28-2010 , 05:10   Re: Questions About :Bool
Reply With Quote #11

Quote:
Originally Posted by NcB_Sav View Post
Dont member where i got this from but here ya go

PHP Code:
new iPlayers32 ], iNum;
get_playersiPlayersiNum );
 
if( 
iNum <= ) {
    return;
}
 
new 
iRandomIndex randomiNum );
 
for( new 
0iNumi++ ) 
{
    if( 
== iRandomIndex 
    {
        
cs_set_user_teamiPlayers], CS_TEAM_T ); //Sets a random client to T
 
    

    else 
    {
        
cs_set_user_teamiPlayers], CS_TEAM_CT ); //Sets the rest to CT
    
}

Compile error using local and web:

Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team/home/groups/amxmodx/tmp3/phpeDWjFQ.sma(67) : warning 209: function "Game_Start" should return a value/home/groups/amxmodx/tmp3/phpeDWjFQ.sma(69) : warning 225: unreachable code/home/groups/amxmodx/tmp3/phpeDWjFQ.sma(69) : warning 217: loose indentation/home/groups/amxmodx/tmp3/phpeDWjFQ.sma(88) : warning 217: loose indentation/home/groups/amxmodx/tmp3/phpeDWjFQ.sma(88) : error 029: invalid expression, assumed zero/home/groups/amxmodx/tmp3/phpeDWjFQ.sma(88) : error 017: undefined symbol "Human_Class_Menu"/home/groups/amxmodx/tmp3/phpeDWjFQ.sma(97) : error 029: invalid expression, assumed zero/home/groups/amxmodx/tmp3/phpeDWjFQ.sma(97) : error 017: undefined symbol "Human_Class_Menu_Handler"/home/groups/amxmodx/tmp3/phpeDWjFQ.sma(97) : error 017: undefined symbol "item"/home/groups/amxmodx/tmp3/phpeDWjFQ.sma(97) : fatal error 107: too many error messages on one lineCompilation aborted.6 Errors.
Currently code:

Don't care the human classes

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 )
{
    new 
iPlayers32 ], iNum
    get_players
iPlayersiNum )
    new 
iRandomIndex randomiNum )
    if ( 
iNum <= ) {
        return;
    for( new 
0iNumi++ ) 
    {
        if ( 
== iRandomIndex 
        {
            
cs_set_user_teamiPlayers], CS_TEAM_CT )
        
        }
 
        else 
        {
            
cs_set_user_teamiPlayers], CS_TEAM_T )
        }
    }
}  

/*================================================================================
 [ 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_iHumanClassesid ] = 
    
            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
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 01-28-2010 , 13:20   Re: Questions About :Bool
Reply With Quote #12

Loose indntation means there is an error in spacing.. make sure you tap over what you copy and paste other wise its copied with spaces.
Doc-Holiday is offline
Merc3y
Member
Join Date: Dec 2009
Old 01-29-2010 , 16:37   Re: Questions About :Bool
Reply With Quote #13

Quote:
Originally Posted by NcB_Sav View Post
Loose indntation means there is an error in spacing.. make sure you tap over what you copy and paste other wise its copied with spaces.

Found this error in console :

Code:
L 01/30/2010 - 06:43:55: [AMXX]    [0] Dead-World.sma::Zombie_Class_Menu (line 183)
L 01/30/2010 - 06:43:55: [FUN] Player out of range (0)
L 01/30/2010 - 06:43:55: [AMXX] Displaying debug trace (plugin "Dead-World.amxx")
L 01/30/2010 - 06:43:55: [AMXX] Run time error 10: native error (native "strip_user_weapo
The problem seem to be here :

PHP Code:
public Game_Startid )
{
    new 
iPlayers32 ], iNum
    get_players
iPlayersiNum )

    if ( 
iNum <= ) {
    return;
    }

    new 
iRandomIndex randomiNum )

    for ( new 
0iNumi++ ) 
    {
        if ( 
== iRandomIndex 
        {
            
cs_set_user_teamiPlayers], CS_TEAM_CT )
            
g_iZombieid ] = false
        

        else 
        {
            
cs_set_user_teamiPlayers], CS_TEAM_T )
            
g_iZombieid ] = true
        
}
    }
 
    if ( 
g_iZombieid ] ) 
    {
        
set_task1.0"Zombie_Class_Menu"id )
    }
    else
    {
        
set_task1.0"Human_Class_Menu"id )
    }


public 
Zombie_Class_Menuid )
{
    switch( 
random_num1) )
    {
        case 
1:
        {
            
g_iZombieClassesid ] = 1

            strip_user_weapons
id )
            
set_user_healthid500 )
            
client_printcolorid"/gYou have random a raptor zombie." )
        }

        case 
2:
        {
            
g_iHumanClassesid ] = 1

            strip_user_weapons
id )
            
set_user_healthid255 )
            
client_printcolorid"/gYou have random a fatty." )
        }
    }

__________________
How I Wish That I Can Host Without Any Problem.

Last edited by Merc3y; 01-29-2010 at 17:49.
Merc3y is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 01-30-2010 , 00:20   Re: Questions About :Bool
Reply With Quote #14

PHP Code:
#define IsPlayer(%1) (1 <= %1 <= g_iMaxPlayers)

new g_iMaxPlayers


g_iMaxPlayers 
get_maxplayers(); 
Then to check
PHP Code:
if(!IsPlayer(id))
    return 
PLUGIN_HANDLED
Doc-Holiday is offline
Old 01-30-2010, 02:37
Temptation
This message has been deleted by Temptation.
OptimizeR
BANNED
Join Date: Jan 2010
Old 01-30-2010 , 02:47   Re: Questions About :Bool
Reply With Quote #15

PHP Code:
#include <amxmodx>

new test[33]

public 
plugin_init() register_clcmd("say /test""qwerty")

public 
qwerty(id)
{
    if (
test[id])
    {
        
client_print(idprint_chat"[AMXX] This boolean is true!")
        
test[id] = false
    
}
    else
    {
        
client_print(idprint_chat"[AMXX] This boolean is false!")
        
test[id] = true
    
}

OptimizeR is offline
Old 01-30-2010, 02:59
Temptation
This message has been deleted by Temptation.
OptimizeR
BANNED
Join Date: Jan 2010
Old 01-30-2010 , 03:15   Re: Questions About :Bool
Reply With Quote #16

Quote:
Originally Posted by Temptation View Post
Huh ?

I getting confuse with bool, so i don't need to add bool ?

And can't this ?

PHP Code:
public qwerty(id)
{
    if (
test[id])
    {
        
client_print(idprint_chat"[AMXX] This boolean is true!")
        
test[id] = true 
    
}
    else
    {
        
client_print(idprint_chat"[AMXX] This boolean is false!")
        
test[id] = false
    
}
}[/ 
Isn't Nessesary add bool.

Look in Zombie Plague mod

PHP Code:
new g_newround // new round starting
g_newround true 
does't nessesary have bool.


Sorry im wrong, this correct.

PHP Code:
public qwerty(id)
{
    if (
test[id]) // Verify, boolean test is true.
    
{
        
client_print(idprint_chat"[AMXX] This boolean is true!")
        
test[id] = false // Turn false boolean.
    
}
    else 
// Veryfi, boolean is false (else of true)
    
{
        
client_print(idprint_chat"[AMXX] This boolean is false!")
        
test[id] = true // Turn true boolean.
    
}

Translator:
PHP Code:
public qwerty(id)
{
    if (
test[id]) // We check if the this boolean in true
    
{
        
client_print(idprint_chat"[AMXX] This boolean is true!")
        
test[id] = false // We put the boolean in falsely, then to happen to the "else"
    
}
    else 
// We check if the this boolean in false
    
{
        
client_print(idprint_chat"[AMXX] This boolean is false!")
        
test[id] = true //We return to put the boolean in true to be able to go on to the IF again
    
}


Last edited by OptimizeR; 01-30-2010 at 03:26.
OptimizeR is offline
Temptation
Member
Join Date: Jan 2010
Old 01-30-2010 , 03:45   Re: Questions About :Bool
Reply With Quote #17

Quote:
Originally Posted by OptimizeR View Post
Isn't Nessesary add bool.

Look in Zombie Plague mod

PHP Code:
new g_newround // new round starting
g_newround true 
does't nessesary have bool.


Sorry im wrong, this correct.

PHP Code:
public qwerty(id)
{
    if (
test[id]) // Verify, boolean test is true.
    
{
        
client_print(idprint_chat"[AMXX] This boolean is true!")
        
test[id] = false // Turn false boolean.
    
}
    else 
// Veryfi, boolean is false (else of true)
    
{
        
client_print(idprint_chat"[AMXX] This boolean is false!")
        
test[id] = true // Turn true boolean.
    
}

Translator:
PHP Code:
public qwerty(id)
{
    if (
test[id]) // We check if the this boolean in true
    
{
        
client_print(idprint_chat"[AMXX] This boolean is true!")
        
test[id] = false // We put the boolean in falsely, then to happen to the "else"
    
}
    else 
// We check if the this boolean in false
    
{
        
client_print(idprint_chat"[AMXX] This boolean is false!")
        
test[id] = true //We return to put the boolean in true to be able to go on to the IF again
    
}

I'm confuse too

Can you explain more about the true & false ?

Can't it be like this like Merc3y say so ?

PHP Code:
public qwerty(id)
{
    if (
test[id]) // We check if the this boolean in true
    
{
        
client_print(idprint_chat"[AMXX] This boolean is true!")
        
test[id] = true // We put the boolean in falsely, then to happen to the "else"
    
}
    else 
// We check if the this boolean in false
    
{
        
client_print(idprint_chat"[AMXX] This boolean is false!")
        
test[id] = false //We return to put the boolean in true to be able to go on to the IF again
    
}
}[/ 

Last edited by Temptation; 01-30-2010 at 03:50.
Temptation is offline
OptimizeR
BANNED
Join Date: Jan 2010
Old 01-30-2010 , 03:46   Re: Questions About :Bool
Reply With Quote #18

Quote:
Originally Posted by Temptation View Post
Can you explain more about the true & false ?

Can't it be like this ?

PHP Code:
public qwerty(id)
{
    if (
test[id]) // We check if the this boolean in true
    
{
        
client_print(idprint_chat"[AMXX] This boolean is true!")
        
test[id] = true // We put the boolean in falsely, then to happen to the "else"
    
}
    else 
// We check if the this boolean in false
    
{
        
client_print(idprint_chat"[AMXX] This boolean is false!")
        
test[id] = false //We return to put the boolean in true to be able to go on to the IF again
    
}
}[/ 
Test the plugin.
OptimizeR is offline
Merc3y
Member
Join Date: Dec 2009
Old 01-30-2010 , 04:32   Re: Questions About :Bool
Reply With Quote #19

Quote:
Originally Posted by NcB_Sav View Post
PHP Code:
#define IsPlayer(%1) (1 <= %1 <= g_iMaxPlayers)
 
new g_iMaxPlayers
 
 
g_iMaxPlayers 
get_maxplayers(); 
Then to check
PHP Code:
if(!IsPlayer(id))
    return 
PLUGIN_HANDLED
I got error compile:

undefined symbol "IsPlayer"

function Game_Start should return a value.

PHP Code:
public Game_Startid )
{
    if ( !
IsPlayerid ) )
         return 
PLUGIN_HANDLED
    
new iPlayers32 ], iNum
    get_players
iPlayersiNum )
    if ( 
iNum <= ) {
    return;
    }
    new 
iRandomIndex randomiNum )
    for ( new 
0iNumi++ ) 
    {
        if ( 
== iRandomIndex 
        {
            
cs_set_user_teamiPlayers], CS_TEAM_CT )
            
g_iZombieid ] = false
        

        else 
        {
            
cs_set_user_teamiPlayers], CS_TEAM_T )
            
g_iZombieid ] = true
        
}
    }
 
    if ( 
g_iZombieid ] ) 
    {
        
set_task1.0"Zombie_Class_Menu"id )
        
g_iZombieid ] = true
    
}
    else
    {
        
set_task1.0"Human_Class_Menu"id )
        
g_iZombieid ] = false
    
}

__________________
How I Wish That I Can Host Without Any Problem.
Merc3y is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 01-30-2010 , 09:05   Re: Questions About :Bool
Reply With Quote #20

then fix it what i typed is correct man... just read and search bro..
Doc-Holiday 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 07:23.


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