Raised This Month: $ Target: $400
 0% 

[ SOLVED ] Random ArraySize?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-16-2015 , 13:16   [ SOLVED ] Random ArraySize?
Reply With Quote #1

I'm with the following code to give a gun to any one player, but I'm errors at compile time, how to fix the code?

Code:
new wpnsz = ArraySize(g_botweapon_names);
fm_give_item(id, random(wpnsz));
__________________









Last edited by CrazY.; 11-16-2015 at 14:08.
CrazY. is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-16-2015 , 13:24   Re: [ HELP ] Random ArraySize?
Reply With Quote #2

PHP Code:
fm_give_item(idg_botweapon_names[random(sizeof(g_botweapon_names))]) 

Last edited by OciXCrom; 11-16-2015 at 13:24.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 11-16-2015 , 13:26   Re: [ HELP ] Random ArraySize?
Reply With Quote #3

Please, stop using fm conversions of already existing modules. For God sake, use real natives(give_item for example).
__________________
HamletEagle is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-16-2015 , 14:07   Re: [ HELP ] Random ArraySize?
Reply With Quote #4

Thank for the help.

Code:
new botwpn[32] ArrayGetString(g_botweapon_names, random_num(0, ArraySize(g_botweapon_names) - 1), botwpn, charsmax(botwpn)) fm_give_item(id, botwpn)

HamletEagle, i know about fun and cstrike, but i use the default includes of zombie_plague40.
__________________








CrazY. is offline
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 18:09.


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