Raised This Month: $ Target: $400
 0% 

Give all players item


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 07-15-2013 , 09:55   Give all players item
Reply With Quote #1

I was trying to give all players an item everytime they spawn. But it seems only me who receive it.
PHP Code:
RegisterHam(Ham_Spawn"player""fwd_spawn"1
PHP Code:
public fwd_spawn(id)
{
    
    new 
players[32], num
    get_players
(playersnum"ae""T")
        
    if (!
is_user_alive(id))
    if (
get_cvar_num("health_enable") == 1)
    {
        
set_user_health(id,  120)
    }
    
    new 
weapon get_user_weapon(id)
    if (
is_user_alive(id))
    {
        
acg_drawoverviewradar(id100180180255255255)
        
g_bEnabled[id] = 1
        acg_showteammate
(id1)        
        
cs_set_user_armor(id100CS_ARMOR_VESTHELM)
        
give_item(id"weapon_hegrenade")
        
cs_set_user_bpammo(idCSW_HEGRENADE2)
        
        for(new 
0numi++)
        {
            
give_item(players[id], "weapon_m4a1")
        }
    }
    if (
weapon == CSW_HEGRENADE)
    {
        
cs_set_weapon_ammo(id2)
    }
    return 
PLUGIN_CONTINUE

Randomize is offline
K1d0x
Senior Member
Join Date: Apr 2012
Location: Copenhagen, Denmark
Old 07-15-2013 , 10:07   Re: Give all players item
Reply With Quote #2

PHP Code:
public fwd_spawn()
{
    new 
Players[32]
    new 
playerCountiid
    get_players
(PlayersplayerCount"ce""TERRORIST");
    
    for (
i=0i<playerCounti++) {
        
id Players[i
    
        if (
get_cvar_num("health_enable") == 1)
        {
            
set_user_health(id,  120)
        }
        
        new 
weapon get_user_weapon(id)
        if (
is_user_alive(id))
        {
            
acg_drawoverviewradar(id100180180255255255)
            
g_bEnabled[id] = 1
            acg_showteammate
(id1)        
            
cs_set_user_armor(id100CS_ARMOR_VESTHELM)
            
give_item(id"weapon_hegrenade")
            
cs_set_user_bpammo(idCSW_HEGRENADE2)
            
            
give_item(id"weapon_m4a1")

            if (
weapon == CSW_HEGRENADE)
            {
                
cs_set_weapon_ammo(id2)
            }
        }
    }
    
    return 
PLUGIN_CONTINUE

PS: if you use flag "a" in get_players then you don't need to use is_user_alive(id) function, id = players are alive, no bots and are terrorists
__________________
I Hate people who can hate me !

Last edited by K1d0x; 07-15-2013 at 10:19.
K1d0x is offline
Send a message via Yahoo to K1d0x Send a message via Skype™ to K1d0x
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-15-2013 , 10:31   Re: Give all players item
Reply With Quote #3

Don't use get_players in Spawn callback ! DAMN !

Also, players[ id ] means nothing when you increment i.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
K1d0x
Senior Member
Join Date: Apr 2012
Location: Copenhagen, Denmark
Old 07-15-2013 , 10:37   Re: Give all players item
Reply With Quote #4

Quote:
Originally Posted by ConnorMcLeod View Post
Don't use get_players in Spawn callback ! DAMN !

Also, players[ id ] means nothing when you increment i.
PHP Code:
public fwd_spawn(id)
{
    if(!
is_user_alive(id))
        return 
0
    
    
if(get_user_team(id) == 1) {
        if (
get_cvar_num("health_enable") == 1)
        {
            
set_user_health(id,  120)
        }
            
        new 
weapon get_user_weapon(id)
        
        
acg_drawoverviewradar(id100180180255255255)
        
g_bEnabled[id] = 1
        acg_showteammate
(id1)        
        
cs_set_user_armor(id100CS_ARMOR_VESTHELM)
        
give_item(id"weapon_hegrenade")
        
cs_set_user_bpammo(idCSW_HEGRENADE2)
        
        
give_item(id"weapon_m4a1")
        
        if (
weapon == CSW_HEGRENADE)
        {
            
cs_set_weapon_ammo(id2)
        }
    }
    
    return 
0

__________________
I Hate people who can hate me !

Last edited by K1d0x; 07-15-2013 at 10:38.
K1d0x is offline
Send a message via Yahoo to K1d0x Send a message via Skype™ to K1d0x
baneado
Veteran Member
Join Date: Dec 2012
Location: amxmodx-es.com
Old 07-15-2013 , 10:38   Re: Give all players item
Reply With Quote #5

LOL? In your code when somebody respawn, you give weapons and health for all players...
baneado is offline
zRokh
New Member
Join Date: Jul 2013
Location: Behind my PC .-.
Old 07-15-2013 , 11:08   Re: Give all players item
Reply With Quote #6

Quote:
Originally Posted by baneado View Post
LOL? In your code when somebody respawn, you give weapons and health for all players...
CT1: *Thinking* oo, a camper with 3hp, im gonna knife him
CT2: *DEAD*
*All players get full HP and weapons*
*The sound of someone getting weapons*
__________________
Aye doods!
Much luv to ya!
zRokh is offline
Send a message via AIM to zRokh
Reply


Thread Tools
Display Modes

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


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