Raised This Month: $ Target: $400
 0% 

get_user_ammo


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 04-04-2009 , 19:54   get_user_ammo
Reply With Quote #1

PHP Code:
new weapon_list[][]=
{
    
CSW_P228,
    
CSW_SCOUT,
    
CSW_XM1014,
    
CSW_MAC10,
    
CSW_AUG,
    
CSW_ELITE,
    
CSW_FIVESEVEN,
    
CSW_UMP45,
    
CSW_SG550,
    
CSW_GALIL,
    
CSW_FAMAS,
    
CSW_USP,
    
CSW_GLOCK18,
    
CSW_AWP,
    
CSW_MP5NAVY,
    
CSW_M249,
    
CSW_M3,
    
CSW_M4A1,
    
CSW_TMP,
    
CSW_G3SG1,
    
CSW_DEAGLE,
    
CSW_SG552,
    
CSW_AK47,
    
CSW_P90

PHP Code:
new weapon1clip1ammo1
                get_user_ammo
(idweapon1clip1ammo1)
                if (
ammo1 <= 5)
                if (
clip1 <= 5)
                {
//do

lol?? i just wanna check if players ammo/clip is lower then 5 :O whats wrong?
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 04-04-2009 , 19:57   Re: get_user_ammo
Reply With Quote #2

Don't hold me to it, but I think you can do it like:
(I'm new to this stuff as well.)

PHP Code:
public ddf(id)
{
    new 
weapon1clip1ammo1
    get_user_ammo
(idweapon1clip1ammo1)
    if (
ammo1 <= && clip1 <= 5)
    {
        
//do
    
}
    return 
PLUGIN_HANDLED

You see, when you add "&&" you are checking two 'if' statements in one, instead of checking two different ones. This is more efficient. The code I provided SHOULD work, but I'm not sure.

Last edited by BOYSplayCS; 04-04-2009 at 20:00.
BOYSplayCS is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 04-04-2009 , 20:05   Re: get_user_ammo
Reply With Quote #3

ty but its the same

PHP Code:
public client_prethink(id)
{
    new 
button pev(id,pev_button)
    if(
button IN_RELOAD)
    {
         switch(
random_num(0,2))
        {
             case 
0:
             {
                 new 
weapon1clip1ammo1
                get_user_ammo
(idweapon1clip1ammo1)
                if (
ammo1 <= && clip1 <= 5)
                {
                
client_cmd(id,"speak l4d_radio/Reloading01.wav");
                
client_cmd(id"say_team Reloading...Need backup")
                }
                return 
PLUGIN_HANDLED
            
}
            case 
1:
            {
                new 
weapon1clip1ammo1
                get_user_ammo
(idweapon1clip1ammo1)
                if (
ammo1 <= && clip1 <= 5)
                {
                
client_cmd(id,"speak l4d_radio/Reloading02.wav");
                
client_cmd(id"say_team Realoading!")
                }
                return 
PLUGIN_HANDLED
            
}
            case 
2:
            {
                new 
weapon1clip1ammo1
                get_user_ammo
(idweapon1clip1ammo1)
                if (
ammo1 <= && clip1 <= 5)
                {
                
client_cmd(id,"speak l4d_radio/Reloading03.wav");
                
client_cmd(id"say_team Need backup!")
                }
                return 
PLUGIN_HANDLED
            
}
            case 
3:
            {
                new 
weapon1clip1ammo1
                get_user_ammo
(idweapon1clip1ammo1)
                if (
ammo1 <= && clip1 <= 5)
                {
                
client_cmd(id,"speak l4d_radio/Reloading04.wav");
                
client_cmd(id"say_team Give me backup!i´m reloading")
                }
                return 
PLUGIN_HANDLED
            
}
            
        
        } 
        
        
        
//new radioSound = random_num( 0, (sizeof radio_snd) - 1 );
        //client_cmd(id,"%s", radio_snd[ random_num( 0, charsmax( radio_snd ) ) ]);
        //client_cmd(id,"spk %s", radio_snd[radioSound( 1, charsmax( radio_snd   ) ) ]);
    
}
    return 
PLUGIN_HANDLED

bullshit howmany ammo i have, this plays the sound & prints the test.i just wont to block the spam & this plays if player has only 5 shots in weapon.

hmm whats wrong?!
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 04-09-2009 , 15:38   Re: get_user_ammo
Reply With Quote #4

sry for bump.
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 04-09-2009 , 16:05   Re: get_user_ammo
Reply With Quote #5

PHP Code:
    new iClipiAmmoiWeapon get_user_weaponidiClipiAmmo );
    
    if( 
iAmmo <= ) {
        
client_printidprint_chat"Your ammo is under 5." );
        
        
// stuff
    
}
    
    if( 
iClip <= ) {
        
client_printidprint_chat"Your clip is under 5." );
        
        
// stuff
    

__________________
xPaw is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 04-09-2009 , 16:07   Re: get_user_ammo
Reply With Quote #6

ty. but why isnt my own not working? hmmm :-?
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 04-10-2009 , 03:30   Re: get_user_ammo
Reply With Quote #7

Quote:
Originally Posted by One View Post
ty. but why isnt my own not working? hmmm :-?
Becuase instead of weapon1 you should have index of weapon on player just read funcwiki
__________________
xPaw is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 04-10-2009 , 08:11   Re: get_user_ammo
Reply With Quote #8

Quote:
Originally Posted by xPaw View Post
Becuase instead of weapon1 you should have index of weapon on player just read funcwiki
Oh yeaaaaaaaaaaaaaaa......... F*** i 4got that ) damn
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 04-09-2009 , 16:33   Re: get_user_ammo
Reply With Quote #9

Shoudn't
Code:
new weapon_list[][]=
be
Code:
new weapon_list[] =
?
__________________
hleV 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 02:22.


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