SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 30/05/2014, 06:53 AM   #1
Immortal_LTU
Big Clucker
 
Join Date: Feb 2011
Location: Lithuania
Posts: 120
Reputation: 1
Default skin/xyz saving and loading with y_ini [need help]

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
Immortal_LTU is offline   Reply With Quote
Old 30/05/2014, 07:46 AM   #2
biker122
Gangsta
 
Join Date: Feb 2014
Posts: 766
Reputation: 59
Default Re: skin/xyz saving and loading with y_ini [need help]

Inside your player enum (Put this in the middle, if you put this in the last, remove the "," at the last variable)
pawn Code:
Float:SX,
Float:SY,
Float:SZ,
Skin,

under OnPlayerDisconnect (Where you save player's stats while disconnecting)
pawn Code:
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 Code:
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 Code:
SetPlayerPos(playerid, pInfo[playerid][XPos], pInfo[playerid][YPos], pInfo[playerid][ZPos]);
SetPlayerSkin(playerid, pInfo[playerid][Skin]);
biker122 is offline   Reply With Quote
Old 30/05/2014, 08:01 AM   #3
Immortal_LTU
Big Clucker
 
Join Date: Feb 2011
Location: Lithuania
Posts: 120
Reputation: 1
Default Re: skin/xyz saving and loading with y_ini [need help]

Quote:
Originally Posted by biker122 View Post
Inside your player enum (Put this in the middle, if you put this in the last, remove the "," at the last variable)
pawn Code:
Float:SX,
Float:SY,
Float:SZ,
Skin,

under OnPlayerDisconnect (Where you save player's stats while disconnecting)
pawn Code:
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 Code:
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 Code:
SetPlayerPos(playerid, pInfo[playerid][XPos], pInfo[playerid][YPos], pInfo[playerid][ZPos]);
SetPlayerSkin(playerid, pInfo[playerid][Skin]);

Thanks dude , i appreciate your help . +rep
Immortal_LTU is offline   Reply With Quote
Old 30/05/2014, 09:48 AM   #4
cleanboy
Huge Clucker
 
Join Date: May 2014
Posts: 204
Reputation: 0
Default Re: skin/xyz saving and loading with y_ini [need help]

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?
cleanboy is offline   Reply With Quote
Old 30/05/2014, 10:48 AM   #5
biker122
Gangsta
 
Join Date: Feb 2014
Posts: 766
Reputation: 59
Default Re: skin/xyz saving and loading with y_ini [need help]

If you want to make an auto spawn, check like this under login dialog(if successfully logged in)
pawn Code:
if(pInfo[playerid][Skin] != -1)
{
      SpawnPlayer(playerid);
      SetPlayerSkin(playerid, pInfo[playerid][Skin]);
      return 1;
}
biker122 is offline   Reply With Quote
Old 30/05/2014, 04:54 PM   #6
Immortal_LTU
Big Clucker
 
Join Date: Feb 2011
Location: Lithuania
Posts: 120
Reputation: 1
Default Re: skin/xyz saving and loading with y_ini [need help]

Quote:
Originally Posted by biker122 View Post
If you want to make an auto spawn, check like this under login dialog(if successfully logged in)
pawn Code:
if(pInfo[playerid][Skin] != -1)
{
      SpawnPlayer(playerid);
      SetPlayerSkin(playerid, pInfo[playerid][Skin]);
      return 1;
}
So this way i can bypass the skin selection ?
Immortal_LTU is offline   Reply With Quote
Old 30/05/2014, 05:46 PM   #7
biker122
Gangsta
 
Join Date: Feb 2014
Posts: 766
Reputation: 59
Default Re: skin/xyz saving and loading with y_ini [need help]

Yeah, In my view, you can.
biker122 is offline   Reply With Quote
Old 31/05/2014, 07:54 AM   #8
Immortal_LTU
Big Clucker
 
Join Date: Feb 2011
Location: Lithuania
Posts: 120
Reputation: 1
Default Re: skin/xyz saving and loading with y_ini [need help]

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]);
Immortal_LTU is offline   Reply With Quote
Old 31/05/2014, 08:18 AM   #9
BroZeus
High-roller
 
BroZeus's Avatar
 
Join Date: Jan 2014
Location: India
Posts: 1,398
Reputation: 173
Default Re: skin/xyz saving and loading with y_ini [need help]

show your player enums
__________________


"Be the change that you wish to see in the world."

Check out my Github profile!
BroZeus is offline   Reply With Quote
Old 31/05/2014, 10:12 AM   #10
Immortal_LTU
Big Clucker
 
Join Date: Feb 2011
Location: Lithuania
Posts: 120
Reputation: 1
Default Re: skin/xyz saving and loading with y_ini [need help]

Quote:
Originally Posted by BroZeus View Post
show your player enums
Code:
enum pInfo
{
    pPass,
    pCash,
    Float:SX,
    Float:SY,
    Float:SZ,
    Skin
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Immortal_LTU is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Y_INI saving/loading problem Blademaster680 Scripting Help 5 23/05/2014 06:38 PM
YSI/y_ini Loading And Saving Playerfiles Brentbad04 Scripting Help 2 06/03/2014 09:03 PM
Problem with Y_INI saving and loading mSlat3r Scripting Help 15 07/11/2012 09:53 PM
Saving and loading with Y_ini StilThere Help Archive 0 03/06/2011 07:44 PM
Issue with y_ini skin loading OldDirtyBastard Help Archive 3 17/02/2011 04:43 PM


All times are GMT. The time now is 07:20 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.