SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 31/05/2014, 10:24 AM   #11
Rittik
Huge Clucker
 
Rittik's Avatar
 
Join Date: May 2014
Location: github.com/RittikVerma
Posts: 450
Reputation: 33
Default Re: skin/xyz saving and loading with y_ini [need help]

Code:
if(PlayerInfo[playerid][Skin] != -1)
{
      SpawnPlayer(playerid);
      SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);
      return 1;
}
Rittik is offline   Reply With Quote
Old 31/05/2014, 10:31 AM   #12
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 Rittik View Post
Code:
if(PlayerInfo[playerid][Skin] != -1)
{
      SpawnPlayer(playerid);
      SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);
      return 1;
}
The code itself is good , but i have 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, 10:33 AM   #13
biker122
Gangsta
 
Join Date: Feb 2014
Posts: 766
Reputation: 59
Default Re: skin/xyz saving and loading with y_ini [need help]

Edited it.

Inside your player enum (Put this in the middle, if you put this in the last, remove the "," at the last variable)
pawn Code:
GetPlayerPos(playerid, PlayerInfo[playerid][SX], PlayerInfo[playerid][SY], PlayerInfo[playerid][SZ]);
INI_WriteFloat(File, "XPos", PlayerInfo[playerid][SX]);
INI_WriteFloat(File, "YPos", PlayerInfo[playerid][SY]);
INI_WriteFloat(File, "ZPos", PlayerInfo[playerid][SZ]);
INI_WriteInt(File, "Skin", GetPlayerSkin(playerid));

under OnPlayerDisconnect (Where you save player's stats while disconnecting)
pawn Code:
INI_Float("XPos", PlayerInfo[playerid][XPos]);
INI_Float("YPos", PlayerInfo[playerid][YPos]);
INI_Float("ZPos", PlayerInfo[playerid][ZPos]);
INI_Int("Skin", PlayerInfo[playerid][Skin]);

and on "LoadUser_data" function or whatever.
pawn Code:
SetPlayerPos(playerid, PlayerInfo[playerid][XPos], PlayerInfo[playerid][YPos], PlayerInfo[playerid][ZPos]);
SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);



Auto spawn - Put this inside your Login Dialog:
pawn Code:
if(PlayerInfo[playerid][Skin] != -1)
{
      SpawnPlayer(playerid);
      SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);
      return 1;
}

Last edited by biker122; 31/05/2014 at 10:34 AM. Reason: EDIT MY OLD CODE AND REPLACE THIS WITH IT
biker122 is offline   Reply With Quote
Old 31/05/2014, 10:40 AM   #14
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]

GetPlayerPos(playerid, PlayerInfo[playerid][SX], PlayerInfo[playerid][SY], PlayerInfo[playerid][SZ]);
INI_WriteFloat(File, "XPos", PlayerInfo[playerid][SX]);
INI_WriteFloat(File, "YPos", PlayerInfo[playerid][SY]);
INI_WriteFloat(File, "ZPos", PlayerInfo[playerid][SZ]);
INI_WriteInt(File, "Skin", GetPlayerSkin(playerid));



I dont get this part , i'm putting it in my player variables but it gives me a bunch of errors .
Immortal_LTU is offline   Reply With Quote
Old 31/05/2014, 10:59 AM   #15
biker122
Gangsta
 
Join Date: Feb 2014
Posts: 766
Reputation: 59
Default Re: skin/xyz saving and loading with y_ini [need help]

You should put that on OnPlayerDisconnect
biker122 is offline   Reply With Quote
Old 31/05/2014, 11:01 AM   #16
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:
Inside your player enum (Put this in the middle, if you put this in the last, remove the "," at the last variable)
pawn Code:
GetPlayerPos(playerid, PlayerInfo[playerid][SX], PlayerInfo[playerid][SY], PlayerInfo[playerid][SZ]);
INI_WriteFloat(File, "XPos", PlayerInfo[playerid][SX]);
INI_WriteFloat(File, "YPos", PlayerInfo[playerid][SY]);
INI_WriteFloat(File, "ZPos", PlayerInfo[playerid][SZ]);
INI_WriteInt(File, "Skin", GetPlayerSkin(playerid));

under OnPlayerDisconnect (Where you save player's stats while disconnecting)
pawn Code:
INI_Float("XPos", PlayerInfo[playerid][XPos]);
INI_Float("YPos", PlayerInfo[playerid][YPos]);
INI_Float("ZPos", PlayerInfo[playerid][ZPos]);
INI_Int("Skin", PlayerInfo[playerid][Skin]);
I think this is a problem , so i should put this 2 scripts in onplayerdisconnect callback , as you said .
Immortal_LTU is offline   Reply With Quote
Old 31/05/2014, 11:22 AM   #17
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]

I'm just confused ... -_-
Immortal_LTU is offline   Reply With Quote
Old 18/06/2014, 09:17 AM   #18
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]

UP .19 days passed .... still cant fix it
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 01:07 PM.


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