Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SQL/ARRAYS ASCII map generation

Comments in 'Plugin Development' started by MinePocket Servers, Apr 23, 2016.

  1. MinePocket Servers
    Offline

    MinePocket Servers Active Member

    Joined:
    Mar 6, 2014
    Posts:
    69
    Minecraft User:
    MinePocket
    Precondition: Get chunk coords
    Post: Print to screen an ascii map

    PHP:
        public function drawMap ($player$x$z
        {
            
    //  1 2 3 4 5 6 7 8 9 0 1
            // A
            // B
            // C
            // D          X
            // E
            // F
            // G
            
    $tcx $x 3;
            
    $tcz $z -5;
            
    $iy 0;
            
    $ix 0;
            while (
    $iy <= 7)
            {
                
    $tarray = array();
                while (
    $ix <= 11)
                {
                    
    //$result = $this->plugin->query("SELECT * FROM plots WHERE $tcx = x AND $tcz = z;");
                    
    $array $this->plugin->factionFromPoint($iy,$ix);
                    
    //$array = $result->fetchArray(SQLITE3_ASSOC);
                    
    if (empty($array)) 
                    {
                        
    array_push($tarray" ");
                    } 
                    else 
                    {
                      
    $player->sendMessage(TextFormat::BLUE $array);
                      
    array_push($tarray$array);  
                    }
                    
    $ix++;
                }
                
    $fout implode(" "$tarray);
                
    //$player->sendMessage(TextFormat::BLUE . $fout);
                
    $ix 0;
                
    $iy++;
            }
           
        }
  2. MinePocket Servers
    Offline

    MinePocket Servers Active Member

    Joined:
    Mar 6, 2014
    Posts:
    69
    Minecraft User:
    MinePocket
    Looks like its time to decompile massivecrafts factions plugin...
  3. MinePocket Servers
    Offline

    MinePocket Servers Active Member

    Joined:
    Mar 6, 2014
    Posts:
    69
    Minecraft User:
    MinePocket
    HAH derp forgot to increment tcx and tcz, wow Im an idiot
    Muqsit and basprohop like this.
  4. MinePocket Servers
    Offline

    MinePocket Servers Active Member

    Joined:
    Mar 6, 2014
    Posts:
    69
    Minecraft User:
    MinePocket
    [​IMG]

    I should get a sticker

Share This Page

Advertisement