Welcome to RaGEZONE - MMORPG Development Forums (sponsored by tfn.gr) Mark forums read | View Forum Leaders
RaGEZONE - MMORPG Development Forums (sponsored by tfn.gr)

OGame Discuss, New Feature to give Dark Matter at Server Developments forum; Hi, i found on the internet on interesting feature. Lotery ticket. i added to my ogame and it is working ...




Reply
Thread Tools
Development New Feature to give Dark Matter
 
 
Newbie

Rank: Omicron


Reply With Quote
 
Join Date: Oct 2008
Posts: 13
11-05-2008, 11:03 AM
 
Hi, i found on the internet on interesting feature. Lotery ticket. i added to my ogame and it is working fine, but it only make desapear my resources, it does not give the winner nothing, only a message that he/her wins

I want to add the lottery a feature, when someone wins the ticket, it gives DarkMatter, i think that is the camp rpg_points in the users table. But i am not a coder, i am a systems guy, with does some coding... lol

Can someone help me with this?

The code, of the Lottery tickets system is this:

PHP Code:
<?php

    define
('INSIDE'  true);
    
define('INSTALL' false);

    
$ugamela_root_path './';
    include(
$ugamela_root_path 'extension.inc');
    include(
$ugamela_root_path 'common.' $phpEx);

    
$Tiempo time();
    
$loteria gettemplate('lotery_off');
    if(
$Tiempo $game_config['lotery']) {
    
$Falta =  $game_config['lotery']-$Tiempo;
    
$parse['usuarios'] = "It remains ".$Falta." seconds before the next lotery... Please wait !!!";
      
       
$lote parsetemplate$loteria$parse);
       
display ($lote"lotery"false''true);
      
    } else {

                
$resto $Tiempo $game_config['Refresh'];
              
            
       
$loteria gettemplate('lotery_body');
    
$tiempolote 63600;
    
$maxtickets 100;
    
$canxticketm 250000;
    
$canxticketc 250000;
    
$canxticketd 250000;



    
$totaltickets  doquery ("SELECT sum(tickets) as total_tickets FROM {{table}} ",'lotery');
      
$CantidadTickets mysql_fetch_array($totaltickets);
    
$parse['Cantidad'] = $CantidadTickets['total_tickets'];
    
$parse['Cantidadf'] = $maxtickets-$CantidadTickets['total_tickets'];
    
$parse['Cantidadt'] = $maxtickets;
    
$parse['Cantidadm'] = $canxticketm;
    
$parse['Cantidadc'] = $canxticketc;
    
$parse['Cantidadd'] = $canxticketd;

    
$TusTickets2  doquery ("SELECT * FROM {{table}} WHERE `user` = '".$user['username']."' ",'lotery');
    
$TusTicket3 mysql_fetch_array($TusTickets2);
    
$TusTickets=$TusTicket3['tickets'];
    if(
$TusTickets != NULL) {
    
$parse['tustickets'] = $TusTickets;
    }
      else {
    
$parse['tustickets'] = 0;
    }
    if(
$_GET['cp'] == "compra") {
    
$metal $_POST['Tickets']*$canxticketm;
    
$cristal $_POST['Tickets']*$canxticketc;
    
$Deuterio $_POST['Tickets']*$canxticketd;
    
$complant doquery("SELECT * FROM {{table}} WHERE `id` = '".$planetrow['id']."' ",'planets');
    
$DatosPlaneta mysql_fetch_array($complant);
    if (
$DatosPlaneta['metal'] >= $metal && $DatosPlaneta['crystal'] >= $cristal && $DatosPlaneta['deuterium'] >= $Deuterio)
    {


    if (
$parse['Cantidadf'] < $_POST['Tickets']) { $parse['MensajeCompra'] = "<font color='#FF0000'>There isn't enough tickets !</font>"; } else {
    
$smetal $DatosPlaneta['metal']-$metal;
    
$scristal $DatosPlaneta['crystal']-$cristal;
    
$sdeuterio $DatosPlaneta['deuterium']-$Deuterio;
    
doquery("UPDATE {{table}} SET `metal`='".$smetal."', `crystal`='".$scristal."', `deuterium`='".$sdeuterio."' WHERE `id`='".$planetrow['id']."' limit 1""planets");

    if(
$TusTickets 0) {
    
$Suma $TusTickets+$_POST['Tickets'];
    
doquery("UPDATE {{table}} SET `tickets`='".$Suma."' WHERE `user`='{$user['username']}' limit 1""lotery");
    } else { 
doquery("INSERT INTO {{table}} SET `ID`='".$user['id']."', `user`='".$user['username']."', `tickets`='".$_POST['Tickets']."' ""lotery"); }

    
$parse['MensajeCompra'] = "<font color='#00FF00'>Just buy".$_POST['Tickets']." Tickets</font>";
    
?> <META HTTP-EQUIV='Refresh' CONTENT="0; URL='overview.php'> <?
    
}
                

    if((
$_POST['Tickets']+$CantidadTickets['total_tickets']) == $maxtickets) {


                 
$ganador doquery("SELECT * FROM {{table}} order by rand()""lotery");
                
$elganador mysql_fetch_array($ganador);
                
$ganad $elganador['ID'];
                
                
$userio doquery("SELECT * FROM {{table}} WHERE `id` = '".$ganad."' limit 1",'users');
       
$Datoswiner mysql_fetch_array($userio);
          
$ganadp $Datoswiner['id_planet'];
                  
$complant doquery("SELECT * FROM {{table}} WHERE `id_owner` = '".$ganad."' limit 1",'planets');
       
$DatosPlaneta mysql_fetch_array($complant);
      
       
$emetal $DatosPlaneta['metal']+($canxticketm*$maxtickets);
       
$ecristal $DatosPlaneta['crystal']+($canxticketc*$maxtickets);
       
$edeuterio $DatosPlaneta['deuterium']+($canxticketd*$maxtickets);
       
doquery("UPDATE {{table}} SET `metal`='".$emetal."', `crystal`='".$ecristal."', `deuterium`='".$edeuterio."' WHERE `id`='".$ganadp."' limit 1""planets");
            
            
$dando doquery("SELECT * FROM {{table}}""lotery");
                 
$Time    time();            
                 
$From    "<font color=\""$kolor ."\">Loteries</font>";            
                 
$Subject "<font color=\""$kolor ."\">Result of lotery</font>";  
                 
$summery=0;  
                
               while (
$uzer mysql_fetch_array($dando)) {        
             if(
$ganad == $uzer['ID']) { $Message "<font color='#00ff00'>Congratulations !!!
You have the winning ticket !
We hope see you soon !</font>"
; } //Message en cas de gain
             
else { $Message "<font color='#FF0000'>
You haven't winning ticket,
We hope see you soon !</font>"
; } //Message en cas de perte
                  
SendSimpleMessage $uzer['ID'], $uzer['ID'], $Time1$From$Subject$Message);
              
                 }  
              
doquery ("DELETE FROM {{table}} ",'lotery');
              
$sigueintelore $tiempolote time();
              
doquery("UPDATE {{table}} SET `config_value`='".$sigueintelore."' WHERE `config_name`='lotery' limit 1""config");
              }
    } else { 
$parse['MensajeCompra'] = "<font color='#FF0000'>You haven't enough resources !</font>"; }
    }
    
