
begood
Members-
Posts
17 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by begood
-
I already fix the issues, thank you a lot! :)
-
<?php defined('IN_EZRPG') or exit; class Module_Crimes extends Base_Module { public function start() { if (intval(time()) >= $this->player->tempo_crime) { switch($_GET['act']) { case 'um': $this->um(); break; case 'dois': $this->dois(); break; case 'tres': $this->tres(); break; case 'quatro': $this->quatro(); break; case 'cinco': $this->cinco(); break; case 'seis': $this->seis(); break; case 'sete': $this->sete(); break; default: $this->render(); break; } } else { $msg = 'Cant do another crime...'; header('Location: index.php?msg=' . urlencode($msg)); } } private function render() { $this->tpl->assign('player', $this->player); $this->tpl->display('crimes.tpl'); } // Crime um private function um() { $storedTime = intval(time()) + intval(300); $chance = rand(1,2); if ($this->player->stamina < 5) { $msg = 'Não tens stamina suficiente!'; header('Location: index.php?msg=' . urlencode($msg)); } else { if ($chance == 1) { $query = $this->db->execute('UPDATE <ezrpg>players SET money=money+5 WHERE id=?', array($this->player->id)); $query = $this->db->execute('UPDATE <ezrpg>players SET stamina=stamina-5 WHERE id=?', array($this->player->id)); $query = $this->db->execute('UPDATE <ezrpg>players SET exp=exp+3 WHERE id=?', array($this->player->id)); $query = $this->db->execute('UPDATE <ezrpg>players SET tempo_crime=? WHERE id=?', array($storedTime, $this->player->id)); $msg = 'Ganhas-te 5€ 3 pontos de experiência e perdeste 5% da tua stamina!'; header('Location: index.php?msg=' . urlencode($msg)); } else { $msg = 'Escapaste por pouco, uma stora ia-te apanhando!! Infelizmente não conseguiste sacar nada...'; header('Location: index.php?msg=' . urlencode($msg)); } } } // Crime dois private function dois() { $chance = rand(1,2); if ($this->player->stamina < 10) { $msg = 'Não tens stamina suficiente!'; header('Location: index.php?msg=' . urlencode($msg)); } else { if ($chance == 1) { $query = $this->db->execute('UPDATE <ezrpg>players SET money=money+10 WHERE id=?', array($this->player->id)); $query = $this->db->execute('UPDATE <ezrpg>players SET stamina=stamina-10 WHERE id=?', array($this->player->id)); $query = $this->db->execute('UPDATE <ezrpg>players SET exp=exp+6 WHERE id=?', array($this->player->id)); $msg = 'Ganhas-te 10€, 6 pontos de experiência e perdeste 10% da tua stamina!'; header('Location: index.php?msg=' . urlencode($msg)); } else { $msg = 'Escapaste por pouco, uma stora ia-te apanhando!! Infelizmente não conseguiste sacar nada...'; header('Location: index.php?msg=' . urlencode($msg)); } } } // Crime tres private function tres() { $chance = rand(1,2); if ($this->player->stamina < 12) { $msg = 'Não tens stamina suficiente!'; header('Location: index.php?msg=' . urlencode($msg)); } else { if ($chance == 1) { $query = $this->db->execute('UPDATE <ezrpg>players SET money=money+15 WHERE id=?', array($this->player->id)); $query = $this->db->execute('UPDATE <ezrpg>players SET stamina=stamina-12 WHERE id=?', array($this->player->id)); $query = $this->db->execute('UPDATE <ezrpg>players SET exp=exp+10 WHERE id=?', array($this->player->id)); $msg = 'Ganhas-te 15€, 10 pontos de experiência e perdeste 12% da tua stamina!'; header('Location: index.php?msg=' . urlencode($msg)); } else { $msg = 'Escapaste por pouco, uma stora ia-te apanhando!! Infelizmente não conseguiste sacar nada...'; header('Location: index.php?msg=' . urlencode($msg)); } } } // Crime quatro private function quatro() { $chance = rand(1,2); if ($this->player->stamina < 15) { $msg = 'Não tens stamina suficiente!'; header('Location: index.php?msg=' . urlencode($msg)); } else { if ($chance == 1) { $query = $this->db->execute('UPDATE <ezrpg>players SET money=money+17 WHERE id=?', array($this->player->id)); $query = $this->db->execute('UPDATE <ezrpg>players SET stamina=stamina-15 WHERE id=?', array($this->player->id)); $query = $this->db->execute('UPDATE <ezrpg>players SET exp=exp+13 WHERE id=?', array($this->player->id)); $msg = 'Ganhas-te 17€, 13 pontos de experiência e perdeste 15% da tua stamina!'; header('Location: index.php?msg=' . urlencode($msg)); } else { $msg = 'Escapaste por pouco, uma stora ia-te apanhando!! Infelizmente não conseguiste sacar nada...'; header('Location: index.php?msg=' . urlencode($msg)); } } } // Crime cinco private function cinco() { $chance = rand(1,2); if ($this->player->stamina < 16) { $msg = 'Não tens stamina suficiente!'; header('Location: index.php?msg=' . urlencode($msg)); } else { if ($chance == 1) { $query = $this->db->execute('UPDATE <ezrpg>players SET money=money+20 WHERE id=?', array($this->player->id)); $query = $this->db->execute('UPDATE <ezrpg>players SET stamina=stamina-16 WHERE id=?', array($this->player->id)); $query = $this->db->execute('UPDATE <ezrpg>players SET exp=exp+15 WHERE id=?', array($this->player->id)); $msg = 'Ganhas-te 20€, 15 pontos de experiência e perdeste 16% da tua stamina!'; header('Location: index.php?msg=' . urlencode($msg)); } else { $msg = 'Escapaste por pouco, uma stora ia-te apanhando!! Infelizmente não conseguiste sacar nada...'; header('Location: index.php?msg=' . urlencode($msg)); } } } // Crime seis private function seis() { $chance = rand(1,2); if ($this->player->stamina < 20) { $msg = 'Não tens stamina suficiente!'; header('Location: index.php?msg=' . urlencode($msg)); } else { if ($chance == 1) { $query = $this->db->execute('UPDATE <ezrpg>players SET money=money+24 WHERE id=?', array($this->player->id)); $query = $this->db->execute('UPDATE <ezrpg>players SET stamina=stamina-20 WHERE id=?', array($this->player->id)); $query = $this->db->execute('UPDATE <ezrpg>players SET exp=exp+17 WHERE id=?', array($this->player->id)); $msg = 'Ganhas-te 24€, 17 pontos de experiência e perdeste 20% da tua stamina!'; header('Location: index.php?msg=' . urlencode($msg)); } else { $msg = 'Escapaste por pouco, uma stora ia-te apanhando!! Infelizmente não conseguiste sacar nada...'; header('Location: index.php?msg=' . urlencode($msg)); } } } // Crime sete private function sete() { $chance = rand(1,2); if ($this->player->stamina < 27) { $msg = 'Não tens stamina suficiente!'; header('Location: index.php?msg=' . urlencode($msg)); } else { if ($chance == 1) { $query = $this->db->execute('UPDATE <ezrpg>players SET money=money+35 WHERE id=?', array($this->player->id)); $query = $this->db->execute('UPDATE <ezrpg>players SET stamina=stamina-27 WHERE id=?', array($this->player->id)); $query = $this->db->execute('UPDATE <ezrpg>players SET exp=exp+25 WHERE id=?', array($this->player->id)); $msg = 'Ganhas-te 35€, 25 pontos de experiência e perdeste 27% da tua stamina!'; header('Location: index.php?msg=' . urlencode($msg)); } else { $msg = 'Escapaste por pouco, uma stora ia-te apanhando!! Infelizmente não conseguiste sacar nada...'; header('Location: index.php?msg=' . urlencode($msg)); } } } } ?> That's my code right now... I don't know where is the error... tempo_crime (is where the time is stored on db has his type defined to timestamp) I'm making tests in private function um().
-
I've tested it now but it still don't working. I think the problem is when I do a crime it add to $storedTime - intval(time()) + intval(300), all right. But when it reloads the page $storedTime 'reset' to nothing so it allows the player to do how many crimes he wants... That's why I think to add the $storedTime to db but the value it stored in db it's all ways the same. :s My code, right now is it: <?php defined('IN_EZRPG') or exit; class Module_Crimes extends Base_Module { public function start() { if (intval(time()) >= intval($storedTime)) { switch($_GET['act']) { case 'um': $this->um(); break; } } else { $msg = 'Time not over - can't do another crime right now...'; header('Location: index.php?msg=' . urlencode($msg)); } } private function render() { $this->tpl->assign('player', $this->player); $this->tpl->display('crimes.tpl'); } // Crime um private function um() { $storedTime = intval(time()) + intval(300); $chance = rand(1,2); if ($this->player->stamina < 5) { $msg = 'Não tens stamina suficiente!'; header('Location: index.php?msg=' . urlencode($msg)); } else { if ($chance == 1) { $query = $this->db->execute('UPDATE <ezrpg>players SET money=money+5 WHERE id=?', array($this->player->id)); $query = $this->db->execute('UPDATE <ezrpg>players SET stamina=stamina-5 WHERE id=?', array($this->player->id)); $query = $this->db->execute('UPDATE <ezrpg>players SET exp=exp+3 WHERE id=?', array($this->player->id)); $msg = 'Ganhas-te 5€ 3 pontos de experiência e perdeste 5% da tua stamina!'; header('Location: index.php?msg=' . urlencode($msg)); } else { $msg = 'Escapaste por pouco, uma stora ia-te apanhando!! Infelizmente não conseguiste sacar nada...'; header('Location: index.php?msg=' . urlencode($msg)); } } } } ?>
-
I try something else, look: with: if (time() > $this->player->wt) { I can make another crime $query = $this->db->execute('UPDATE <ezrpg>players SET wt=? WHERE id=?', array(time() + 10, $this->player->id)); } else { I can't... } On db it gives me allways the same value: 838:59:59 and not 18:49:30 (if when i do the crime it was 18:49:20), as I expected. And with: if (time() > $this->player->wt) { I can make another crime $query = $this->db->execute('UPDATE <ezrpg>players SET wt=? WHERE id=?', array($smarty.now + 10, $this->player->id)); } else { I can't... } On db it gives me allways 00:00:10 and not 18:49:30 (if when I do the crime it was 18:49:20), as I expected... :s
-
I try it but I can't see how it can work... Look: (wt = waiting time to do another crime...) $wt = 0; if (time() > $wt) { I can make another crime. $wt = time()+10; } else { I can't... } That's what I've think to do but obviously don't work... Can you explain with more details how to do that... :S Thanks and sorry for lost of time...
-
Hello, I want to know, if someone could tell me, how to make a timer when I do a crime the player has to wait to make another one... Thanks
-
Hello people, I'm developing an sms system to players of my game donate to the game in exchange for benefits and a question emerged... Can we, ezrpg developers use something like this, I mean ask players to pay for benefits? It's not against Terms and Conditions? Regards, begood
-
To use cronjobs in free hosts or cheap hosts like rulerofzo says, you've to do that: 1. Create a html file called whatever you want. 2. Copy & Paste that simple code: <meta HTTP-EQUIV="REFRESH" content="0; url=LINK_CRONJOB"> 3. Change the LINK_CRONJOB to the entire cronjob url. 4. Save it... 5. Now in your host cp add this: */5 * * * * http://*YouwebsiteURL*/cron5min.php?code=*YOUR CODE HERE* Like 21LockDown says... :)
-
I don't know why that problem happens, just try to change your files by the originals... and tell me if it works :)
-
Hello everyone, again. :b I need some help here, my problem right now is that I want to use this: //Select empresa details $empresa = $db->fetchRow('SELECT * FROM `<ezrpg>empresas` WHERE `dono`=?', array($_SESSION['userid'])); $tpl->assign('empresa', $empresa); To give me more than one results... So, a player can have more than one company... But with the code above it just shows one company, don't show them all :s If anyone could tell me how I do this I'll appreciate :$ Regards, begood
-
The problem is solved. I just change a query and it just works. :b Thanks anyway, I think the topic can be closed. :)
-
Hello, I receive allways the same error when I've 2 functions on the same file... When I go to that module the page stays blank... <?php //This file cannot be viewed, it must be included defined('IN_EZRPG') or exit; class Module_Crimes extends Base_Module { public function start() { requireLogin(); $this->tpl->display('crimes.tpl'); if ($_GET['act'] == 'do') $this->do(); } public function do() { } } ?> As you can see, I don't have nothing on the second function but it give me the error allways :s Just if I take out the second function appears the page all right, else it don't... :s Regards, begood P.S.: Sorry for my bad English, I'm Portuguese... :)
-
Hey, I need some help here, I'm trying to create a module but when I go to index?mod=CriarEmpresa it don't appear... But when I remove a function (criarempresa) it appears... Can some one tell me where is the error: <?php //This file cannot be viewed, it must be included defined('IN_EZRPG') or exit; class Module_CriarEmpresa extends Base_Module { public function start() { $this->tpl->display('criarempresa.tpl'); if ($_GET['act'] == 'criarempresa') { $this->criarempresa(); } } private function criarempresa() { $error = 0; $errors = Array(); //Check username $result = $this->db->fetchRow('SELECT COUNT(`id`) AS `count` FROM `<ezrpg>empresas` WHERE `nome`=?', array($_POST['nome'])); if (empty($_POST['nome'])) { $errors[] = 'Não inseriste um nome para a empresa!'; $error = 1; } else if (!isNome($_POST['nome'])) { //If username is too short... $errors[] = 'O nome da empresa deve conter mais de 3 carateres!'; //Add to error message $error = 1; //Set error check } else if ($result->count > 0) { $errors[] = 'O nome da empresa que inseriste já está registado!'; $error = 1; //Set error check } //Check verification code if (empty($_POST['reg_verify'])) { $errors[] = 'Não inseriste o códiog de verificação!'; $error = 1; } else if ($_SESSION['verify_code'] != sha1(strtoupper($_POST['reg_verify']) . SECRET_KEY)) { $errors[] = 'O código de verificação inserido não está correto!'; $error = 1; } //verify_code must NOT be used again. session_unset(); session_destroy(); if ($error == 0) { unset($insert); $insert = Array(); //Add new user to database $insert['nome'] = $_POST['nome']; $insert['categoria'] = $_POST['categoria']; $insert['categoria'] = {$player->username} global $hooks; //Run register hook $insert = $hooks->run_hooks('register', $insert); $new_player = $this->db->insert('<ezrpg>empresas', $insert); //Use $new_player to find their new ID number. $hooks->run_hooks('register_after', $new_player); $msg = 'Empresa criada com sucesso!'; header('Location: index.php?msg=' . urlencode($msg)); exit; } else { $msg = 'Desculpa, existem erros no registo da empresa:<br />'; $msg .= '<ul>'; foreach($errors as $errmsg) { $msg .= '<li>' . $errmsg . '</li>'; } $msg .= '</ul>'; $url = 'index.php?mod=Register&msg=' . urlencode($msg) . '&nome=' . urlencode($_POST['username']) header('Location: ' . $url); exit; } } } ?> Thanks... :)
-
Hey everyone, It's possible someone re-upload every attachments of ezRPG's topics? 'Cause, every topic I see attachments don't appear and I can't take them from ezRPG's forum because administrator don't activate my account yet... Regards, begood