SA-MP Forums Archive
skin/xyz saving and loading with y_ini [need help] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: skin/xyz saving and loading with y_ini [need help] (/showthread.php?tid=516227)



skin/xyz saving and loading with y_ini [need help] - Immortal_LTU - 30.05.2014

Hello , can someone show me or help me to do skin and x,y,z saving and loading using y_ini ? I would appreciate your effort to help me


Re: skin/xyz saving and loading with y_ini [need help] - biker122 - 30.05.2014

Inside your player enum (Put this in the middle, if you put this in the last, remove the "," at the last variable)
pawn Код:
Float:SX,
Float:SY,
Float:SZ,
Skin,
under OnPlayerDisconnect (Where you save player's stats while disconnecting)
pawn Код:
GetPlayerPos(playerid, pInfo[playerid][SX], pInfo[playerid][SY], pInfo[playerid][SZ]);
INI_WriteFloat(File, "XPos", pInfo[playerid][SX]);
INI_WriteFloat(File, "YPos", pInfo[playerid][SY]);
INI_WriteFloat(File, "ZPos", pInfo[playerid][SZ]);
INI_WriteInt(File, "Skin", GetPlayerSkin(playerid));
and on "LoadUser_data" function or whatever.
pawn Код:
INI_Float("XPos", pInfo[playerid][XPos]);
INI_Float("YPos", pInfo[playerid][YPos]);
INI_Float("ZPos", pInfo[playerid][ZPos]);
INI_Int("Skin", pInfo[playerid][Skin]);
Under OnPlayerSpawn
pawn Код:
SetPlayerPos(playerid, pInfo[playerid][XPos], pInfo[playerid][YPos], pInfo[playerid][ZPos]);
SetPlayerSkin(playerid, pInfo[playerid][Skin]);



Re: skin/xyz saving and loading with y_ini [need help] - Immortal_LTU - 30.05.2014

Quote:
Originally Posted by biker122
Посмотреть сообщение
Inside your player enum (Put this in the middle, if you put this in the last, remove the "," at the last variable)
pawn Код:
Float:SX,
Float:SY,
Float:SZ,
Skin,
under OnPlayerDisconnect (Where you save player's stats while disconnecting)
pawn Код:
GetPlayerPos(playerid, pInfo[playerid][SX], pInfo[playerid][SY], pInfo[playerid][SZ]);
INI_WriteFloat(File, "XPos", pInfo[playerid][SX]);
INI_WriteFloat(File, "YPos", pInfo[playerid][SY]);
INI_WriteFloat(File, "ZPos", pInfo[playerid][SZ]);
INI_WriteInt(File, "Skin", GetPlayerSkin(playerid));
and on "LoadUser_data" function or whatever.
pawn Код:
INI_Float("XPos", pInfo[playerid][XPos]);
INI_Float("YPos", pInfo[playerid][YPos]);
INI_Float("ZPos", pInfo[playerid][ZPos]);
INI_Int("Skin", pInfo[playerid][Skin]);
Under OnPlayerSpawn
pawn Код:
SetPlayerPos(playerid, pInfo[playerid][XPos], pInfo[playerid][YPos], pInfo[playerid][ZPos]);
SetPlayerSkin(playerid, pInfo[playerid][Skin]);
Thanks dude , i appreciate your help . +rep


Re: skin/xyz saving and loading with y_ini [need help] - cleanboy - 30.05.2014

i got this problem too, the skin doesnt save when u quit, and when u join, u need to choose a skin again, is this is the solution?


Re: skin/xyz saving and loading with y_ini [need help] - biker122 - 30.05.2014

If you want to make an auto spawn, check like this under login dialog(if successfully logged in)
pawn Код:
if(pInfo[playerid][Skin] != -1)
{
      SpawnPlayer(playerid);
      SetPlayerSkin(playerid, pInfo[playerid][Skin]);
      return 1;
}



Re: skin/xyz saving and loading with y_ini [need help] - Immortal_LTU - 30.05.2014

Quote:
Originally Posted by biker122
Посмотреть сообщение
If you want to make an auto spawn, check like this under login dialog(if successfully logged in)
pawn Код:
if(pInfo[playerid][Skin] != -1)
{
      SpawnPlayer(playerid);
      SetPlayerSkin(playerid, pInfo[playerid][Skin]);
      return 1;
}
So this way i can bypass the skin selection ?


Re: skin/xyz saving and loading with y_ini [need help] - biker122 - 30.05.2014

Yeah, In my view, you can.


Re: skin/xyz saving and loading with y_ini [need help] - Immortal_LTU - 31.05.2014

hey thanks for helping out , but i have some errors .

: error 028: invalid subscript (not an array or too many subscripts): "pInfo"
: error 029: invalid expression, assumed zero
: error 029: invalid expression, assumed zero
: fatal error 107: too many error messages on one line

those errors are on line 34 .

INI_Float("XPos", pInfo[playerid][XPos]);


Re: skin/xyz saving and loading with y_ini [need help] - BroZeus - 31.05.2014

show your player enums


Re: skin/xyz saving and loading with y_ini [need help] - Immortal_LTU - 31.05.2014

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
show your player enums
Код:
enum pInfo
{
    pPass,
    pCash,
    Float:SX,
    Float:SY,
    Float:SZ,
    Skin
}
new PlayerInfo[MAX_PLAYERS][pInfo];