Jump to content
MakeWebGames

Sim

Members
  • Posts

    2,392
  • Joined

  • Last visited

  • Days Won

    62

Everything posted by Sim

  1. I was not trying to give a solution but show you something regarding your nested error handling
  2. I usually copy paste and make changes or copy file and make changes. There's been quite a few times I couldn't fix some Little syntax error and just started the file over loo
  3. My item system allows for easy creation of Random Cash, Bullets, ect. All that is needed would be a new item type class. Instead of weapon or armor, have one created that is Treasure. That's my offer. 🙂
  4. The feature there is nice. And maybe bring more GL supporters. I think the JSON structure isn't the best idea, I still screw them up making my module.json files. I believe there has to be an easier way that follows the same concept without all the brackets and commas.
  5. I would also remove your elseifs and only use ifs If(checkforErrorsLine #1) Return $this->alerts[] line If(checkforErrorsLine #2) Return $this->alerts[] line If(checkforErrorsLine #3) Return $this->alerts[] line Ect: Then just do this at end gics combining non-existent row with user doesn't own. What happens after trying this? (Note: Written in English. Hungarian is not a strong point of mine) public function method_exhaust() { // Get vehicle and adjoining garage data $stmt = $this->db->prepare('SELECT * FROM garage INNER JOIN cars ON CA_id = GA_car WHERE GA_id = :car '); $stmt->bindParam(':car', $this->methodData->car); $stmt->execute(); $car = $stmt->fetchObject(); if(empty($car)) { // row not found Return $this->alerts[] = $this->page->buildElement('error', ['text' => 'Car doesn\'t exist']); } if ($car->GA_uid != $this->user->id) { // row doesn't belong to user Return $this->alerts[] = $this->page->buildElement('error', ['text' => 'Car isn\'t yours']); } if ($garage['GA_exhaust'] != $this->garage->info->GA_exhaust) { // selected car part doesn't match garage entry Return $this->alerts[] = $this->page->buildElement('error', ['text' => 'Mismatched parts']); } If ($value > $this->user->info->US_money) { // Not enough money Return $this->alerts[] = $this->page->buildElement('error', ['text', 'Not enough money. $'.number_format($value).' required']); } // Make purchase // Update garage $garage = $this->db->prepare('UPDATE garage SET GA_exhaust = GA_exhaust + 100 WHERE GA_id = :id'); $garage->bindParam(':id', $car->GA_id); $garage->execute(); // Take cost $money = $this->db->prepare('UPDATE userStats SET US_money = US_money - 1000000 WHERE US_id = :id'); $money->bindParam(':id', $this->user->id); $money->execute(); // Hook it $actionHook = new hook('userAction'); $actionHook->run([ 'user' => $this->user->id, 'module' => 'tuning.exhaust', 'id' => $car->CA_id, 'success' => true, 'reward' => $value, ]); This is how I manage my error handling, it removes a lot of the extra bracket and leaves my logic more tabs aligned left and less nested IFs
  6. Including th lang keys inside the json files was actuality better then what I had in mind. Simple and not effective. I dislike the idea of using it at all though. GL is a small engine not used or advertised much. As one of the most active mod developers, it's just to much extra work to use language refrences in a json file and inside the code. I have a hard enough time remember my PHP variables the majority of the time. No I got to remember language keys. :). My IMO.
  7. The best way for translation is still language filrs. $lang['crime'] = "Crimes*; $lang["crimeSuccess"] = "Message to display to user upon successfully commiting crime"; Even larger scripts still use this method. This forum itself does.
  8. Sim

    Infamous Wars

    No control on mobile. I know he not selling the game, but I was using a principle. Why would many people want to register/download a game with no information? He's selling us the game to register and check it out in a sense
  9. Sim

    Suggestions/ideas

    Whatever the is is, I don't yo can copyright it. Even if it has never been used before anywhere. How many games originally had unique features?
  10. Sim

    Infamous Wars

    99% of people would never purchase any game without what it looks like but there's something wrong with my thinking? Edit: you ain't even give any details about the game as well. Edit: Constructivecriticism @AdamHull 🙂 I tried to register anyway period my password isn't matched. It could have been my mistake. So then I click back. Now I have no registration form.
  11. Sim

    Infamous Wars

    Nah, no no screenshots no register
  12. If you was like me and been coding or want to code on your phone. I found this nice android app that turns your phone into local web server. Also has maeiaDB phpMyAdmin https://play.google.com/store/apps/details?id=com.sylkat.apache
  13. Sim

    Suggestions/ideas

    I really like the 2nd one @ags_cs4 . Can I get the code for that? 🙂
  14. Sim

    Alpha Criminals

    It's been a long weekend doing a lot more backend stuff with my item system. I had to adjust almost every function to get it to work with individual characters. If it wasn't my code, I would probably still be working on it. 🙂 With two separate copies of the item system, I most likely to mix something up in the future. 😕
  15. Now that I got your attention, who wants to lend Simmy $11? 🙂
  16. Sim

    Mobile

    Share the links
  17. If you have read my post about my game, you one my game has multiple charters. I am having a hard time coming up wi to or thinking if a nice "character sheet" as you would call it. To display character, with stats and equipment. If anyone got any ideas or linkals to see screenshots, it would be appreciated. I also would think it be nice to be able to equip from character page/sheet.
  18. Sim

    Mobile

    How many of y'all have any mobile games or software released?
  19. Sim

    Alpha Criminals

    Today I done a bunch of back end stuff with the user characters. This was so I could more easily log things and stat tracking. Then I touched almost every mod alley created. Crimes, theft, mugging, travel, police chase,. Now with that dude I can finally do some things I been wanting to. I deleted all characters created, which wasn't many. Hopefully by end of weekend, I can fix interface a bit more so people can play tes do
  20. I've never been able to get nested arrays to work to.
  21. Sim

    Alpha Criminals

    //making things really simple till i make a better formula $modifier = 10; $attackChance = $this->user->char->UC_lvl * 2; $attackChance = $attackChance * $modifier; $defenderChance = $userToAttack->char->UC_lvl * 2; $defenderChance = $defenderChance * $modifier; $attackDice = mt_rand(1,$attackChance); $defenderDice = mt_rand(1, $defenderChance); if($defenderDice > $attackDice) { $this->addMugLog($this->user->info->U_id, $this->user->char->UC_id, $this->user->char->UC_lvl, $userID, $charID, $userToMug->char->UC_lvl, 0, 'fail'); die($this->page->buildElement('error', array("text" => "You failed to mug $victimURL's character " . $userToMug->char->UC_nickname . "!"))); } $lowAmount = $modifier; $highAmount = ($attackChance - $defenderChance) + $modifier $damage = mt_rand($lowAmount, $highAmount); I think this is my formula will be using for mugging & attacking. I have to alter my item mod then include those calculations for individual characters instead of actuall player. Thoughts? Edit: I have not been posting many updates as I been jumping around with my coffee here and there. :).
  22. Onve your game gets that, then come back and say it doesn't take much wise guy
  23. Wow, your game gets 1mill/hits/day?
  24. What do you mean ?
×
×
  • Create New...