garfield

[PHP]: Easy Random Spawn Creator

Nov 4th, 2011
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.93 KB | None | 0 0
  1. /*================================================================
  2.          _ ____ _____ __ __
  3.         (_) _ \ ___ | _ _ | _ __ __ | \ / |
  4.         | | | _) / __ | | | / _ \ / _ `| | \ / | |
  5.         | | __ / \ __ \ | | __ / (_ | | | | |
  6.         |_|_| |___/ | _ | \ ___ | \ __,_|_| | _ |
  7.  
  8.             Criado por SuYaNw Dácio
  9.             www.ips-team.blogspot.com
  10.              Generate Random Password
  11.  
  12. ===============================================================*/
  13.  
  14. <html><center><form method="POST" name='Form'>
  15.     <textarea cols='100' rows='10' name='coords' OnClick='javascript: document.Form.coords.value=""'>Bote aqui as coordenadas do arquivo savedpositions.txt.</textarea><br>
  16.     <input type="radio" name="Tipo" value="Varios" />Coordenada Randômica.<br />
  17.     <input type="radio" name="Tipo" value="UmSo" />Somente uma coordenada.<br>
  18.     <input type='submit' value='Enviar' name='envi'>
  19.     <hr>
  20. </form>
  21. <?php
  22.     if(isset($_POST['envi']))
  23.     {
  24.         $str = $_POST['coords'];
  25.         $st  = NULL;
  26.        
  27.         if(!strlen($str))
  28.             return $s = "Insira uma coordenada válida!";
  29.        
  30.         if(!strcmp($_POST['Tipo'], "Varios"))
  31.         {
  32.             $sai        = explode("\n", $str);
  33.             $contar     = -1;
  34.            
  35.             for($i  = 0; $i != count($sai); ++$i)
  36.             {
  37.                 if(empty($sai[$i]))
  38.                     break;
  39.                    
  40.                 $Out = explode(",", $sai[$i]);
  41.    
  42.                 if($i !=  count($sai) -1)
  43.                     $st .=  "{".$Out[1].", ".$Out[2].", ".$Out[3]."},\n";                  
  44.                 else
  45.                     $st .= "{".$Out[1].", ".$Out[2].", ".$Out[3]."}\n";
  46.  
  47.                 $contar ++;
  48.            
  49.             }
  50.             echo "<textarea cols='100' rows='10'>new MinhaArray[".$contar."][3]= {\n$st};</textarea>";
  51.             return 1;          
  52.         }
  53.        
  54.         if(!strcmp($_POST['Tipo'], "UmSo"))
  55.         {
  56.             $expl = explode(",", $str);
  57.            
  58.             if(empty($expl[1]) && empty($expl[2]) && empty($expl[3])) return 0;
  59.                
  60.             $s = "<textarea cols='100' rows='10'>SetPlayerPos(playerid, ".$expl[1].",".$expl[2].",".$expl[3].");</textarea>";
  61.             echo $s;
  62.             return 1;
  63.         }
  64.     }
  65. ?>
  66. </center>
  67. </html>
Advertisement
Add Comment
Please, Sign In to add comment