Advertisement
Guest User

Grex | www.sa-rl.de

a guest
May 6th, 2010
3,411
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 11.30 KB | None | 0 0
  1. index.php
  2. <?php
  3. /* Examplescript for Grex's Godfather API was made by Grex http://sa-rl.de */
  4. require "functions.php";
  5. $user = 'Grex'; // The username will defined here // Hier wird der Username gesetzt
  6. $password = 'sa-rl.de'; // The password will defined here // Hier wird das Passwort gesetzt
  7. $functions = new functions();
  8. //-----------------------[Auslesen der Userdaten]------------- Read the userinformations
  9. $PlayerInfo = $functions->GetPlayerInfo($user); // Userdatas will be saved in this variable // Spielerdaten werden auf diese Variable gespeichert
  10. //-----------------------[Benutzernamen überprüfen]------------- // Check the username
  11. if(!$PlayerInfo) die('User nicht gefunden'); // Check if the user exists // Kontrolliert, ob der User auch tatsächlich vorhanden ist
  12. //-----------------------[Loggen der Anmeldung]------------- // Logging the login
  13. if(!$functions->accesslog($user,true)) die ('Es trat ein Fehler auf'); // Security check, if logging has been failed, cancel // Sicherheitskontrolle, falls Logging nicht funktioniert, bricht er ab
  14. //-----------------------[Verwendung der Userdaten]-------------
  15. echo $PlayerInfo['Money'] + $PlayerInfo['Bank']."<br>"; // Calculate the money from the case and bank together and print out // Rechnet Geld von Geldbörse und Bank zusammen, und gibt es direkt aus
  16. //-----------------------[Passwortvergleich]-------------
  17. if($functions->cryptpw($password) != $PlayerInfo['Key']) die('Falsches Passwort'); // Crpyts the password (Godfather like) and compares it // Verschlüsselt das Passwort (Godfather Verschlüsselung)und vergleicht es
  18. //-----------------------[Auslesen der Bizzdaten]------------- Read the bizzdatas
  19. if($PlayerInfo['Bizz'] >= 0 && $PlayerInfo['Bizz'] < 100) $PlayerBizzInfo = $functions->GetPlayerBizzInfo($user); // Using bizzfiles and data // Einlesen der Bizzdaten
  20. else if($PlayerInfo['Bizz'] >= 100 && $PlayerInfo['Bizz'] < 255) $PlayerBizzInfo = $functions->GetPlayerSBizzInfo($user); // Using sbizzfile and datas // Einlesen der SBizzdaten
  21. else echo 'Du hast kein Bizz oder SBizz'; // User has no bizz or sbizz to read datas from file // User besitzt weder ein Bizz noch ein SBizz
  22. //-----------------------[Verwendung der Bizzdaten]------------- Using the bizzdatas
  23. if(isset($PlayerBizzInfo)) echo "<br>".$PlayerBizzInfo['Extortion']."<br>"; // The extortion will be displayed // Mitteilinhaber wird angezeigt
  24. //-----------------------[Auslesen der Hausdaten]------------- Read the housedatas
  25. if($PlayerInfo['House'] != 255) $PlayerHouseInfo = $functions->GetPlayerHouseInfo($user); // If the player has a house, search for them in property.cfg
  26. // Wenn der Spieler ein Haus besitzt, wir danach in der property.cfg gesucht
  27. //-----------------------[Verwendung der Hausdaten]------------- // Using the housedatas
  28. If(isset($PlayerHouseInfo)) echo $PlayerHouseInfo['Takings']; // The "housecash" (don't know correct word :P) will be displayed // Der Betrag von der Hauskasse wird angezeigt
  29. //-----------------------[Ändern der Userdaten]------------- // Change the userinformations
  30. $PlayerInfo['AdminLevel'] = $PlayerInfo['Level']; // Sets the adminlevel to the userlevel (for banning - part 1) // Setzt das Spielerlevel auf das Adminlevel (zum Bannen - Teil 1)
  31. $PlayerInfo['Level'] = -999; // Sets the Level -999 (for banning - part 2) // Setzt das Spielerlevel auf -999 (zum Bannen - Teil 2)
  32. //-----------------------[Änderung verwirken]------------- // Forfeit the userinformations
  33. $functions->UpdatePlayerInfo($PlayerInfo,$user); // All changes must be forfeit, because you have only changed in temporary and aren't changed in the file
  34. //Alle Änderungen müssen wirksam gemacht werden, ansonst sind diese nur temorär gespeichert und sind nicht in der ini gespeichert
  35. ?>
  36. functions.php
  37. <?php
  38. /* Grex's Godfather API for PHP was made by Grex
  39.  
  40.     For developers who want use this API for releasing CP or others:
  41.         Do not edit andything
  42.         Do not say, it is your own (without my premission), write my Name (Grex) at your footer. If you do not use one, write me under the credits
  43.         Do not selling it!, it's free for everyone
  44.        
  45.     For developers who want use this for his OWN project:
  46.         You are allowed to edit anything where you want
  47.         Do not say, it is your own, write my Name (Grex) at your footer. If you do not use one, write me under the credits
  48.        
  49.     Fullname: Gregor Ganglberger
  50.     E-Mail: grexaut@gmail.com
  51.     Project: San Andreas [Fun]RealLife - German | http://sa-rl.de
  52. */
  53.  
  54. class functions
  55. {
  56.     // Read out the userinformations
  57.     function GetPlayerInfo($user)
  58.     {
  59.         require "config.php";
  60.         $file="$GameDir/scriptfiles/$user.ini";
  61.         if(!file_exists($file)) die("Error reading userfile");
  62.         $data = parse_ini_file($file);
  63.         return $data;
  64.     }
  65.     // Read out the bizzinformations
  66.     function GetPlayerBizzInfo($user)
  67.     {
  68.         require "config.php";
  69.         if(!$file=fopen("$GameDir/scriptfiles/bizz.cfg","r")) die("Error reading bizzfile");
  70.         while (($data=fgetcsv($file,1024, "|")) !== FALSE)
  71.         {
  72.             if($data[1] == $user)
  73.             {
  74.                 $datanew = array(
  75.                     "Owned" => $data[0],
  76.                     "Owner" => $data[1],
  77.                     "Message" => $data[2],
  78.                     "Extortion" => $data[3],
  79.                     "EntranceX" => $data[4],
  80.                     "EntranceY" => $data[5],
  81.                     "EntranceZ" => $data[6],
  82.                     "ExitX" => $data[7],
  83.                     "ExitY" => $data[8],
  84.                     "ExitZ" => $data[9],
  85.                     "LevelNeeded" => $data[10],
  86.                     "BuyPrice" => $data[11],
  87.                     "EntranceCost" => $data[12],
  88.                     "Till" => $data[13],
  89.                     "Locked" => $data[14],
  90.                     "Interior" => $data[15],
  91.                     "Products" => $data[16],
  92.                     "MaxProducts" => $data[17],
  93.                     "PriceProd" => $data[18]
  94.                 );
  95.                 return $datanew;
  96.             }
  97.         }
  98.     }
  99.     // Read out the sbizzinformations
  100.     function GetPlayerSBizzInfo($user)
  101.     {
  102.         require "config.php";
  103.         if(!$file=fopen("$GameDir/scriptfiles/sbizz.cfg","r")) die("Error reading bizzfile");
  104.         while (($data=fgetcsv($file,1024, "|")) !== FALSE)
  105.         {
  106.             if($data[1] == $user)
  107.             {
  108.                 $datanew = array(
  109.                     "Owned" => $data[0],
  110.                     "Owner" => $data[1],
  111.                     "Message" => $data[2],
  112.                     "Extortion" => $data[3],
  113.                     "EntranceX" => $data[4],
  114.                     "EntranceY" => $data[5],
  115.                     "EntranceZ" => $data[6],
  116.                     "LevelNeeded" => $data[7],
  117.                     "BuyPrice" => $data[8],
  118.                     "EntranceCost" => $data[9],
  119.                     "Till" => $data[10],
  120.                     "Locked" => $data[11],
  121.                     "Interior" => $data[12],
  122.                     "Products" => $data[13],
  123.                     "MaxProducts" => $data[14],
  124.                     "PriceProd" => $data[15]
  125.                 );
  126.                 return $datanew;
  127.             }
  128.         }
  129.     }
  130.     function GetPlayerHouseInfo($user)
  131.     {
  132.         require "config.php";
  133.         if(!$file=fopen("$GameDir/scriptfiles/property.cfg","r")) die("Error reading bizzfile");
  134.         while (($data=fgetcsv($file,1024, ",")) !== FALSE)
  135.         {
  136.             if($data[12] == $user)
  137.             {
  138.                 $datanew = array(
  139.                     "Entrancex" => $data[0],
  140.                     "Entrancey" => $data[1],
  141.                     "Entrancez" => $data[2],
  142.                     "Exitx" => $data[3],
  143.                     "Exity" => $data[4],
  144.                     "Exitz" => $data[5],
  145.                     "Healthx" => $data[6],
  146.                     "Healthy" => $data[7],
  147.                     "Healthz" => $data[8],
  148.                     "Armourx" => $data[9],
  149.                     "Armoury" => $data[10],
  150.                     "Armourz" => $data[11],
  151.                     "Owner" => $data[12],
  152.                     "Discription" => $data[13],
  153.                     "Value" => $data[14],
  154.                     "Hel" => $data[15],
  155.                     "Arm" => $data[16],
  156.                     "Int" => $data[17],
  157.                     "Lock" => $data[18],
  158.                     "Owned" => $data[19],
  159.                     "Rooms" => $data[20],
  160.                     "Rent" => $data[21],
  161.                     "Rentabil" => $data[22],
  162.                     "Takings" => $data[23],
  163.                     "Vec" => $data[24],
  164.                     "Vcol1" => $data[25],
  165.                     "Vcol2" => $data[26],
  166.                     "Date" => $data[27],
  167.                     "Level" => $data[28]
  168.                 );
  169.                 return $datanew;
  170.             }
  171.         }
  172.     }
  173.     // Crypts the input password for comparing
  174.     function cryptpw($password)
  175.     {
  176.         for($i=0; $i < strlen($password); $i++)
  177.         {
  178.             $temp = ord($password[$i]);
  179.             $temp += (3^$i) * ($i % 15);
  180.             if($temp > (0xff))
  181.             {
  182.                 $temp -= 256;
  183.             }
  184.             $password[$i] = chr($temp);
  185.         }  
  186.         return $password;
  187.     }
  188.     function GetVehicleName($vehicleid)
  189.     {
  190.         $carname = array("Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel",
  191.         "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
  192.         "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
  193.         "Esperanto", "Taxi", "Washington", "Bobcat", "Whoopee", "BF Injection",
  194.         "Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus",
  195.         "Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie",
  196.         "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral",
  197.         "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder",
  198.         "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair", "Berkley's RC Van",
  199.         "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider", "Glendale",
  200.         "Oceanic","Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy",
  201.         "Hermes", "Sabre", "Rustler", "ZR-350", "Walton", "Regina", "Comet", "BMX",
  202.         "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper",
  203.         "Rancher", "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking",
  204.         "Blista Compact", "Police Maverick", "Boxvillde", "Benson", "Mesa", "RC Goblin",
  205.         "Hotring Racer A", "Hotring Racer B", "Bloodring Banger", "Rancher", "Super GT",
  206.         "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster", "Stunt",
  207.         "Tanker", "Roadtrain", "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra",
  208.         "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune",
  209.         "Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer",
  210.         "Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent",
  211.         "Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder", "Primo",
  212.         "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite",
  213.         "Windsor", "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratium",
  214.         "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
  215.         "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper",
  216.         "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400",
  217.         "News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
  218.         "Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car",
  219.         "Police Car", "Police Car", "Police Ranger", "Picador", "S.W.A.T", "Alpha",
  220.         "Phoenix", "Glendale", "Sadler", "Luggage", "Luggage", "Stairs", "Boxville",
  221.         "Tiller", "Utility Trailer");
  222.         return $carname[$vehicleid-400];
  223.     }
  224.     // Logs who has where logged into his account
  225.     function accesslog($user,$access)
  226.     {
  227.         require "config.php";
  228.         if(!$file=fopen("$LogDir/access.log","a+")) return false;
  229.         fwrite($file,mktime().";".$_SERVER['REMOTE_ADDR'].";".$user.";".$access."\n");
  230.         fclose($file);
  231.         return true;
  232.     }
  233.     // Writes the userinformation
  234.     function UpdatePlayerInfo($assoc_array,$user)
  235.     {
  236.         require "config.php";
  237.         $content = '';
  238.         foreach ($assoc_array as $key => $data) $content .= "$key=$data\n";
  239.         if (!$file = fopen("$GameDir/scriptfiles/$user.ini", 'w')) return false;
  240.         if (!fwrite($file, $content)) {
  241.             return false;
  242.         }
  243.         fclose($file);
  244.         return true;
  245.     }
  246. }
  247. ?>
  248. config.php
  249. <?php
  250. // Set the directory of the SAMP folder // Geben Sie den Pfad des Servers an
  251. $GameDir = "C:\server\SAMP";
  252. // Set the directory where the logfiles from the UCP will be save // Geben Sie den Pfad wo die Logfiles vom UCP gespeichert werden sollen an
  253. $LogDir = "C:\log\samp";
  254. //
  255. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement