AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ SOLVED ] Random ArraySize? (https://forums.alliedmods.net/showthread.php?t=274862)

CrazY. 11-16-2015 13:16

[ SOLVED ] Random ArraySize?
 
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));


OciXCrom 11-16-2015 13:24

Re: [ HELP ] Random ArraySize?
 
PHP Code:

fm_give_item(idg_botweapon_names[random(sizeof(g_botweapon_names))]) 


HamletEagle 11-16-2015 13:26

Re: [ HELP ] Random ArraySize?
 
Please, stop using fm conversions of already existing modules. For God sake, use real natives(give_item for example).

CrazY. 11-16-2015 14:07

Re: [ HELP ] Random ArraySize?
 
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.


All times are GMT -4. The time now is 18:09.

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