Raised This Month: $ Target: $400
 0% 

Choose Random Item ?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
ilostmyoldacc
New Member
Join Date: Jun 2017
Old 06-25-2017 , 06:15   Choose Random Item ?
Reply With Quote #1

I'm trying to choose a random item from a item list stored in a string. How can i do that ?
My attempt:
Code:
#include <sourcemod>

static const String: Items[][] = 
{ 
	"Item1",
	"Item2",
	"Item3"
}

public OnPluginStart()
{
	RegConsoleCmd( "items", Command_ChooseItems )
}

public Action: Command_ChooseItems( client, args )
{
	for( new i = 0; i < sizeof( Items ); i++ ) 
	{
		new ChoosedItem = GetRandomInt( Items[ i ] )
		PrintToChatAll( "Server choosed %s", ChoosedItem )
	}
}
ilostmyoldacc is offline
 



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 22:49.


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