Jump to content
MakeWebGames

Dayo

Administrators
  • Posts

    2,491
  • Joined

  • Last visited

  • Days Won

    196

Everything posted by Dayo

  1. https://github.com/ChristopherDay/Gangster-Legends-V2 is the URL of the GIT Repository, just tested out committing and seamed rather painless so will try it out, once i have made a few changes ill commit what i have so far :)
  2. I use __construct in the module class what in turn calls constructModule() i done it like this so i can set the $this->(page|db|user) variables before the module is set up. BTW i will check out GIT if its easy to pick up ill use that for my version controll
  3. Ill log into my skype now :) What i was thinking is when you make a module you have to register the globals you will use for that module kind of like this class garage extends module { public $allowedMethods = array('car'=>array('GET', 'int'), 'randomVar'=>array('POST', 'varchar')); public function constructModule() { // Build the module here } public function method_sell() { // Sell your car } public function method_repair() { // Repair your car $car = $this->methodData->car; // ($_GET['car']) } } From the allowed methods you can then build the methodData array from what i have added you can also add validation at this stage i.e. only allowing numbers if the type is set as a int
  4. This sounds interesting, we use something similar at work, will neaten up having if (isset($_POST['...'])) {} at the top of each module how a module would then work is like so class garage extends module { public function constructModule() { // Build the module here } public function method_sell() { // Sell your car } public function method_repair() { // Repair your car $car = $this->methodData->car; // ($_GET['car']) } }
  5. Ive always used SVN at work but i see more and more people using GIT after i have got V2 to a decent point ill look into GIT, dont want to swamp myself with several things at once.
  6. I have a source-forge project that i will be committing to soon, just want to neaten up the code a bit and add a few functions that will be useful when developing. Ive never used git before as ive got use to SVN maybe ill take a look at it if people prefer it. Note: The modules don't require global $page, $db, $user; you can now use $this->page->... $this->db->... and $this->user->... just going throgh the modules now and removing all the old globals (glad im making these changes early on rather then when there is 20 modules lol)
  7. Yea sorry i have my wires mixed, having 3 different convos at once :P You are correct that this will be used several times across several modules, this will be coded into the core "module" class rather then each individual module (like it was) I have made the changes now im just adding to the module class so you will be able to get repeated information with ease (i.e. location names, car names/info etc ...)
  8. It is more module specific as its mainly used for timers (i.e. i have 00:01:12 left before i can commit another crime) probably should use a better name then getDate maybe timeLeft
  9. That makes sense, while there are only a few modules i think i may have to do that, there were a few global functions i had to re-declare in each module (i.e. timeLeft()) this would be much easier if i done what you said in the first place. Ill get on that now, should nottake too long :)
  10. Over the Christmas period i was ill so could not do as much as work on GL v2 as i planned, but i have done enough to warrant an small update for everyone. The core framework is at a point where i am happy with it so i can start on adding features/modules to the script, currently i have added the following features: - crimes - car thefts - Police Chases - Garage - Bullet Factory's - Travel - Jail A small example of a module is below <?php class module { private $html = ''; public $pageName = 'Police Chase'; public function __construct () { global $page, $user, $db; if (isset($_GET['move'])) { $this->move(); } $this->html .= $page->buildElement('policeChase', array()); } public function htmlOutput() { return $this->html; } public function timeLeft($ts) { return date('H:i:s', $ts); } private function move() { global $db, $page, $user; if (time() < $user->info->US_chaseTimer) { $time = $user->info->US_chaseTimer - time(); $crimeError = array('You cant commit another theft untill your timer is up! ('.$this->timeLeft($time).')'); $this->html .= $page->buildElement('error', $crimeError); } else { $rand = mt_rand(1, 4); if ($rand == 1) { $winnings = mt_rand(150, 850) * $user->info->US_rank; $u = $db->prepare("UPDATE userStats SET US_chaseTimer = ".(time()+300).", US_money = US_money + $winnings WHERE US_id = ".$user->id); $u->execute(); $this->html .= $page->buildElement('success', array('You got away, you were paid $'.number_format($winnings).'!')); } else if ($rand == 3) { $u = $db->prepare("UPDATE userStats SET US_chaseTimer = ".(time()+300).", US_jailTimer = ".(time() + 150)." WHERE US_id = ".$user->id); $u->execute(); $this->html .= $page->buildElement('error', array('You crashed and was sent to jail!')); } else { $this->html .= $page->buildElement('info', array('You are still going, what dirrection do you want to go now?')); } } } } ?> Please note this module is a bit old and is missing some things that i am currently working on now, things like if (time() < $user->info->US_chaseTimer) { ... are changed to if(!$user->timerCheck('chase')) { ... I will be adding a live demo as soon as i get home as my work has blocked the port i use to connect to my control panel Here are some screen shots http://imgur.com/a/eBkZt the styling is minimal at best, im no designer lol
  11. Also there is no indentation, this can help you out alot when you are debugging
  12. At the end you glossed over the delete saying you can just add this to that but someone who is watching will most likely not know how to, you are not returned the id from ajaxPost.php to use when making the new line. Would it not be best to reload the div with $('#messages').load('ajaxGet.php'); same with after deleting.
  13. Its pretty much what style of coding you prefer, most of the times i will use only 1 for a blob of text but if it is a large peice of html with multiple divs i will use Multiple echos. Im sure there wont be m,uch speed issues with doing it like this ... well especially for a McCodes game
  14. looks good, but i would remove the HTML from before the globals include, may show PHP errors if PHP is set ti display errors, also may mess up the html of there theme
  15. i did make a script somewhere on MWG that would generate a isometric map, for tiles you can look on graphic river there are some good tile sets there
  16. Looks very very good
  17. Dayo

    Chat RPG

    If you remind me on Saturday or Sunday ill have to make a few edits to get it in an acceptable manner for release as in places it is a bit messy
  18. http://productforums.google.com/forum/#!category-topic/gmail/managing-settings-and-mail/tSqTkYiNLCA The account could of been deleted and the potential "scammer" re-register it
  19. :s i should really stop posting from my phone, thanks for the spot.
  20. I now use PDO as a standard at work and for personal projects for the reasons stated before, You are not just limited to a mysql database. But there are a few drawbacks of PDO one of which i encounter every day at work and that is the drivers for PDO on a Microsoft server + MsSQL are not the best in the world. i.e. you cant do this ... $db->prepare("UPDATE users SET cash=:cash WHERE cash<:cash");
  21. And by the looks of it you are one of them *sigh* Right get back on topic if you have problems use the PM system Shame to see you leave maybe it would be worth you still doing a bit of coding here and there, sometimes its just good to have a break/rest from something if you have been doing it a while. Good luck with your new job
  22. sorry i thought what you had at http://ww3.thecoldwars.net/pic/ was what you were distributing (i would still remove these from your site ;))
  23. there is one thing clonning a game but ripping graphics and distributing can land you in hot water
  24. do you have a PSD or just the screenshoot, and there will be copyright issues
  25. i have used http://nicedit.com/ in the past but it outputs html so not so good for forums
×
×
  • Create New...