AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how i can do a random array? (https://forums.alliedmods.net/showthread.php?t=188502)

Ang52 06-27-2012 08:16

how i can do a random array?
 
this is my code

but i don't know how to random array, i'v been search in the forum.

PHP Code:

#include < amxmodx >

new Array:Games
new gGamesCount;

public 
plugin_natives( )
{
    
register_native"jb_games_register""native_games_register" );
}

public 
native_games_registerpluginparams )
{
    new 
name64 ];
    
get_string1namecharsmaxname ) )
    
    
ArrayPushStringGamesname )
    
    
gGamesCount++
    return 
gGamesCount 1;
}

public 
plugin_init( )
{
    
register_clcmd"say /random""random_array" );
    
    
Games ArrayCreate36);
}

public 
random_arrayid )
{
    
// ok... what next?


thanks for help. :)

DJHD! 06-27-2012 08:19

Re: how i can do a random array?
 
random_num?

hornet 06-27-2012 08:30

Re: how i can do a random array?
 
Explain what your trying to do.

Ang52 06-27-2012 09:13

Re: how i can do a random array?
 
im want that when i will write /random it will be choose a random game from the Array

did is possible?

of course it possible.

this is all i try to do.

to do a random game from the array.

Bugsy 06-27-2012 11:42

Re: how i can do a random array?
 
random - Returns a pseudo-random number in the range of 0 to max-1.

PHP Code:

new szGame64 ];
ArrayGetStringGames randomArraySizeGames ) ) , szGame charsmaxszGame ) ); 



All times are GMT -4. The time now is 06:13.

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