Jump to content
MakeWebGames

Lottery Mod


War_Hero

Recommended Posts

i wasn't actually referring to you mate, was referring my comments to HD as it seems he believes it's something different...

It is a nice mod by the way :D

Sorry if my message seemed abrupt and harsh, I didn't mean it to. :)

And thank you very much. :D I may have to alter it though. Although it is more realistic and what not, it is very, very, very, very unlikely the jackpot will be won due to the small amount of tickets that will actually be bought. I'll think of something. :)

Link to comment
Share on other sites

  • 8 months later...
  • 1 month later...

Hello so I have added this mod into my website and when the weekly cron runs I get this output.

Warning: Missing argument 3 for event_add(), called in /home/ab1074/public_html/crons/are/not/4u/1_week_cron.php on line 94 and defined in /home/ab1074/public_html/6.php on line 222

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/ab1074/public_html/6.php on line 225

INSERT INTO events VALUES('',1,UNIX_TIMESTAMP(),0,'This Weeks Anarchy 46 Winning Numbers Are: 11,25,27,31,38,42.The Results From Your 2 Lottery Tickets:Ticket Numbers: 6,21,29,38,40,46 -- 1 Matching Number(s) (no winnings)Ticket Numbers: 6,8,13,19,41,46 -- 0 Matching Number(s) (no winnings)You Won A Total Of $0.')

Basically I(The ticket holder) did not recieve an event, it did not add nything to the lotterydone table, nor did it truncate the lotterytickets table, and i dont know what the 2 top errors mean. Can anyone help me. Here is the code in my cron:

<?php

require "7.php";

require "../../../../6.php";

global $c;

$lotteryDetails = mysql_query("SELECT * FROM lotteryDetails");

$ld = mysql_fetch_assoc($lotteryDetails);

$winNumbers = array();

for($i = 0; $i < 6; $i++) {

$num = mt_rand(1,46);

if(empty($winNumbers)) {

array_push($winNumbers, $num);

}

else {

while(in_array($num, $winNumbers)) {

$num = mt_rand(1,46);

}

array_push($winNumbers, $num);

}

}

sort($winNumbers);

$wn = implode(",", $winNumbers);

$getTickets = mysql_query("SELECT * FROM lotterytickets");

$jackpot = (mysql_num_rows($getTickets) * $ld['lotprice']) + $ld['lotjackpot'];

$zero = 0; $one = 0; $two = 0; $three = 0;

$four = 0; $five = 0; $six = 0;

$users = array();

while($gt = mysql_fetch_assoc($getTickets)) {

$yourNumbers = explode(",", $gt['numbers']);

sort($yourNumbers);

$uID = abs(@intval($gt['userid']));

if(empty($users)) {

array_push($users, $uID);

}

else {

if(!in_array($uID, $users)) {

array_push($users, $uID);

}

}

$correct = 0;

foreach($yourNumbers as $yn) {

if(in_array($yn, $winNumbers)) {

$correct++;

}

}

if($correct == 0) { $zero++; }

if($correct == 1) { $one++; }

if($correct == 2) { $two++; }

if($correct == 3) { $three++; }

if($correct == 4) { $four++; }

if($correct == 5) { $five++; }

if($correct == 6) { $six++; }

$updateTicket = ("UPDATE lotterytickets SET correct = ". abs(@intval($correct)) ." WHERE id = ". abs(@intval($gt['id'])) ."");

mysql_query($updateTicket) OR die("Could not update ticket ID ". $gt['id'] .": ". mysql_error());

}

$potWin = array();

$countUsers = count($users);

