Also hier die function.
<?php
class functions
{
function GetPlayerInfo($user)
{
require "config.php";
$file="$GameDir/scriptfiles/users/$user.ini";
if(!file_exists($file)) die("Error reading userfile");
$data = parse_ini_file($file);
return $data;
}
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;
}
}
}
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;
}
}
}
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];
}
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;
}
function UpdatePlayerInfo($assoc_array,$user)
{
require "config.php";
$content = '';
foreach ($assoc_array as $key => $data) $content .= "$key=$data\n";
if (!$file = fopen("$GameDir/scriptfiles/users/$user.ini", 'w')) return false;
if (!fwrite($file, $content)) {
return false;
}
fclose($file);
return true;
}
}
?>
Alles anzeigen