Raised This Month: $ Target: $400
 0% 

Solved Problem with zp_giveap plugin command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GasmoN
Member
Join Date: Jul 2014
Old 02-12-2017 , 12:50   Problem with zp_giveap plugin command
Reply With Quote #1

When i tupe zp_giveap SomeName 100, it will give 100 ammo packs to player.
But when i type zp_giveap @ALL 100, command doesn't work. Can someone tell me why?

PHP Code:
public CmdGiveAP idlevelcid )
{
    if(!
cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
    
    
new arg_name[32],arg_ap[10]
    
    
read_argv(1,arg_name,31)
    
read_argv(2,arg_ap,9)
    
    new 
name[32],target_name[32], ip[16],target_ip[16], steamid[32],target_steamid[32],
    
targetnum_ap str_to_num(arg_ap)
    
    if(!
equali(arg_name,"@ALL")) target cmd_target(id,arg_name,0)
    
    
get_user_name(id,name,31)
    
get_user_ip(id,ip,15,1)
    
get_user_authid(id,steamid,31)
    
    
get_user_name(target,target_name,31)
    
get_user_ip(target,target_ip,15,1)
    
get_user_authid(target,target_steamid,31)
    
    if(
num_ap <= 0)
    {
        
console_print(id,"[ZP] You can give only positive ammo packs.")
        return 
PLUGIN_HANDLED
    
}
    
    if(!
target)
    return 
PLUGIN_HANDLED;
    
    if(
equali(arg_name,"@ALL"))
    {
        for(new 
i=1;i<33;i++) if(is_user_connected(i)) zp_ammopacks_set(izp_ammopacks_get(i) + num_ap)
        
client_printc(id"!g%s %L"PREFIXLANG_PLAYER"AP_AMMOTOALL"namenum_ap)
    } 
    else 
    {
        
zp_ammopacks_set(targetzp_ammopacks_get(target) + num_ap)
        
client_printc(target"!g%s !n%L"PREFIXLANG_PLAYER"AP_GIVEAP"namenum_ap)
    }
    
    return 
PLUGIN_HANDLED
    


Last edited by GasmoN; 02-12-2017 at 14:17.
GasmoN is offline
Old 02-12-2017, 13:07
edon1337
This message has been deleted by edon1337. Reason: nvm it's < not <=
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-12-2017 , 13:33   Re: Problem with zp_giveap plugin command
Reply With Quote #3

You need to check the cmd_access
PHP Code:
if(!cmd_access(id,level,cid,2)) // the 4th parameter is the number of argc (number of blanks) 

And ....

 if(!
equali(arg_name,"@ALL")) target cmd_target(id,arg_name,0
else 
target 1
     

And...

  if(
equali(arg_name,"@ALL")) 
    { 
        for(new 
i=1;i<=get_maxplayers();i++) if(is_user_connected(i)) zp_ammopacks_set(izp_ammopacks_get(i) + num_ap
        
client_printc(0"!g%s %L"PREFIXLANG_PLAYER"AP_AMMOTOALL"namenum_ap)
    } 

Last edited by Natsheh; 02-12-2017 at 13:40.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
GasmoN
Member
Join Date: Jul 2014
Old 02-12-2017 , 14:14   Re: Problem with zp_giveap plugin command
Reply With Quote #4

Quote:
Originally Posted by Natsheh View Post
You need to check the cmd_access
PHP Code:
if(!cmd_access(id,level,cid,2)) // the 4th parameter is the number of argc (number of blanks) 

And ....

 if(!
equali(arg_name,"@ALL")) target cmd_target(id,arg_name,0
else 
target 1
     

And...

  if(
equali(arg_name,"@ALL")) 
    { 
        for(new 
i=1;i<=get_maxplayers();i++) if(is_user_connected(i)) zp_ammopacks_set(izp_ammopacks_get(i) + num_ap
        
client_printc(0"!g%s %L"PREFIXLANG_PLAYER"AP_AMMOTOALL"namenum_ap)
    } 
This fixed my problem, thanks!
GasmoN is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 02-12-2017 , 16:15   Re: Problem with zp_giveap plugin command
Reply With Quote #5

https://www.dropbox.com/sh/tn9j72d52...ampks.sma?dl=0

https://www.dropbox.com/sh/tn9j72d52...ampks.txt?dl=0
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
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 20:27.


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