PDA

View Full Version : Interior Help I Will Rep


Scripter12345
04/04/2012, 05:44 PM
The problem is when im in a interior and i log out when i log back in it sets my interior to 0 and im free falling how would i make it so if i log out when im in a interior and log back in it keeps me in that interior


Please Help Please

ViniBorn
04/04/2012, 05:47 PM
Use SetPlayerInterior (http://www.******.com.br/url?sa=t&rct=j&q=setplayerinterior&source=web&cd=1&ved=0CCEQFjAA&url=http%3A%2F%2Fwiki.sa-mp.com%2Fwiki%2FSetPlayerInterior&ei=uIp8T6eAD4-u0AGN_OiIDA&usg=AFQjCNHDPfQOqC5Drpo8YufDaYpNMSOI-g&cad=rja)

Scripter12345
04/04/2012, 05:55 PM
I have done that but where would i put it and how


Would it go in OnPlayerDisconnect

ViniBorn
04/04/2012, 06:23 PM
Yeah, save the interior when you log out and use it when the player connect

Scripter12345
04/04/2012, 06:24 PM
Yeah, save the interior when you log out...


Im kind of new to scripting


May you explain how i would do it


If you need any part of my script reply


Please Help

aRoach
04/04/2012, 06:28 PM
Give us that snippet of code that save / load the Accounts Data..

Scripter12345
04/04/2012, 06:30 PM
Give us that snippet of code that save / load the Accounts Data..


function SaveAccountStats(playerid)
{
new
INI:File = INI_Open(UserPath(playerid))
;
INI_SetTag(File,"data");

PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
new
Float:x,
Float:y,
Float:z
;
GetPlayerPos(playerid,x,y,z);
PlayerInfo[playerid][pPos_x] = x;
PlayerInfo[playerid][pPos_y] = y;
PlayerInfo[playerid][pPos_z] = z;

INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Sex",PlayerInfo[playerid][pSex]);
INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
INI_WriteFloat(File,"Pos_x",PlayerInfo[playerid][pPos_x]);
INI_WriteFloat(File,"Pos_y",PlayerInfo[playerid][pPos_y]);
INI_WriteFloat(File,"Pos_z",PlayerInfo[playerid][pPos_z]);
INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
INI_WriteInt(File,"Team",PlayerInfo[playerid][pTeam]);
INI_WriteInt(File,"Accent",PlayerInfo[playerid][pAccent]);

INI_Close(File);
return 1;
}


function LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Sex",PlayerInfo[playerid][pSex]);
INI_Int("Age",PlayerInfo[playerid][pAge]);
INI_Float("Pos_x",PlayerInfo[playerid][pPos_x]);
INI_Float("Pos_y",PlayerInfo[playerid][pPos_y]);
INI_Float("Pos_z",PlayerInfo[playerid][pPos_z]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("Team",PlayerInfo[playerid][pTeam]);
INI_Int("Accent",PlayerInfo[playerid][pAccent]);
return 1;
}


Please Help Me

aRoach
04/04/2012, 06:33 PM
function SaveAccountStats(playerid)
{
new
INI:File = INI_Open(UserPath(playerid))
;
INI_SetTag(File,"data");

PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
new
Float:x,
Float:y,
Float:z
;
GetPlayerPos(playerid,x,y,z);
PlayerInfo[playerid][pPos_x] = x;
PlayerInfo[playerid][pPos_y] = y;
PlayerInfo[playerid][pPos_z] = z;

INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Sex",PlayerInfo[playerid][pSex]);
INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
INI_WriteFloat(File,"Pos_x",PlayerInfo[playerid][pPos_x]);
INI_WriteFloat(File,"Pos_y",PlayerInfo[playerid][pPos_y]);
INI_WriteFloat(File,"Pos_z",PlayerInfo[playerid][pPos_z]);
INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
INI_WriteInt(File,"Team",PlayerInfo[playerid][pTeam]);
INI_WriteInt(File,"Accent",PlayerInfo[playerid][pAccent]);
INI_WriteInt(File,"Interior",GetPlayerInterior(playerid));

INI_Close(File);
return 1;
}

And...

function LoadUser_data(playerid,name[],value[])
{
new Int;
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Sex",PlayerInfo[playerid][pSex]);
INI_Int("Age",PlayerInfo[playerid][pAge]);
INI_Float("Pos_x",PlayerInfo[playerid][pPos_x]);
INI_Float("Pos_y",PlayerInfo[playerid][pPos_y]);
INI_Float("Pos_z",PlayerInfo[playerid][pPos_z]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("Team",PlayerInfo[playerid][pTeam]);
INI_Int("Accent",PlayerInfo[playerid][pAccent]);
INI_Int("Interior,Int);
SetPlayerInterior(playerid,Int);
return 1;
}

Scripter12345
04/04/2012, 06:51 PM
Nevermind i think i have just fixed it

Chris1337
04/04/2012, 06:53 PM
maybe this help


public OnPlayerspawn

SetPlayerInterior(playerid, THEINTERIORYOUWANT);


if you only want 1 interior

Scripter12345
04/04/2012, 06:56 PM
function SaveAccountStats(playerid)
{
new
INI:File = INI_Open(UserPath(playerid))
;
INI_SetTag(File,"data");

PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
new
Float:x,
Float:y,
Float:z
;
GetPlayerPos(playerid,x,y,z);
PlayerInfo[playerid][pPos_x] = x;
PlayerInfo[playerid][pPos_y] = y;
PlayerInfo[playerid][pPos_z] = z;

INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Sex",PlayerInfo[playerid][pSex]);
INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
INI_WriteFloat(File,"Pos_x",PlayerInfo[playerid][pPos_x]);
INI_WriteFloat(File,"Pos_y",PlayerInfo[playerid][pPos_y]);
INI_WriteFloat(File,"Pos_z",PlayerInfo[playerid][pPos_z]);
INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
INI_WriteInt(File,"Team",PlayerInfo[playerid][pTeam]);
INI_WriteInt(File,"Accent",PlayerInfo[playerid][pAccent]);
INI_WriteInt(File,"Interior",GetPlayerInterior(playerid));

INI_Close(File);
return 1;
}

And...

function LoadUser_data(playerid,name[],value[])
{
new Int;
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Sex",PlayerInfo[playerid][pSex]);
INI_Int("Age",PlayerInfo[playerid][pAge]);
INI_Float("Pos_x",PlayerInfo[playerid][pPos_x]);
INI_Float("Pos_y",PlayerInfo[playerid][pPos_y]);
INI_Float("Pos_z",PlayerInfo[playerid][pPos_z]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("Team",PlayerInfo[playerid][pTeam]);
INI_Int("Accent",PlayerInfo[playerid][pAccent]);
INI_Int("Interior,Int);
SetPlayerInterior(playerid,Int);
return 1;
}


That did not work when i log out of an interior and log back in it just sets me at the first place you spawn when you register a account

TzAkS.
04/04/2012, 08:49 PM
Do you have SaveAccountStats(playerid); on
OnPlayerDisconnect?