02-18-2013, 02:17 AM
PHP Code:
//MONEY POT SCRIPT THEDEMONOFSL
//variables
integer pot;
float bet;
string better;
integer maxbet;
integer minbet;
integer odds; //Higher the odds, better the chance! Only use below 100 or winner guaranteed every time!
//Do Not Change anything below this
refreshtext() {
llSetText("LUCKY BUCKET!\n75% of bet goes to the Pot!\n Pay to Play! \nCurrent Max Bet: " + (string)maxbet +" L$\nMin Bet: " + (string)minbet + " L$ \nPot: " +(string)pot+" L$\nLast Better: " + better + "\n...\n...\n...\n...",<1,0.5,0>,1);
}
default
{
state_entry()
{
better = "No Last Player";
pot = 150;
maxbet = llRound(pot * 0.5); //Insures a 1/2 profit
minbet = 10;
odds = 20;
refreshtext();
llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);
llSetTimerEvent(3);
}
timer(){
if(pot <= 0) {
pot = 150;
maxbet = llRound(pot * 0.5); //Insures a 1/2 profit
minbet = 10;
refreshtext();
}
}
touch_start(integer total_number)
{
llSay(0, "Lucky Buckets! Right-Click -> Pay.. To Bet!");
llSay(0, "Maximum bet: " + (string)maxbet + " L$");
llSay(0, "Minimum bet: " + (string)minbet + " L$");
}
money(key id, integer amount) {
if(amount > maxbet | amount < minbet) {
llGiveMoney(id,amount);
llSay(0,"Invalid Amount. Please try again.");
}
else {
better = llKey2Name(id);
bet = 0.75 * amount;
llSay(0,better + " bets " + (string)amount);
if((integer)llFrand(100) % 100 < (float)odds) {
llSay(0,llKey2Name(id) + ",You're a winner! Please play LUCKY BUCKET again!");
llGiveMoney(id,(integer)amount*2);
pot -= amount * 2;
maxbet = llRound(pot * 0.5);
}
else {
llSay(0,better +", Sorry you did not win this time. Please play again!");
pot += (integer)bet;
maxbet = llRound(pot * 0.5);
}
refreshtext();
}
}}