$pase['usuarios'] = "Autres joueurs";
    if(
$CantidadTickets == $maxtickets) { $parse['color'] = "red"; } else { $parse['color'] = "green"; }
           
$usuarios   doquery("SELECT * FROM {{table}} order by tickets""lotery");
               while (
$listad mysql_fetch_array($usuarios)) {  
             
$parse['usuarios'] .= "".$listad['user']." has ".$listad['tickets']." Ticket(s)<br/>";
          
             }


       
$lote parsetemplate$loteria$parse);
       
display ($lote"lotery"false''true);
    }

    ?
 
 
permalink
 

RaGEZONE is proudly sponsored by
 
* ~ Jangan ~ *

Rank: Member


Reply With Quote
 
Join Date: Nov 2006
Location: Canada
Posts: 811
11-06-2008, 07:07 AM
 
there was once a complete release on xnova... but this can bring a lot of things
 
 
permalink
 

 
Average Member

Rank: Omicron


Reply With Quote
 
Join Date: Oct 2008
Location: Kent, England
Posts: 72
11-06-2008, 01:01 PM
 
Hum nice idear but im not sure about it untill i go over you code more.
 
 
permalink
 


 
Average Member

Rank: Omicron


Reply With Quote
 
Join Date: Oct 2008
Location: Kent, England
Posts: 72
11-06-2008, 01:04 PM
 
well do you have the lottery binded in your othere php files i got it to work but im not sure if its working for online.
 
 
permalink
 

 
Newbie

Rank: Omicron


Reply With Quote
 
Join Date: Oct 2008
Posts: 13
11-06-2008, 06:03 PM
 
I just want to add a simple line, in this code...

PHP Code:
               while ($uzer mysql_fetch_array($dando)) {        
             if(
$ganad == $uzer['ID']) { $Message "<font color='#00ff00'>Congratulations !!!
You have the winning ticket !
We hope see you soon !</font>"
; } //Message en cas de gain
             
else { $Message "<font color='#FF0000'>
You haven't winning ticket,
We hope see you soon !</font>"
; } //Message en cas de perte
                  
SendSimpleMessage $uzer['ID'], $uzer['ID'], $Time1$From$Subject$Message);
              
                 } 
one line like this: doquery("UPDATE {{table}} SET `rpg_points`='"60000"'.....

The line has to find the user ID, and insert in the table in RPG_points.
I am no coder, so i dont know how to code this simple line, can someone help me???
 
 
permalink
 

 
RaGEZONER

Rank: Omicron


Reply With Quote
 
Join Date: Jan 2009
Location: Romania
Posts: 86
01-01-2009, 11:20 AM
 
Thanks for the release code ;) Im not using it but thanks i have inserted it on my secondary server
 
 
permalink
 

 
RaGEZONER

Rank: Omicron


Reply With Quote
 
Join Date: Jan 2009
Location: Romania
Posts: 86
01-02-2009, 11:37 AM
 
not working verry good :(
 
 
permalink
 

Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT +1. The time now is 10:21 PM.
Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RaGEZONE © 2001 - 2008





 
Evade Blackbelt School