
corruptcity || skalman
Members-
Posts
358 -
Joined
-
Last visited
-
Days Won
3
Content Type
Profiles
Forums
Events
Everything posted by corruptcity || skalman
-
-
Hey, releasing a copy of my gym script that I will be using on my site myself for all to use. It has 12 gym passes that players can unlock, to unlock each you need to use the gym a certain amount of time and any stat gain for each one. each level gives a bigger increase than the previous level, also the cost goes up aswell. I've it set that you do reps where each rep cost 5 energy so for the standard 100 energy you get 20 reps. Feel free to use the the gym pass names I've got as a few of them I borrowed from the strength level names from Fallout New Vegas. Gym_passes stores the 12 gym passes I have, user_gympasses stores the player's gym, uses and stat gained PeterGB feel free to add this mod to your mod website if you want 🙂 <style type="text/css"> .gym-contaner { max-width: 20vw; color: #ADD8E6; } .gym-grid{ display: grid; grid-template-columns: repeat(4, 1fr); grid-gap: 15px; color: #ADD8E6; text-align: center; } .gym-heading { grid-column: span 1; /* Each item spans one column */ padding: 10px 10px 10px 10px; border: 5px solid black; border-radius: 5px; background-color: #1F2324; margin-left: 5px; } .gym-pass-container{ max-width: 30vw; color: #ADD8E6; } .gym-pass-grid{ display: grid; grid-template-columns: repeat(4, 1fr); grid-gap: 15px; color: #ADD8E6; text-align: center; } .gym-pass-heading { grid-column: span 1; /* Each item spans one column */ padding: 10px 10px 10px 10px; border: 5px solid black; border-radius: 5px; background-color: #1F2324; margin-left: 5px; } .gym-pass-item { grid-column: span 1; /* Each item spans one column */ padding: 10px 10px 10px 10px; border: 5px solid red; border-radius: 5px; background-color: #1F2324; margin-left: 5px; } .gym-pass-upgrade { grid-column: span 1; /* Each item spans one column */ padding: 10px 10px 10px 10px; border: 5px solid blue; border-radius: 5px; background-color: #1F2324; margin-left: 5px; } </style> <?php /* Created by Skalman v1.0 Feel free to use this code as you wish and use as much or as little as you want Just please leave this comment in the code if you do use it CUSTOM FUNCTIONS to display error text and exit the page only commented out as causes redlared function error on my end as they are in global_funcs.php for me Will add CSRF protection later today once I'm home from work */ /* if(!function_exists('ErrorText')) { function ErrorText($content) { global $h; echo $content; exit($h->endpage()); } } if (!function_exists('GoBack_Link')) { function GoBack_Link($link, $text) { return "[<a href='{$link}'>{$text}</a>]"; } } */ $macropage = "gym.php"; require_once('globals.php'); page_closed('gym'); if($ir['hospital']) { ErrorText("This page cannot be accessed while in hospital."); } if($ir['jail'] <= 0) { echo"<h3>Gym</h3> <hr />"; } else { echo"<h3>Jail Gym</h3> <hr />"; } $_GET['buypass'] = (isset($_GET['buypass']) && is_numeric($_GET['buypass'])) ? abs(intval($_GET['buypass'])) : 0; if($_GET['buypass']) { $r = $db->fetch_row($db->query("SELECT gp_id, gp_name, gp_cost, gp_uses, gp_gain FROM gym_passes WHERE gp_id = {$_GET['buypass']}")); $your_pass = $db->fetch_row($db->query("SELECT ug_level, ug_uses, ug_gain FROM user_gympass WHERE ug_userid = {$ir['userid']}")); if($r['gp_cost'] > $ir['money']) { ErrorText("You don't have enough money for {$r['gp_name']}!"); } if($your_pass['ug_uses'] <= $r['gp_uses'] && $your_pass['ug_gain'] <= $r['gp_gain']) { ErrorText("You haven't met the requirements for {$r['gp_name']} yet"); } $db->query("UPDATE user_gympass SET ug_level = {$r['gp_id']}, ug_uses = 0, ug_gain = 0 WHERE ug_userid = {$ir['userid']}"); $db->query("UPDATE users SET money = money - {$r['gp_cost']} WHERE userid = {$ir['userid']}"); echo"You bought the {$r['gp_name']} pass!"; $link = "gym.php"; $text = 'Go Back'; echo GoBack_Link($link, $text); } else { $pass_check = $db->query("SELECT ug_id, ug_level FROM user_gympass WHERE ug_userid = {$ir['userid']}"); if($db->num_rows($pass_check) == 0) { $db->query("INSERT INTO user_gympass (ug_id, ug_userid, ug_level, ug_uses, ug_gain) VALUES ('', {$ir['userid']}, 1, 0, 0)"); } $pc = $db->fetch_row($pass_check); $reps = ($ir['energy'] / 5); echo"Welcome to the gym which stat would you like to work on today?<br /> each rep uses 5 energy and you have ".number_format($reps)." reps left.<br /><br />"; $statnames = array( 'Strength' => 'strength', 'Agility' => 'agility', 'Guard' => 'guard', 'Speed' => 'speed'); if(!isset($_POST['amnt'])) { $_POST['amnt'] = 0; } $amount = abs((int) $_POST['amnt']); if(isset($_POST['stat']) && $amount) { if(!isset($_POST['stat'])) { ErrorText("This stat cannot be trained."); } $stat = $_POST['stat']; if($ir['energy'] / 5 < $amount) { ErrorText("You are trying to train more than your allowed to!"); $link = "gym.php"; $text = 'Go Back'; echo GoBack_Link($link, $text); } else { $your_pass = $db->fetch_row($db->query("SELECT gp_increase FROM gym_passes WHERE gp_id = {$pc['ug_level']}")); $gain = 0; for($i = 0; $i < $amount; $i++) { $gain += rand(1, 3) / rand(800, 1000) * rand(800, 1000) * (($ir['happiness'] + 20) / 150); $ir['happiness'] -= rand(1, 3); if($ir['happiness'] < 0) { $ir['happiness'] = 0; } } if($ir['jail'] > 0) { $gain /= 2; } $bonus = $gain * $your_pass['gp_increase'] / 100; $new_gain = $gain + $bonus; $db->query("UPDATE `userstats` SET `{$stat}` = `{$stat}` + $new_gain WHERE `userid` = $userid"); $db->query("UPDATE user_gympass SET ug_uses = ug_uses + 1, ug_gain = ug_gain + {$new_gain} WHERE ug_userid = {$ir['userid']}"); //$db->query("UPDATE `users` SET `happiness` = {$ir['happiness']}, `energy` = `energy` - {$_POST['amnt']} WHERE `userid` = $userid"); $inc = $ir[$stat] + $gain; $inc2 = ($ir['energy'] / 5) - $_POST['amnt']; echo"<div class='result'>"; if($stat == "strength") { echo "You begin lifting some weights, You have gained <span style='font-size: 1.2em; color: red;'>{$gain}</span>.<br /> After your gym pass bonus has been added you gained <span style='font-size: 1.2em; color: red;'>{$new_gain}</span> strength.<br /> You now have <span style='font-size: 1.2em; color: red;'>{$inc}</span> strength and <span style='font-size: 1.2em; color: red;'>{$inc2}</span> energy left."; } elseif($stat == "agility") { echo "You begin running on a treadmill, You have gained <span style='font-size: 1.2em; color: red;'>{$gain}</span>.<br /> After your gym pass bonus has been added you gained <span style='font-size: 1.2em; color: red;'>{$new_gain}</span> agility.<br /> You now have <span style='font-size: 1.2em; color: red;'>{$inc}</span> agility and <span style='font-size: 1.2em; color: red;'>{$inc2}</span> energy left."; } elseif($stat == "guard") { echo "You jump into the pool and begin swimming, You have gained <span style='font-size: 1.2em; color: red;'>{$gain}</span>.<br /> After your gym pass bonus has been added you gained <span style='font-size: 1.2em; color: red;'>{$new_gain}</span> guard.<br /> You now have <span style='font-size: 1.2em; color: red;'>{$inc}</span> guard and <span style='font-size: 1.2em; color: red;'>{$inc2}</span> energy left."; } elseif($stat == "speed") { echo "You walk over to some boxes filled with gym equipment and start moving them, You have gained <span style='font-size: 1.2em; color: red;'>{$gain}</span>.<br /> After your gym pass bonus has been added you gained <span style='font-size: 1.2em; color: red;'>{$new_gain}</span> speed.<br /> You now have <span style='font-size: 1.2em; color: red;'>{$inc}</span> speed and <span style='font-size: 1.2em; color: red;'>{$inc2}</span> energy left."; } echo"</div> <hr />"; $ir['energy'] -= $_POST['amnt']; $ir[$stat] += $gain; } } echo" <div class='gym-ccontainer'> <div class='gym-grid'> <div class='gym-heading'> <form action='gym.php' method='post'> Strength: <span style='font-size: 1.2em; color: green;'>{$ir['strength']}</span><br /> Increases the amount of damage you do.<br /> <input type='text' name='amnt' value='{$reps}' size='10' /><br /> <input type='hidden' name='stat' value='strength' /> <input type='submit' name='Train' value='Train' /> </form> </div> <div class='gym-heading'> <form action='gym.php' method='post'> Agility: <span style='font-size: 1.2em; color: green;'>{$ir['agility']}</span><br /> improves your chance to dodge.<br /><br/> <input type='text' name='amnt' value='{$reps}' size='10' /><br /> <input type='hidden' name='stat' value='agility' /> <input type='submit' name='Train' value='Train' /> </form> </div> <div class='gym-heading'> <form action='gym.php' method='post'> Guard: <span style='font-size: 1.2em; color: green;'>{$ir['guard']}</span><br /> Reduces damage taken.<br /><br /> <input type='text' name='amnt' value='{$reps}' size='10' /><br /> <input type='hidden' name='stat' value='guard' /> <input type='submit' name='Train' value='Train' /> </form> </div> <div class='gym-heading'> <form action='gym.php' method='post'> Speed: <span style='font-size: 1.2em; color: green;'>{$ir['speed']}</span><br /> Increases your change to hit.<br /><br/> <input type='text' name='amnt' value='{$reps}' size='10'/><br /> <input type='hidden' name='stat' value='speed' /> <input type='submit' name='Train' value='Train' /> </form> </div> </div> </div>"; $gym_passes = $db->query("SELECT gp_id, gp_name, gp_cost, gp_uses, gp_gain, gp_increase FROM gym_passes"); $your_pass = $db->fetch_row($db->query("SELECT ug_level, ug_uses, ug_gain FROM user_gympass WHERE ug_userid = {$ir['userid']}")); echo" <br/> <div class='gym-pass-container'> <div class='gym-pass-grid'>"; while($gp = $db->fetch_row($gym_passes)) { $next_level = $your_pass['ug_level'] + 1; if($gp['gp_id'] < $your_pass['ug_level']) { echo" <div class='gym-pass-heading'> <span style='font-size: 1.2em;'>".stripText($gp['gp_name'])."</span><br /> ".money_formatter($gp['gp_cost'])."<br /> {$gp['gp_increase']}% increase </div>"; } elseif($gp['gp_id'] == $your_pass['ug_level']) { echo" <div class='gym-pass-item'> <span style='font-size: 1.2em;'>".stripText($gp['gp_name'])."</span><br /> ".money_formatter($gp['gp_cost'])."<br /> {$gp['gp_increase']}% increase </div>"; } else { if($gp['gp_id'] == $next_level && $your_pass['ug_uses'] >= $gp['gp_uses'] && $your_pass['ug_gain'] >= $gp['gp_gain']) { echo" <div class='gym-pass-upgrade'> <span style='font-size: 1.2em;'>".stripText($gp['gp_name'])."</span><br /> [<a href='gym.php?buypass={$gp['gp_id']}'>Upgrade</a>] </div>"; } else { echo" <div class='gym-pass-heading'> <span style='font-size: 1.2em;'>".stripText($gp['gp_name'])."</span><br /> $: ????<br /> Increase: ???? </div>"; } } } echo"</div> </div>"; } $h->endpage(); ?> gym_passes.sql user_gympass.sql
-
forgot to say you need to set After `itmpic` to what ever the last field name is in your table
-
Hi, use this but change `images` to itempic, itmpic etc ALTER TABLE `items` ADD `image` TEXT NOT NULL AFTER `itmpic`; that will add the field to the table so that you can then to hold the image link
-
thought as much and also removed most of the tables from the db to I'd imagine got some php errors when creating an account
-
on another note, how much effort was there to convert mccodes into a non crime type of game, you've given me an idea that I might give ago. Have you seen or played the game startup Company, something like that but it's online for your site one suggestion I would make is on your home page and you click sign up the 2 backgrounds clashed and made it difficult for me to focus on it and read it and had to move it to the right
-
oh wow not to bad then, do your passangers all clap when they land like Ryan air's do? lol. have you added stuff like planes going missing like MH370 or other random stuff like the plane lands in North korea instead of South Korea?
-
Good luck with that Peter, sounds like a very different idea and concept of a game using mccodes. do the flights take real time like London to Miami or New York taking 5 hours?
-
yeah my book is slightly newer that Peter's came out in like 2006/7
-
hey, the book I used to use will be of no good to you now lol it was php 5. Have you tried using chatGPT? You can that to recommed some books
-
post that line on here aswell. it's either going to be that you have either a $_POST or $_GET and hasn't been defined and globals or global_nonauth is being called twice which is causing the 2nd problem
-
mccode-v2 PeterisGBs Mod Site
corruptcity || skalman replied to peterisgb's topic in Free Modifications
yeah that one couldn't figure out how to get it to show when I did it as It showed it as a link lol. -
mccode-v2 PeterisGBs Mod Site
corruptcity || skalman replied to peterisgb's topic in Free Modifications
happy days then and in that case I will insert the Fry meme here shut up and take my money 🙂😂 -
it's either attacktake or attackwon, which ever one has the money query in just remembered that while I was just in the bath I didnt add any error check so that the script only run if the user had crystals to start with. so you will need to add that
-
mccode-v2 PeterisGBs Mod Site
corruptcity || skalman replied to peterisgb's topic in Free Modifications
hey @peterisgb how hard or easy it is to setup and use your avataar mod? been eying up buying it but got other more important features and issues I want to do first before I start to do impovements like that. -
This is a basic version of what your after, you can Improve it yourself and can combine the 2 queries into one. Also added an event_add for it to $crystals = $ir['crystals']; if($crystals > 5) { $crystals = 5; } $crystalsStole = (int) rand(1, $crystals); $db->query("UPDATE `users` SET `crystals` = `crystals` - {$crystalsStole} WHERE `userid` = {$r['userid']}"); event_add($r['userid'], "<a href='viewuser.php?u=$userid'>{$ir['username']}</a> attacked you and stole {crystalStole} crystals from you!", $c);
-
mccode-v2 PeterisGBs Mod Site
corruptcity || skalman replied to peterisgb's topic in Free Modifications
Yeah thanks for the website looked at it before and It gave me a few ideas for my game esp the Analystics and the help tutorial. I have also made use of your CSS stat bars mod to great effect not just on the header page -
I'm using php 8.2 on my xampp and mccodes works no problems. Things I've needed to change was removing the magic quotes from globals.php switched to my_sqli, not planning on switching to prepared queries just yet. the most common problem i've found is having to change if($_POST['some var']) to if(isset($_POST['some var']) in most pages that I've looked at sofar. haven't come across any game or script breaking code or errors.
-
it does, you just haven't asked it the right questions for doing that haha
-
welcome to the dark side 🙂 been using it myself as well as github co pilot. Has helped me loads when having to fix or bug test my amazing code haha. Feel that co-pilot has helped speed up writing code. I don't think it'll be to long before all developers/coder or whatever will be using AI.
-
first thing I would do is go through globals and sglobals and sort the user queries out as they were fairly lazy and just used u.* from users
- 1 reply
-
- 1
-
-
I'm not being mean here but you haven't really done much to it other than change the banner, would also be a good idea to at least create the crimes, items, houses, jobs etc as well. You will want to create your own template or hire someone to create you one, so you can move away from the stock mccodes one. The final point is do something to your login page, it's the first page any potential new player is gonna see and if it looks like the crap vanilla login page people aren't going to stick around and more than likely aren't going to create an account or play.
- 1 reply
-
- 1
-
-
then 2nd install git lol
-
yeah all random, didn't want to make it selectable as your only gonna pick the head and thorax to attack aren't you
-
Yeah hoping to but that would be done in hospital if you lose or via the inventory if you win the fight. Here is a sneak peak of the UI I've got sofar Don't mind the css in the weapons box not polished it yet lol.