// Here I tried to CreateVehicle and load the model and everything else, did not work.
public OnPlayerConnect(playerid)
{
...
if(dini_Exists(File))
{
CreateVehicle(dini_Int(File, "Model"), dini_Float(File, "X"), dini_Float(File, "Y"), dini_Float(File, "Z"), dini_Float(File, "Angle", 0.0, -1, -1, 600000);
return 1;
}
...
return 1;
}
// Here I tried to create the vehicle at a random position then setting the X, Y, Z and Angle of the vehicle, did not work either.
public OnPlayerConnect(playerid)
{
//if dini exists crap...
SetVehiclePos(dini_Int(File, "Vehicle ID"), dini_Float(File, "X"), dini_Float(File, "Y"), dini_Float(File, "Z"));
SetVehicleZAngle(dini_Int(File, "Vehicle ID"), dini_Float(File, "Angle"));
...
return 1;
}
Is there anything at the X Y and Z coordinates? Also don't think you need dini_Float for that, use dini_Int
|
COMMAND:loadcar(playerid, params[])
{
new CarFile[100], pname[24];
new vehicleid = GetPlayerVehicleID(playerid);
if(PlayerHasCar[playerid] == 0)
{
SendClientMessage(playerid, COLOR_RED, "You don't own a car.");
return 1;
}
if(PlayerHasCar[playerid] == 0 && vOwned[vehicleid] == 0 && vOwned[vehicleid] == 1)
{
SendClientMessage(playerid, COLOR_RED, "You don't own a car or this is not your car.");
return 1;
}
format(CarFile, sizeof(CarFile), "Server Data/Vehicles/%s.ini",pname);
CreateVehicle(dini_Int(CarFile, "Model"), dini_Float(CarFile, "X"), dini_Float(CarFile, "Y"), dini_Float(CarFile, "Z"), dini_Float(CarFile, "Angle"), -1, -1, 600000);
SendClientMessage(playerid, COLOR_WHITE, "You have loaded your vehicle.");
return 1;
}
More than 36 hours passed.
Here is how I load the cars now: pawn Код:
|
But first of all add a check if the file exist, without you never know if you entered the correct filename
|