Raised This Month: $ Target: $400
 0% 

Solved Giving ammo packs ZP4.3


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Vellety
New Member
Join Date: Dec 2018
Old 12-22-2018 , 04:58   Giving ammo packs ZP4.3
Reply With Quote #1

Could someone tell me why this does not work?
If I don't provide an argument it'll just say "Player not found" right, but if I do provide args nothing happens at all.

PHP Code:
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// cmds
    
register_clcmd("say /giveap""hCMD"ADMIN_BAN"Usage: /giveap <name> <amount>")
    
register_clcmd("say_team /giveap""hCMD"ADMIN_BAN"Usage: /giveap <name> <amount>")
}

public 
hCMD(id)
{
    new 
szName[32], iAmount[256];
    
read_argv(1szNamecharsmax (szName));
    
read_argv(2iAmountcharsmax (iAmount));
    
    new 
iTarget cmd_target(idszName2);
    if (!
iTarget)
    {
        
ColorChat(idRED"[ZM]^1 Player not found!!");
        return 
PLUGIN_HANDLED;
    }
    
    
zp_add_user_ammo_packs(iTargetmax(1str_to_num(iAmount)));
    return 
PLUGIN_HANDLED;


Last edited by Vellety; 12-22-2018 at 11:00. Reason: done
Vellety is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-22-2018 , 08:38   Re: Giving ammo packs ZP4.3
Reply With Quote #2

You can't use arguments with chat commands like that. You need to hook the "say" command and use "read_args" + "parse" to get the arguments.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Vellety
New Member
Join Date: Dec 2018
Old 12-22-2018 , 11:00   Re: Giving ammo packs ZP4.3
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
You can't use arguments with chat commands like that. You need to hook the "say" command and use "read_args" + "parse" to get the arguments.
Yea, thanks. Solved it
Vellety 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 07:32.


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