public OnPlayerConnect(playerid)
{
if(fexist(FolderVehicles(playerid)))
{
inline loadvehicle(string:name[], string:value[])
{
INI_Int("model", vInfo[playerid][model]);
INI_Int("world", vInfo[playerid][world]);
INI_Int("interior", vInfo[playerid][interior]);
INI_Float("pos:x", vInfo[playerid][x_]);
INI_Float("pos:y", vInfo[playerid][y_]);
INI_Float("pos:z", vInfo[playerid][z_]);
}
INI_ParseFile(FolderVehicles(playerid), "loadvehicle");
vInfo[playerid][vehicle] = 1;
}
else if(!fexist(FolderVehicles(playerid)))
{
vInfo[playerid][vehicle] = 0;
}
return true;
}
public OnPlayerRequestSpawn(playerid)
{
if(vInfo[playerid][vehicle] != 0)
{
vInfo[playerid][vehicle] = CreateVehicle(vInfo[playerid][model], vInfo[playerid][x_], vInfo[playerid][y_], vInfo[playerid][z_], 3, random(126), random(126), (60*60));
SetVehicleVirtualWorld(vInfo[playerid][vehicle], vInfo[playerid][world]);
LinkVehicleToInterior(vInfo[playerid][vehicle], vInfo[playerid][interior]);
}
return true;
}
Try to add ".txt" after the folder name in the code. "Foldername.txt"
Not sure, but give a try. |
sorry i cant understand u
i still have this problems its not load the vehicles :/ please help +rep |
public OnPlayerConnect(playerid)
{
if(fexist(FolderVehicles.txt(playerid)))
{
inline loadvehicle(string:name[], string:value[])
{
INI_Int("model", vInfo[playerid][model]);
INI_Int("world", vInfo[playerid][world]);
INI_Int("interior", vInfo[playerid][interior]);
INI_Float("pos:x", vInfo[playerid][x_]);
INI_Float("pos:y", vInfo[playerid][y_]);
INI_Float("pos:z", vInfo[playerid][z_]);
}
INI_ParseFile(FolderVehicles(playerid), "loadvehicle");
vInfo[playerid][vehicle] = 1;
}
else if(!fexist(FolderVehicles.txt(playerid)))
{
vInfo[playerid][vehicle] = 0;
}
return true;
}
PHP код:
|
scriptfiles\Vehicles
public OnPlayerDisconnect(playerid, reason)
{
if(vInfo[playerid][vehicle] != 0)
{
new Float:pos[3];
GetVehiclePos(vInfo[playerid][vehicle], pos[0], pos[1], pos[2]);
PutPlayerInVehicle(playerid, vInfo[playerid][vehicle], 0);
new INI:File = INI_Open(FolderVehicles(playerid));
INI_SetTag(File, "Info vehicle");
INI_WriteInt(File, "model", vInfo[playerid][model]);
INI_WriteInt(File, "world", GetVehicleVirtualWorld(vInfo[playerid][vehicle]));
INI_WriteInt(File, "interior", GetPlayerInterior(playerid));
INI_WriteFloat(File, "pos:x", pos[0]);
INI_WriteFloat(File, "pos:y", pos[1]);
INI_WriteFloat(File, "pos:z", pos[2]);
INI_Close(File);
//..
DestroyVehicle(vInfo[playerid][vehicle]);
}
return true;
}
The code is good, it could be that you don't have the folder "vehicles" created with crashdetect test and you will notice that there is no error, i tried the code and it worked correctly.
|
D:\MyOwn\scriptfiles\Vehicles
[Info vehicle]
model = 521
world = 0
interior = 0
pos:x = 2280.796875
pos:y = 2411.673583
pos:z = 10.248614