if(!empty($users)) {

for($ui = 0; $ui < $countUsers; $ui++) {

$selectCorrect = mysql_query("SELECT correct, id, userid, numbers FROM lotterytickets WHERE userid = ". abs(@intval($users[$ui])) ."");

$event = "<b><u>This Weeks Anarchy 46 Winning Numbers Are: ". $wn .".</u> ";

$event .= "The Results From Your ". abs(@intval(mysql_num_rows($selectCorrect))) ." Lottery Tickets: ";

$nowin = array(0,1,2);

$total = 0;

while($sc = mysql_fetch_assoc($selectCorrect)) {

$event .= "Ticket Numbers: ". mysql_real_escape_string($sc['numbers']) ."";

if(in_array($sc['correct'], $nowin)) {

$event .= "<i> -- ". $sc['correct'] ." Matching Number(s) (no winnings)</i> ";

}

else {

if($sc['correct'] == 3) { $winnings = ($ld['lotprice'] + (floor($ld['lotprice'] * 0.5))); }

if($sc['correct'] == 4) { $winnings = ($ld['lotprice'] + (floor($ld['lotprice'] * 0.8))); }

if($sc['correct'] == 5) { $winnings = ($ld['lotprice'] + (floor($ld['lotprice'] * 1.4))); }

if($sc['correct'] == 6) { $winnings = ($ld['lotprice'] + (floor($jackpot/$six))); array_push($potWin, $users[$ui]); }

$event .= "<i> -- ". $sc['correct'] ." Matching Numbers (Won \$". number_format($winnings) .")</i> ";

$total += $winnings;

}

}

$event .= "You Won A Total Of \$". number_format($total) .".";

$subevent = mysql_real_escape_string(trim($event));

event_add($users[$ui], $subevent);

$giveWinnings = ("UPDATE users SET water = water + ". abs(@intval($total)) ." WHERE userid = ". abs(@intval($users[$ui])) ."");

mysql_query($giveWinnings) OR die("Could not give userid ". $ui ." Water: ". mysql_error());

}

if(!empty($potWin)) { $winners = implode(",", $potWin); }

elseif(empty($potWin)) { $winners = "NA"; }

$insertDone = ("INSERT INTO lotterydone (ldID, ldNUMBERS, ldZERO, ldONE, ldTWO, ldTHREE, ldFOUR, ldFIVE, ldSIX, ldPOT, ldPOTWIN, ldTIME) VALUES('','". $wn ."', ". $zero .", ". $one .", ". $two .", ". $three .", ". $four .", ". $five .", ". $six .", ". $jackpot .", '". $winners ."', UNIX_TIMESTAMP())");

mysql_query($insertDone) OR die("Could not insert into lottery done: ". mysql_error());

if($six == 0) {

$jp = $jackpot;

}

elseif($six > 0) {

$jp = 0;

}

$updateJackpot = ("UPDATE lotteryDetails SET lotjackpot = ". abs(@intval($jp)) ."");

mysql_query($updateJackpot) OR die("Could not update jackpot: ". mysql_error());

}

else {

event_add(1, "No Anarchy 46 Lottery Winner This Week.");

}

$truncate = ("TRUNCATE TABLE lotterytickets");

mysql_query($truncate) OR die("Could not truncate: ". mysql_error());

?>

Edited by Teh Sin
Link to comment
Share on other sites

  • 1 month later...

Hello All

Has anyone managed to get the following Mod to work.

I have all working but when with the cron provided i get the following error.

Can someone please advise

Parse error: syntax error, unexpected T_STRING in /home/swisou/public_html/cron_lottery.php on line 81

Link to comment
Share on other sites

  • 3 weeks later...

After removing the magic_quotes i got this to work ok, but i also have a prob with the cron when i run the cron i get this error

Parse error: syntax error, unexpected T_STRING in /home/bootson/public_html/mafia/cron_lottery.php on line 121

any help please

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Edited by boots
Link to comment
Share on other sites

  • 3 years later...

Could anyone get the cron working? I've tried heaps of stuff with it.

Nothing seems to work.

I am using Ravans Script.

And the mod worked but the cron returns a blank page, yes I know this is mean to happen but it.does not truncate the table nor send an even, can someone help me with this please?

Link to comment
Share on other sites

Could anyone get the cron working? I've tried heaps of stuff with it.

Nothing seems to work.

I am using Ravans Script.

And the mod worked but the cron returns a blank page, yes I know this is mean to happen but it.does not truncate the table nor send an even, can someone help me with this please?

Either your missing tables or functions, post your cron code here

Link to comment
Share on other sites

I'm getting this error now, can you help?

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Cron:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

I completely removed line 105 now I'm getting this error

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Edited by -BRAIDZ-
Link to comment
Share on other sites

delete the first 2 lines after <?php and add

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

see if that helps that from the latest version of mccodes i believe this mod was coded for the older version of mccodes

Still nothing, I honestly reckon someone with the time on their hands is going.to have to remake the cron.

I'm no good at that stuff.

But I'm alright at converting from V1 to V2 that's piss easy haha.

But no I have to take some classes in Web design.

I just really want this mod to work without manually having to do the draws..

Link to comment
Share on other sites

Looks like you missed a $db, [MENTION=68406]-BRAIDZ-[/MENTION]

The second error looks like you either don't have a password set, or you don't have access to the truncate command.

I figured out the DB issue but had to remove the event add saying there was no winner, it was saying there was an error it was on line 103 I think

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...