skin/xyz saving and loading with y_ini [need help]
#1

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
Reply
#2

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]);
Reply
#3

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
Reply
#4

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?
Reply
#5

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;
}
Reply
#6

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 ?
Reply
#7

Yeah, In my view, you can.
Reply
#8

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]);
Reply
#9

show your player enums
Reply
#10

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];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)