Jump to content

Lottery


Ghostman

Recommended Posts

How do you want to lottery to be started?

When you say in safezone, do you want a specific amount of players to be in the safezone and then a hint window pops up that says "Player XY won the lottery and got XY coins."? Or how do you want it? That would be good to know to write something like this.

Another method would be a scroll wheel option on the traders, something like "enter the lottery" and after x amount of time, an entered player gets chosen randomly with the condition that he is still online.

Link to comment
Share on other sites

Just now, Ghostman said:

I'm looking for a lottery script in safezone with trader "lottery for 1x, 2x, 3x or 10k, 20k, 30k" NO EVENTS

i had writed this old for my 1.0.5.1 is a Blackjack game... you can adjust to use in 1.6.1 using the new salival ZSC function to add-remove money or the iben function for the same.

How this works? you set an scroll menu option on one of your trader and execute this scritp.

Spoiler

private ["_rand","_added","_costs"];


_costs = 500;

if (_neartrader) then {
	if !([ player,_costs] call SC_fnc_removeCoins) then {
		titleText [format["Needs %1 %2 for gambling.",_costs,CurrencyName] , "PLAIN DOWN", 1];
	} else {
	titleText [format["you pay %1  %2 %3",_costs,CurrencyName] , "PLAIN DOWN", 1];

			_rand = floor(random 200);
			
			if (_rand <= 50) then {
				
				titleText ["You took 24 you lost", "PLAIN DOWN"];titleFadeOut 5; 
			};
			if (_rand <= 150 && _rand > 51) then {
				_added = [player, 1000] call SC_fnc_addCoins;
				[format["<t size='1.2' color='#D01000'>WOW 21!!!!%1</t><br/><t size='0.9'>WIN 1.000!!!!.</t>",(name player)],0,0,2,2] spawn BIS_fnc_dynamicText;  
			};
			if (_rand <= 180 && _rand > 151) then {
				
				titleText ["you take 18 I take 20you lost", "PLAIN DOWN"];titleFadeOut 5;
			};
			if (_rand <= 200 && _rand > 181) then {
				titleText ["You take 20, But its my day 21! you lost", "PLAIN DOWN"];titleFadeOut 5;
						};
    };
  };	

 

@DAmNRelentless i think you can update it in a minute, its very easy... just need a time prevention to not use again and use

Here you got a quick update to start to work.

_depositMoneyin = "cache";//bank is the other option//works if u have the @iben function and true below
_fn_SC_uniCoins = true;//set false if u dont have @iben funcion
_Reward = 1000;
_cost = 100;
_coins = player getVariable [Z_moneyVariable,0];

if (_coins < _cost) then {
    cutText[format["You need %1 coins to play this game!",_cost], "PLAIN DOWN"];
} else {
titleText [format["you pay %1 coins goodluck",_cost] , "PLAIN DOWN", 1];
sleep 1;
player setVariable[Z_moneyVariable, (_coins - _cost), true];
_rand = floor(random 100);
if (_rand <= 70) exitWith {
_cardtext = [
"24",
"22",
"23",
"25",
"19"
]call BIS_fnc_selectRandom;

titleText [format["You took %1 ...looser",_cardtext], "PLAIN DOWN",2]; 
			};
	
if (_rand <= 100 && _rand > 71) then {
[format["<t size='1.2' color='#D01000'>WOW 21!!!!%1</t><br/><t size='0.9'>WIN %2!!!!.</t>",(name player),_Reward],0,0,2,2] spawn BIS_fnc_dynamicText; 
 if (_fn_SC_uniCoins) then {
     [player,_Reward,"add",_depositMoneyin] call fnc_SC_uniCoins;
    } else {
      _coins = _coins + _Reward;
      player setVariable[Z_moneyVariable,_coins,true];
    };
};	
};

 

Link to comment
Share on other sites

But it is clear how a lottery works?

1. Everyone has to deposit something.

2. The organizer (usually the goverment, in this case the admin) take half of the amount paid.

3. The rest belongs to the winner.

In a lottery, there is only one winner, the organizer. The reason why I do not play lottery in real life.

Again, my motto is: No pain, no gain. Pay first, then (maybe) win.

Otherwise, a nice idea.

Link to comment
Share on other sites

23 hours ago, juandayz said:

i had writed this old for my 1.0.5.1 is a Blackjack game... you can adjust to use in 1.6.1 using the new salival ZSC function to add-remove money or the iben function for the same.

