07.08.2012, 15:00
(
Последний раз редактировалось Joe Vagos; 08.08.2012 в 18:03.
)
i need to save facing angle virtual world and interior using dini so could any one help me
public OnPlayerDisconnect(playerid, reason)
{
new file[128], pname[MAX_PLAYER_NAME];
new Float:x, Float:y, Float:z,Float:angle;//we add a float for angle here
new interior,vworld;//we will store the values in here
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "\\SavePos\\%s.ini", pname);
if(!dini_Exists(file))
dini_Create(file);
GetPlayerPos(playerid, x, y, z);
interior = GetPlayerInterior(playerid);//here we get the interior of the player, and we store it in our variable
vworld = GetPlayerVirtualWorld(playerid);//here we get the world of the player, and we store it in our variable
GetPlayerFacingAngle(playerid,angle);//here we get the angle, and store it in our float
dini_FloatSet(file, "posX", x);
dini_FloatSet(file, "posY", y);
dini_FloatSet(file, "posZ", z);
dini_FloatSet(file, "angle",angle);//here we get the float, that we previously filled with the angle value, and we save it
dini_IntSet(file, "interior",interior);//here we save the interior with the data collected above
dini_IntSet(file, "vworld",vworld);//save for virtual world, we collect the data and save it
return 1;
}
public OnPlayerSpawn(playerid)
{
new file[128], pname[MAX_PLAYER_NAME];
new Float:x, Float:y, Float:z,Float:angle;//we create a float for our angle again
new vworld,interior;//we create vars again
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "\\SavePos\\%s.ini", pname);
x = dini_Float(file, "posX");
y = dini_Float(file, "posY");
z = dini_Float(file, "posZ");
angle = dini_Float(file, "angle");//here we read the data from the file, and load the value into our float
interior = dini_Int(file, "interior");//here we load the data in the variables we created earlier
vworld = dini_Int(file, "vworld");//here we load the data in the variables we created earlier
SetPlayerPos(playerid, x, y, z);
SetPlayerFacingAngle(playerid,angle);//here we set the angle that we loaded before.
SetPlayerInterior(playerid,interior);//self explanitory, we set the interior with the data collected above
SetPlayerVirtualWorld(playerid,vworld);//self explanitory, we set the virtual world with the data collected above
return 1;
}