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

Solved !roulette random possibility


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TRServer
Junior Member
Join Date: Dec 2017
Old 12-13-2017 , 05:52   !roulette random possibility
Reply With Quote #1

Hello I have a problem

I want to identify myself to the possibility of random

Black %48
Red % 48
Green % 4

Code:
public Action:ElBasi(Handle:event, const String:name[], bool:dontBroadcast)
{
	int hangirenk = GetRandomInt(1, 38);
	renkcek = hangirenk;
}
public Action:ElSonu(Handle:event, const String:name[], bool:dontBroadcast)
{
	    if(renkcek==1 || renkcek==3 || renkcek==5 || renkcek==7 || renkcek==9 || renkcek==12 || renkcek==14 || renkcek==16 || renkcek==18 || renkcek==19 || renkcek==21 || renkcek==23 || renkcek==25 || renkcek==27 || renkcek==30 || renkcek==32 || renkcek==34 || renkcek==36){
		PrintToChatAll("Kırmızı");
    }else if(renkcek==37 || renkcek==38){

      	PrintToChatAll("Yeşil");
    }else{
    	
      	PrintToChatAll("Siyah");
    }
	
}

Last edited by TRServer; 12-15-2017 at 09:54.
TRServer is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 12-13-2017 , 10:16   Re: !roulette random possibility
Reply With Quote #2

PHP Code:
int num GetRandomInt(1100);

if (
num <= 48)
{
    
// Black
}
else if (
num <= 48 48// Or just <= 96, but I think it's easier to understand like that?
{
    
// Red
}
else 
/* if (num <= 48 + 48 + 4) */
{
    
// Green

__________________
hleV is offline
TRServer
Junior Member
Join Date: Dec 2017
Old 12-13-2017 , 11:22   Re: !roulette random possibility
Reply With Quote #3

Code:
    int num = GetRandomInt(1, 100);

	if (num <= 48)
	{
	    PrintToChat(client, "Siyah");
	}
	else if (num <= 48 + 48) // Or just <= 96, but I think it's easier to understand like that?
	{
	    PrintToChat(client, "Kırmızı");
	}
	else if (num <= 48 + 48 + 4)
	{
	    PrintToChat(client, "Yeşil");
	}
Thank you
TRServer is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 12-15-2017 , 06:32   Re: !roulette random possibility
Reply With Quote #4

Wouldn't that be more random ?

PHP Code:
int num GetRandomInt(1100); 

if(
num >= 96)
     
//Green
else if(num%== 0)
     
//Black
else //if(num%2 == 1)
     //Red 
__________________
Want to check my plugins ?
Arkarr is offline
TRServer
Junior Member
Join Date: Dec 2017
Old 12-15-2017 , 09:53   Re: !roulette random possibility
Reply With Quote #5

yes, that may be Thank you
TRServer 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 22:09.


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