How this works? you set an scroll menu option on one of your trader and execute this scritp.

  Reveal hidden contents


private ["_rand","_added","_costs"];


_costs = 500;

if (_neartrader) then {
	if !([ player,_costs] call SC_fnc_removeCoins) then {
		titleText [format["Needs %1 %2 for gambling.",_costs,CurrencyName] , "PLAIN DOWN", 1];
	} else {
	titleText [format["you pay %1  %2 %3",_costs,CurrencyName] , "PLAIN DOWN", 1];

			_rand = floor(random 200);
			
			if (_rand <= 50) then {
				
				titleText ["You took 24 you lost", "PLAIN DOWN"];titleFadeOut 5; 
			};
			if (_rand <= 150 && _rand > 51) then {
				_added = [player, 1000] call SC_fnc_addCoins;
				[format["<t size='1.2' color='#D01000'>WOW 21!!!!%1</t><br/><t size='0.9'>WIN 1.000!!!!.</t>",(name player)],0,0,2,2] spawn BIS_fnc_dynamicText;  
			};
			if (_rand <= 180 && _rand > 151) then {
				
				titleText ["you take 18 I take 20you lost", "PLAIN DOWN"];titleFadeOut 5;
			};
			if (_rand <= 200 && _rand > 181) then {
				titleText ["You take 20, But its my day 21! you lost", "PLAIN DOWN"];titleFadeOut 5;
						};
    };
  };	

 

@DAmNRelentless i think you can update it in a minute, its very easy... just need a time prevention to not use again and use

Here you got a quick update to start to work.


_depositMoneyin = "cache";//bank is the other option//works if u have the @iben function and true below
_fn_SC_uniCoins = true;//set false if u dont have @iben funcion
_Reward = 1000;
_cost = 100;
_coins = player getVariable [Z_moneyVariable,0];

if (_coins < _cost) then {
    cutText[format["You need %1 coins to play this game!",_cost], "PLAIN DOWN"];
} else {
titleText [format["you pay %1 coins goodluck",_cost] , "PLAIN DOWN", 1];
sleep 1;
player setVariable[Z_moneyVariable, (_coins - _cost), true];
_rand = floor(random 100);
if (_rand <= 70) exitWith {
_cardtext = [
"24",
"22",
"23",
"25",
"19"
]call BIS_fnc_selectRandom;

titleText [format["You took %1 ...looser",_cardtext], "PLAIN DOWN",2]; 
			};
	
if (_rand <= 100 && _rand > 71) then {
[format["<t size='1.2' color='#D01000'>WOW 21!!!!%1</t><br/><t size='0.9'>WIN %2!!!!.</t>",(name player),_Reward],0,0,2,2] spawn BIS_fnc_dynamicText; 
 if (_fn_SC_uniCoins) then {
     [player,_Reward,"add",_depositMoneyin] call fnc_SC_uniCoins;
    } else {
      _coins = _coins + _Reward;
      player setVariable[Z_moneyVariable,_coins,true];
    };
};	
};

 

Hi guys,
code bellow is adjusted to be used with fnc_SC_uniCoins function + some optimization for speed:

private ["_moneyTarget","_Reward","_cost","_rand","_cardtext"];

_moneyTarget = "cache";
_Reward = 1000;
_cost = 100;

// Exit the game if player is low on money
if !([player,_cost,"remove",_moneyTarget] call fnc_SC_uniCoins) exitWith {
  cutText[format["You need %1 coins to play this game!",_cost], "PLAIN DOWN"];
};
titleText [format["you pay %1 coins goodluck",_cost] , "PLAIN DOWN", 1];
_rand = floor(random 100);

// Exit immedieatelly when first condition is true
call {
  if (_rand <= 70) exitWith {
    _cardtext = ["24","22","23","25","19"] call BIS_fnc_selectRandom;
    titleText [format["You took %1 ...looser",_cardtext], "PLAIN DOWN",2];
  };

  if (_rand <= 100 && _rand > 71) exitWith {
    [player,_Reward,"add",_moneyTarget] call fnc_SC_uniCoins;
    [format["<t size='1.2' color='#D01000'>WOW 21!!!!%1</t><br/><t size='0.9'>WIN %2!!!!.</t>",(name player),_Reward],0,0,2,2] spawn BIS_fnc_dynamicText;
  };
};

Cheers gamblers... :)))

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...