forward LoadVehicles();
public LoadVehicles()
{
new file[128];
format(file, sizeof(file), "/Vehicles/%d.ini", cars);
if(!dini_Exists(file))
{
VehicleInfo[cars][vModel] = dini_Int(file, "Model");
VehicleInfo[cars][vPosX] = dini_Float(file, "X");
VehicleInfo[cars][vPosY] = dini_Float(file, "Y");
VehicleInfo[cars][vPosZ] = dini_Float(file, "Z");
VehicleInfo[cars][vPosA] = dini_Float(file, "A");
VehicleInfo[cars][vColor1] = dini_Int(file, "Color1");
VehicleInfo[cars][vColor2] = dini_Int(file, "Color2");
//CreateVehicle(VehicleInfo[cars][vModel], VehicleInfo[cars][vPosX], VehicleInfo[cars][vPosY], VehicleInfo[cars][vPosZ], VehicleInfo[cars][vPosA], VehicleInfo[cars][vColor1], VehicleInfo[cars][vColor1], false);
CreateVehicle(dini_Int(file, "Model"), dini_Float(file, "X"), dini_Float(file, "Y"), dini_Float(file, "Z"), dini_Float(file, "A"), dini_Int(file, "Color1"), dini_Int(file, "Color2"), false);
}
return 1;
}
new cars = 0;
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new file[128], str[128], name[MAX_PLAYER_NAME];
new vehicleid = GetPlayerVehicleID(playerid);
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "/Vehicles/%d.ini", vehicleid);
format(name, sizeof(name), "%s", dini_Get(file, "Owner"));
foreach(Player, i)
{
if(PlayerInfo[i][pCarKey] == vehicleid)
{
format(str, sizeof(str), "INFO: This vehicle is owned by %s.", name);
}
else if(PlayerInfo[i][pCarKey] != vehicleid)
{
format(str, sizeof(str), "INFO: Welcome to your vehicle %s.", name);
}
SendClientMessage(playerid, COLOR_YELLOW, str);
}
}
return 1;
}
vOwner[MAX_PLAYER_NAME]
Why Do People Use Dini! It is very slow. Open File... Execute... Close File... ( Repeat for every variable stored/retrieved )
|