Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* Grex's Godfather API for PHP was made by Grex
- For developers who want use this API for releasing CP or others:
- Do not edit andything
- 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
- Do not selling it!, it's free for everyone
- For developers who want use this for his OWN project:
- You are allowed to edit anything where you want
- 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
- Fullname: Gregor Ganglberger
- E-Mail: grexaut@gmail.com
- Project: San Andreas [Fun]RealLife - German | http://sa-rl.de
- */
- class functions
- {
- // Read out the userinformations
- function GetPlayerInfo($user)
- {
- require "config.php";
- $file="$GameDir/scriptfiles/Accounts/$user.ini";
- if(!file_exists($file)) return false;
- $data = parse_ini_file($file);
- return $data;
- }
- // Read out the bizzinformations
- function GetPlayerBizzInfo($user)
- {
- require "config.php";
- if(!$file=fopen("$GameDir/scriptfiles/bizz.cfg","r")) die("Error reading bizzfile");
- while (($data=fgetcsv($file,1024, "|")) !== FALSE)
- {
- if($data[1] == $user)
- {
- $datanew = array(
- "Owned" => $data[0],
- "Owner" => $data[1],
- "Message" => $data[2],
- "Extortion" => $data[3],
- "EntranceX" => $data[4],
- "EntranceY" => $data[5],
- "EntranceZ" => $data[6],
- "ExitX" => $data[7],
- "ExitY" => $data[8],
- "ExitZ" => $data[9],
- "LevelNeeded" => $data[10],
- "BuyPrice" => $data[11],
- "EntranceCost" => $data[12],
- "Till" => $data[13],
- "Locked" => $data[14],
- "Interior" => $data[15],
- "Products" => $data[16],
- "MaxProducts" => $data[17],
- "PriceProd" => $data[18]
- );
- return $datanew;
- }
- }
- }
- // Read out the sbizzinformations
- function GetPlayerSBizzInfo($user)
- {
- require "config.php";
- if(!$file=fopen("$GameDir/scriptfiles/sbizz.cfg","r")) die("Error reading bizzfile");
- while (($data=fgetcsv($file,1024, "|")) !== FALSE)
- {
- if($data[1] == $user)
- {
- $datanew = array(
- "Owned" => $data[0],
- "Owner" => $data[1],
- "Message" => $data[2],
- "Extortion" => $data[3],
- "EntranceX" => $data[4],
- "EntranceY" => $data[5],
- "EntranceZ" => $data[6],
- "LevelNeeded" => $data[7],
- "BuyPrice" => $data[8],
- "EntranceCost" => $data[9],
- "Till" => $data[10],
- "Locked" => $data[11],
- "Interior" => $data[12],
- "Products" => $data[13],
- "MaxProducts" => $data[14],
- "PriceProd" => $data[15]
- );
- return $datanew;
- }
- }
- }
- function GetPlayerHouseInfo($user)
- {
- require "config.php";
- if(!$file=fopen("$GameDir/scriptfiles/property.cfg","r")) die("Error reading bizzfile");
- while (($data=fgetcsv($file,1024, ",")) !== FALSE)
- {
- if($data[12] == $user)
- {
- $datanew = array(
- "Entrancex" => $data[0],
- "Entrancey" => $data[1],
- "Entrancez" => $data[2],
- "Exitx" => $data[3],
- "Exity" => $data[4],
- "Exitz" => $data[5],
- "Healthx" => $data[6],
- "Healthy" => $data[7],
- "Healthz" => $data[8],
- "Armourx" => $data[9],
- "Armoury" => $data[10],
- "Armourz" => $data[11],
- "Owner" => $data[12],
- "Discription" => $data[13],
- "Value" => $data[14],
- "Hel" => $data[15],
- "Arm" => $data[16],
- "Int" => $data[17],
- "Lock" => $data[18],
- "Owned" => $data[19],
- "Rooms" => $data[20],
- "Rent" => $data[21],
- "Rentabil" => $data[22],
- "Takings" => $data[23],
- "Vec" => $data[24],
- "Vcol1" => $data[25],
- "Vcol2" => $data[26],
- "Date" => $data[27],
- "Level" => $data[28]
- );
- return $datanew;
- }
- }
- }
- // Crypts the input password for comparing
- function cryptpw($password)
- {
- for($i=0; $i < strlen($password); $i++)
- {
- $temp = ord($password[$i]);
- $temp += (3^$i) * ($i % 15);
- if($temp > (0xff))
- {
- $temp -= 256;
- }
- $password[$i] = chr($temp);
- }
- return $password;
- }
- function GetVehicleName($vehicleid)
- {
- $carname = array("Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel",
- "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
- "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
- "Esperanto", "Taxi", "Washington", "Bobcat", "Whoopee", "BF Injection",
- "Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus",
- "Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie",
- "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral",
- "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder",
- "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair", "Berkley's RC Van",
- "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider", "Glendale",
- "Oceanic","Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy",
- "Hermes", "Sabre", "Rustler", "ZR-350", "Walton", "Regina", "Comet", "BMX",
- "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper",
- "Rancher", "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking",
- "Blista Compact", "Police Maverick", "Boxvillde", "Benson", "Mesa", "RC Goblin",
- "Hotring Racer A", "Hotring Racer B", "Bloodring Banger", "Rancher", "Super GT",
- "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster", "Stunt",
- "Tanker", "Roadtrain", "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra",
- "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune",
- "Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer",
- "Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent",
- "Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder", "Primo",
- "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite",
- "Windsor", "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratium",
- "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
- "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper",
- "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400",
- "News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
- "Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car",
- "Police Car", "Police Car", "Police Ranger", "Picador", "S.W.A.T", "Alpha",
- "Phoenix", "Glendale", "Sadler", "Luggage", "Luggage", "Stairs", "Boxville",
- "Tiller", "Utility Trailer");
- return $carname[$vehicleid-400];
- }
- // Logs who has where logged into his account
- function accesslog($user,$access)
- {
- require "config.php";
- if(!$file=fopen("$LogDir/access.log","a+")) return false;
- fwrite($file,mktime().";".$_SERVER['REMOTE_ADDR'].";".$user.";".$access."\n");
- fclose($file);
- return true;
- }
- // Writes the userinformation
- function UpdatePlayerInfo($assoc_array,$user)
- {
- require "config.php";
- $content = '';
- foreach ($assoc_array as $key => $data) $content .= "$key=$data\n";
- if (!$file = fopen("$GameDir/scriptfiles/$user.ini", 'w')) return false;
- if (!fwrite($file, $content)) {
- return false;
- }
- fclose($file);
- return true;
- }
- }
- class fractions
- {
- function ReadOrg()
- {
- while($user = readdir(opendir("$GameDir/Accounts/scriptfiles/")))
- {
- if(substr($user, -3) == 'ini')
- {
- $file = fopen("$GameDir/scriptfiles/Accounts/$user","r");
- $user = substr($user,0,-4);
- $functions = new functions();
- $PlayerInfo = $functions->GetPlayerInfo($user);
- if($PlayerInfo['Leader'] > 0) return $PlayerOrg[$user][true][$PlayerInfo['Leader']];
- else if($PlayerInfo['Member'] > 0) return $PlayerOrg[$user][false][$PlayerInfo['Member']];
- }
- }
- closedir($dir_handle);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement