Samurai Legend
Members-
Posts
483 -
Joined
-
Last visited
-
Days Won
5
Content Type
Profiles
Forums
Events
Everything posted by Samurai Legend
-
Thanks for the feedback hehe. I think I am going to create this myself. Or someone to code this for me.
-
Hello all, for my game I am creating something called Dragons. What you can do? Train your dragon. Fight with other dragons. You can also equip your dragon to battle. Do you think this a good idea? Need to expand on it more? Please give me feedback!
-
No. Have you ever wanked 23 times within a day?
-
This is great! I love it :D
-
Yeah I can't wait!* Sorry my phone auto corrects thing that it ain't meant to correct xD
-
Yeah I can't...
-
mccode-v2 Raffle Modification
Samurai Legend replied to Samurai Legend's topic in Free Modifications
[MENTION=70359]Markku[/MENTION] - Thanks so much buddy! I have realised that to. I'll update my post as soon as I am home. -
No. On purpose yes. Have you ever smoked weed?
-
mccode-v2 Raffle Modification
Samurai Legend replied to Samurai Legend's topic in Free Modifications
[MENTION=68736]Raven1992[/MENTION] - Or just add this bit to your cron_day.php - $amount = $db->num_rows($db->query("SELECT * FROM `raffle_tickets`")); $payment_one = $set['payment-one_raffle'] * $amount; $payment_two = $set['payment-two_raffle'] * $amount; $payment_three = $set['payment-three_raffle'] * $amount; $res = $db->query("SELECT `userId` FROM `raffle_tickets` ORDER BY RAND() DESC LIMIT 3"); $i = 0; while($row = $db->fetch_row($res)) { $i++; if($i == 1) { $db->query("UPDATE `users` SET `money` = `money` + $payment_one WHERE `userid` = {$row['userId']}"); $db->query("UPDATE `raffle_winners` SET `user` = {$row['userId']}, `amount` = $payment_one WHERE `position` = '1st.'"); event_add($row['userId'], "Congratulations, you have came first in the raffle and won " . money_formatter($payment_one). "!"); } else if($i == 2) { $db->query("UPDATE `users` SET `money` = `money` + $payment_two WHERE `userid` = {$row['userId']}"); $db->query("UPDATE `raffle_winners` SET `user` = {$row['userId']}, `amount` = $payment_two WHERE `position` = '2nd.'"); event_add($row['userId'], "Congratulations, you have came second in the raffle and won " . money_formatter($payment_two). "!"); } else if($i == 3) { $db->query("UPDATE `users` SET `money` = `money` + $payment_three WHERE `userid` = {$row['userId']}"); $db->query("UPDATE `raffle_winners` SET `user` = {$row['userId']}, `amount` = $payment_three WHERE `position` = '3rd.'"); event_add($row['userId'], "Congratulations, you have came 3rd in the raffle and won " . money_formatter($payment_three). "!"); } } $db->query("TRUNCATE TABLE `raffle_tickets`"); To change the prizes to your likings. Go to your database find the table "settings" Edit - payment-one_raffle payment-two_raffle payment-three_raffle However when someone buys a ticket. It gives a bigger reward. -
mccode-v2 Raffle Modification
Samurai Legend replied to Samurai Legend's topic in Free Modifications
Thank you very much :D -
Screen Shots - [ATTACH=CONFIG]1472[/ATTACH] [ATTACH=CONFIG]1473[/ATTACH] [ATTACH=CONFIG]1474[/ATTACH] SQLs - INSERT INTO `settings` (`conf_id`, `conf_name`, `conf_value`) VALUES (NULL, 'payment-one_raffle', '333'); INSERT INTO `settings` (`conf_id`, `conf_name`, `conf_value`) VALUES (NULL, 'payment-two_raffle', '222'); INSERT INTO `settings` (`conf_id`, `conf_name`, `conf_value`) VALUES (NULL, 'payment-three_raffle', '111'); CREATE TABLE IF NOT EXISTS `raffle_tickets` ( `ticketNo` int(11) NOT NULL AUTO_INCREMENT, `userId` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`ticketNo`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `raffle_winners` ( `user` int(11) NOT NULL, `position` varchar(255) NOT NULL DEFAULT '', `amount` int(11) NOT NULL, PRIMARY KEY (`position`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO `raffle_winners` (`user`, `position`, `amount`) VALUES (1, '1st.', 0), (1, '2nd.', 0), (1, '3rd.', 0); Call this file raffle.php - <?php require('globals.php'); if (!isset($_GET['action'])) { $_GET['action'] = ''; } switch ($_GET['action']) { case "buyticket": buy_ticket(); break; case "view": last_winners(); break; default: index(); break; } function index() { echo "<h3><u>Raffle</u></h3>"; global $db, $set, $userid, $ir; $amount = $db->num_rows($db->query("SELECT * FROM raffle_tickets")); $payment_one = money_formatter($set['payment-one_raffle'] * $amount); $payment_two = money_formatter($set['payment-two_raffle'] * $amount); $payment_three = money_formatter($set['payment-three_raffle'] * $amount); $usersticket = $db->num_rows($db->query("SELECT * FROM raffle_tickets WHERE userid=$userid")); echo "<hr width='75%'>One ticket costs $1,000.<br />You can buy up to 50 tickets..<br /> $amount raffle tickets have been bought so far. $usersticket have been bought from you.<br /><br /> Current Payouts -<br /> 1st. $payment_one <br /> 2nd. $payment_two <br /> 3rd. $payment_three <br /><hr width ='75%'> Tables reset daily and prizes are given out. Prize money will go up with each ticket.<br/> Three lucky winners will be taking away the prizes! <hr width ='75%'> > <a href = 'raffle.php?action=buyticket'>Buy a ticket for $1,000</a><br /> > <a href = 'raffle.php?action=view'>View latest winners</a><br/> <hr width ='75%'>"; } function buy_ticket() { global $db, $set, $userid, $ir, $h; echo "<h3><u>Tickets</u></h3>"; $usersticket = $db->num_rows($db->query("SELECT * FROM raffle_tickets WHERE userid=$userid")); if ($usersticket > 49) { echo'You can only buy up to 50 raffle tickets.'; $h->endpage(); die(); } if ($ir['money'] >= 1000) { echo'You bought one ticket for $1,000.'; $db->query("UPDATE `users` SET `money` = `money` - 1000 WHERE `userid` = $userid"); $db->query("INSERT INTO `raffle_tickets` VALUES ('','$userid')"); } else { echo'You need $1,000'; $h->endpage(); die(); } } function last_winners() { global $db, $set, $userid, $ir, $h; echo "<h3><u>Latest Winners</u></h3><hr width ='50%'>"; $query = $db->query("SELECT u.username, u.userid, r.position, r.amount FROM `users` u INNER JOIN `raffle_winners` r ON u.userid = r.user"); echo "<table width='75%' cellspacing='1' cellpadding='1' class='table'> <tr> <th>Position</th> <th>User</th> <th>Amount Won</th> </tr> "; while ($r = $db->fetch_row($query)) { $amount = money_formatter($r['amount']); echo "<tr><td>{$r['position']}</td> <td><a href='viewuser.php?u={$r['userid']}'>{$r['username']}</a></td> <td>$amount</td>"; } echo "</tr></table><hr width ='75%'>"; } $h->endpage(); ?> Make a daily cron - <?php require_once('../globals_nonauth.php'); if (!isset($argc)) { $argc = 0; } if ($argc == 2) { if ($argv[1] != $_CONFIG['code']) { exit; } } else if (!isset($_GET['code']) || $_GET['code'] !== $_CONFIG['code']) { exit; } $amount = $db->num_rows($db->query("SELECT * FROM `raffle_tickets`")); $payment_one = $set['payment-one_raffle'] * $amount; $payment_two = $set['payment-two_raffle'] * $amount; $payment_three = $set['payment-three_raffle'] * $amount; $res = $db->query("SELECT `userId` FROM `raffle_tickets` ORDER BY RAND() DESC LIMIT 3"); $i = 0; while($row = $db->fetch_row($res)) { $i++; if($i == 1) { $db->query("UPDATE `users` SET `money` = `money` + $payment_one WHERE `userid` = {$row['userId']}"); $db->query("UPDATE `raffle_winners` SET `user` = {$row['userId']}, `amount` = $payment_one WHERE `position` = '1st.'"); event_add($row['userId'], "Congratulations, you have came first in the raffle and won " . money_formatter($payment_one). "!"); } else if($i == 2) { $db->query("UPDATE `users` SET `money` = `money` + $payment_two WHERE `userid` = {$row['userId']}"); $db->query("UPDATE `raffle_winners` SET `user` = {$row['userId']}, `amount` = $payment_two WHERE `position` = '2nd.'"); event_add($row['userId'], "Congratulations, you have came second in the raffle and won " . money_formatter($payment_two). "!"); } else if($i == 3) { $db->query("UPDATE `users` SET `money` = `money` + $payment_three WHERE `userid` = {$row['userId']}"); $db->query("UPDATE `raffle_winners` SET `user` = {$row['userId']}, `amount` = $payment_three WHERE `position` = '3rd.'"); event_add($row['userId'], "Congratulations, you have came 3rd in the raffle and won " . money_formatter($payment_three). "!"); } } $db->query("TRUNCATE TABLE `raffle_tickets`"); [ATTACH=CONFIG]1475[/ATTACH] There you go and your done. Raffle.zip
-
[MENTION=69116]dnenb[/MENTION] - Thanks man! :) [MENTION=70260]Reecey12345[/MENTION] - Thanks too! :)
-
So far I have this... <?php require('globals.php'); if (!isset($_GET['action'])) { $_GET['action'] = ''; } switch ($_GET['action']) { case "buyticket": buy_ticket(); break; case "view": last_winners(); break; default: index(); break; } function index() { echo "<h3><u>Raffle</u></h3>"; global $db, $set, $userid, $ir, $goback; $amount = $db->num_rows($db->query("SELECT * FROM raffle_tickets")); $payment_one = money_formatter($set['payment-one_raffle'] * $amount); $payment_two = money_formatter($set['payment-two_raffle'] * $amount); $payment_three = money_formatter($set['payment-three_raffle'] * $amount); $usersticket = $db->num_rows($db->query("SELECT * FROM raffle_tickets WHERE userid=$userid")); echo "<hr width='75%'>One ticket costs ¥1,000.<br />You can buy up to 50 tickets..<br /> $amount raffle tickets have been bought so far. $usersticket have been bought from you.<br /><br /> Current Payouts -<br /> 1st. $payment_one <br /> 2nd. $payment_two <br /> 3rd. $payment_three <br /><hr width ='75%'> Tables reset daily and prizes are given out. Prize money will go up with each ticket.<br/> Three lucky winners will be taking away the prizes! <hr width ='75%'> > <a href = 'raffle.php?action=buyticket'>Buy a ticket for ¥1,000</a><br /> > <a href = 'raffle.php?action=view'>View latest winners</a><br/> $goback <hr width ='75%'>"; } function buy_ticket() { global $db, $set, $userid, $ir, $goback, $h; echo "<h3><u>Tickets</u></h3>"; $usersticket = $db->num_rows($db->query("SELECT * FROM raffle_tickets WHERE userid=$userid")); if ($usersticket > 49) { error("You can only buy up to 50 raffle tickets."); $h->endpage(); die(); } if ($ir['money'] >= 1000) { confirmation('You bought one ticket for ¥1,000.'); $db->query("UPDATE `users` SET `money` = `money` - 1000 WHERE `userid` = $userid"); $db->query("INSERT INTO `raffle_tickets` VALUES ('','$userid')"); } else { error('You need ¥1,000'); $h->endpage(); die(); } } function last_winners() { global $db, $set, $userid, $ir, $goback, $h; echo "<h3><u>Latest Winners</u></h3><hr width ='50%'>"; $query = $db->query("SELECT u.username, u.userid, r.position, r.amount FROM `users` u INNER JOIN `raffle_winners` r ON u.userid = r.user"); echo "<table width='75%' cellspacing='1' cellpadding='1' class='table'> <tr> <th>Position</th> <th>User</th> <th>Amount Won</th> </tr> "; while ($r = $db->fetch_row($query)) { $amount = money_formatter($r['amount']); echo "<tr><td>{$r['position']}</td> <td><a href='viewuser.php?u={$r['userid']}'>{$r['username']}</a></td> <td>$amount</td>"; } echo "</tr></table><hr width ='75%'>$goback<hr width ='75%'>"; } $h->endpage(); ?> Now I am moving onto the cron xD
-
[MENTION=64684]Dayo[/MENTION] & Jason-x - I was thinking about that before. When someone buys a ticket it gets inserted in another table. More tickets you buy. The more chance you have of winning. Thank Dayo and Jason-x for the feedback and advice. [MENTION=68711]KyleMassacre[/MENTION] - Thanks Kyle! Life saver you are hehe!
-
Something like this right? <?php require_once('../globals_nonauth.php'); /* if (!isset($argc)) { $argc = 0; } if ($argc == 2) { if ($argv[1] != $_CONFIG['code']) { exit; } } else if (!isset($_GET['code']) || $_GET['code'] !== $_CONFIG['code']) { exit; }*/ $query = $db->query("SELECT SUM(`raffle_tickets`) AS total_raffle_tickets FROM `users`"); $amount = $db->fetch_row(); $payment_one = money_formatter($set['payment-one_raffle'] * $amount['total_raffle_tickets']); $payment_two = money_formatter($set['payment-two_raffle'] * $amount['total_raffle_tickets']); $payment_three = money_formatter($set['payment-three_raffle'] * $amount['total_raffle_tickets']); $query = $db->query(SELECT `raffle_tickets`, `username`, `userid` FROM `users` WHERE raffle_tickets > 0 ORDER BY RAND() DESC LIMIT 3); $i = 0; while($row = $db->fetch_row($query)) { $i++; if($i == 1) { $db->query("UPDATE `users` SET `money` = `money` + $payment_one WHERE `userid` = {$row['userid']}"); $db->query("UPDATE `raffle_winners` SET `user` = {$row['userid']} `amount` = $payment_one WHERE `position` = '1st.'"); } else if($i == 2) { $db->query("UPDATE `users` SET `money` = `money` + $payment_two WHERE `userid` = {$row['userid']}"); $db->query("UPDATE `raffle_winners` SET `user` = {$row['userid']} `amount` = $payment_two WHERE `position` = '2nd.'"); } else if($i == 3) { $db->query("UPDATE `users` SET `money` = `money` + $payment_three WHERE `userid` = {$row['userid']}"); $db->query("UPDATE `raffle_winners` SET `user` = {$row['userid']} `amount` = $payment_three WHERE `position` = '3rd.'"); } ?>
-
Haha, I was just going to do something like that. I took wrux advice! Thanks all.
-
But in my case...Anyone can buy up to 50 tickets... I got one but I am not sure of it... I will use the rand function 1 - 50. Which ever it selects users with that amount of tickets. Will then be randomly chosen. So for example. The rand chose 23. And theres about 3 people with 23 tickets. It will then randomly choose the person.
-
How should I make the system choose the winner? Person with the most tickets? Random...? I don't want to do them two above as it won't be fair... But I need an idea...
-
$rowSQL = $db->query( "SELECT MAX( level ) AS top FROM `users`;" ); $row = mysql_fetch_array( $rowSQL ); $largestNumber = $row['top']; if($row['top']) { $crown="<img src='crown_gold.png' alt='1st Position' title='1st Position' />"; } Something like that will bring the first best player... Or $q = $db->query("SELECT username,level FROM users ORDER BY level DESC LIMIT 2,1"); $r = $db->fetch_row($q); if($r['level']) { $crown="<img src='crown_silver.png' alt='2nd Position' title='2nd Position' />"; } Something like that will bring the second best player... I am not sure though.
-
I am creating a modification. This modification will be free. Screen Shot - [ATTACH=CONFIG]1470[/ATTACH] [ATTACH=CONFIG]1471[/ATTACH] I am now creating the cron file to choose the winners and credit them the money and update the latest winners. I will need advice on how to choose the winners using a cron...
-
Thanks man! That worked great!
-
Hello all, I just need help. I am trying to find out how I can add up all the tickets each users have from the users total in one query? So I can times it by how much the raffle prize is...? If you know what I meant. $query = $db->query("SELECT COUNT(`raffle_tickets`) , SUM(`raffle_tickets`) FROM `users`"); $amount = ($db->num_rows($query)); $payment_one = money_formatter($set['payment-one_raffle']*$amount);
-
Thanks man! It works! Your an legend!
-
I realised that I did $ir not $r on $new_psw = $db->escape(encode_password($newpw, $r['pass_salt'])); The post is fixed anyway...
-
Just the top 5 players and their level... But I realised I don't want the level but their clan and laston to show... Which I don't know how to do...