AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Bullets (https://forums.alliedmods.net/showthread.php?t=230140)

ironskillz1 11-20-2013 13:59

Bullets
 
Am i doing something wrong here?
Im giving people bullets. But some people doesnt get bullets and some people do?
I realy dont now how to fix this

Here is an exemple from my last request

Code:

LR_Paintball( id )
{
        strip_user_weapons( id );
        give_item( id, "weapon_mp5navy" )
        cs_set_user_bpammo(id, CSW_MP5NAVY, 30)
        set_pev(id, pev_viewmodel2, g_szPaintball);
        set_pev(id, pev_weaponmodel2, g_szPaintball2);
        set_task( 0.1, "GiveAmmo", id, _,_, "b" )
                                               
        message_begin(MSG_ONE_UNRELIABLE, HideWeapon, _, id)
        write_byte(1<<6)
        message_end()
}

Code:

public GiveAmmo( iPlayer )
{
        if( is_user_alive( iPlayer ) )
        {               
                static clip, ammo
                if( g_iCurrentGame == LR_PAINTBALL)               
                {
                        get_user_ammo( iPlayer, CSW_MP5NAVY, clip, ammo )
                        if ( clip <= 0 )
                        {
                                cs_set_user_bpammo(iPlayer, CSW_MP5NAVY, 30)
                        } 
                }
        }
}


alan_el_more 11-20-2013 14:23

Re: Bullets
 
Show when functions are called

PS: unlimites bp ammo?

ironskillz1 11-20-2013 14:25

Re: Bullets
 
I dont think function have anything todo with this code.

This code makes so when you run out of ammo you get 30 clip to reload

ironskillz1 11-20-2013 14:49

Re: Bullets
 
Found the bug

Code:

cl_lw 1

Blizzard_87 11-20-2013 21:17

Re: Bullets
 
To save code you can give_item inside the giving back pack ammo native.

Code:
 cs_set_user_bpammo( id , give_item( id , " weapon_mp5navy" ), 30 );

hornet 11-20-2013 23:35

Re: Bullets
 
Quote:

Originally Posted by Blizzard_87 (Post 2063425)
To save code you can give_item inside the giving back pack ammo native.

Code:
 cs_set_user_bpammo( id , give_item( id , " weapon_mp5navy" ), 30 );

give_item() returns the index of the entity created, not the CSW_* constant ( which is what is required in cs_set_user_bpammo() ).

Sounds like your thinking of cs_set_weapon_ammo() where you would set the clip amount of the created weapon.

Blizzard_87 11-20-2013 23:45

Re: Bullets
 
Quote:

Originally Posted by hornet (Post 2063441)
give_item() returns the index of the entity created, not the CSW_* constant ( which is what is required in cs_set_user_bpammo() ).

Sounds like your thinking of cs_set_weapon_ammo() where you would set the clip amount of the created weapon.

oh crap your right sorry.. donno what i was thinking.


All times are GMT -4. The time now is 13:45.

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