Raised This Month: $ Target: $400
 0% 

Not giving weapon!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CarbonDioxide
Member
Join Date: Apr 2012
Old 06-14-2012 , 14:49   Not giving weapon!
Reply With Quote #1

I have this:
PHP Code:
register_clcmd("say /random""cmd_random"
PHP Code:
public cmd_random(player)
{    
    new 
players[32], numplayer;
    
get_playersplayersnum"a" );
    
    for( new 
0numi++ )
    {
        
player players[i];
        
        switch(
cs_get_user_team(player))
        {
            case 
CS_TEAM_T:
            {
                 
//Do some stuff   
            
}            
            case 
CS_TEAM_CT:
            {
                
//Some stuff
                
give_item(player"weapon_glock18");
            }
        }
    }

When the command is executed the terrorist part of the switch is executed without any problem, but the ct part just won't work for some reason. What am I doing wrong ?

*The function can only be excecuted when there is only one T alive, and only by this one T.

Last edited by CarbonDioxide; 06-14-2012 at 14:50.
CarbonDioxide is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-14-2012 , 15:02   Re: Not giving weapon!
Reply With Quote #2

You should show the full code. There could be things that you removed which would be causing the problem.

Also, I noticed you create a new "player" variable even though one is already passed to the function.
Rename the one in the function header so they aren't confused.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
CarbonDioxide
Member
Join Date: Apr 2012
Old 06-14-2012 , 15:31   Re: Not giving weapon!
Reply With Quote #3

PHP Code:
public random(idplayer)
    {
        
formatex(optioncharsmax(option), "%L"LANG_SERVER"UJBM_MENU_LASTREQ_SEL2"dst)
    
        new 
players[32], numplayer;
        
get_playersplayersnum"a" );
        
        for( new 
0numi++ )
        {
            
player players[i];
            
            
server_cmd("jb_block_weapons")
            
player_strip_weapons_all()
                            
            switch(
cs_get_user_team(player))
            {
                case 
CS_TEAM_T:
                {
                    
set_user_health(player1);
                    
give_item(player"weapon_ak47");
                    
cs_set_user_bpammo(playerCSW_AK47200);
                    
set_user_rendering(playerkRenderFxGlowShell000kRenderTransAlpha15);
                }            
                case 
CS_TEAM_CT:
                {
                    
set_user_health(player100);
                    
give_item(player"weapon_glock18");
                    
cs_set_user_bpammo(playerCSW_GLOCK18120)
                }
            }
        }
    } 
CarbonDioxide is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-14-2012 , 15:36   Re: Not giving weapon!
Reply With Quote #4

PHP Code:
public random(idplayer
What are you even doing? Remove player.


PHP Code:
            server_cmd("jb_block_weapons")
            
player_strip_weapons_all() 
Move these to outside the loop.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
CarbonDioxide
Member
Join Date: Apr 2012
Old 06-14-2012 , 15:50   Re: Not giving weapon!
Reply With Quote #5

That actually worked. Silly of me.. Ty alot !
CarbonDioxide 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 06:13.


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