Raised This Month: $51 Target: $400
 12% 

Choose Random Item ?


Post New Thread Reply   
 
Thread Tools Display Modes
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
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 06-25-2017 , 07:03   Re: Choose Random Item ?
Reply With Quote #2

This is SourceMod, not AmxModX
Wrong place.

Last edited by Celena Luna; 06-25-2017 at 07:03.
Celena Luna 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 13:17.


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