scriptinghelp - 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: scriptinghelp (
/showthread.php?tid=337342)
scriptinghelp -
Michael_Cuellar - 25.04.2012
how do I save players pos stats and skin?
Re: scriptinghelp -
WLSF - 25.04.2012
Paste bin link
pawn Код:
new Float:wii_X [ MAX_PLAYERS ],
Float:wii_Y [ MAX_PLAYERS ],
Float:wii_Z [ MAX_PLAYERS ],
Float:wii_A [ MAX_PLAYERS ],
wii_Interior [ MAX_PLAYERS ],
wii_VW [ MAX_PLAYERS ];
stock func_salvar ( k_ )
{
GetPlayerPos ( k_, wii_X [ k_ ], wii_Y [ k_ ], wii_Z [ k_ ] ) ;
GetPlayerFacingAngle ( k_, wii_A [ k_ ] ) ;
wii_Interior [ k_ ] = GetPlayerInterior ( k_ ) ;
wii_VW [ k_ ] = GetPlayerVirtualWorld ( k_ ) ;
new str [ 30 ] ;
format ( str, 30, "%s", func_name ( k_ ) ) ;
INI_Open(str);
INI_WriteFloat ( "Pos x", wii_X [ k_ ] ) ;
INI_WriteFloat ( "Pos y", wii_Y [ k_ ] ) ;
INI_WriteFloat ( "Pos z", wii_Z [ k_ ] ) ;
INI_WriteFloat ( "Pos angle", wii_A [ k_ ] ) ;
INI_WriteInt ( "Interior", wii_Interior [ k_ ] ) ;
INI_WriteInt ( "Virtual World", wii_VW [ k_ ] ) ;
INI_Save () ;
INI_Close () ;
printf ( "Acc name: %s saved with success", str, k_ ) ;
return 1 ;
}
stock func_carregar ( k_ )
{
new str [ 30 ] ;
format ( str, 30, "%s", func_name ( k_ ) ) ;
INI_Open ( str ) ;
wii_X [ k_ ] = INI_ReadFloat ( "Pos x" ) ;
wii_Y [ k_ ] = INI_ReadFloat ( "Pos y" ) ;
wii_Z [ k_ ] = INI_ReadFloat ( "Pos z" ) ;
wii_A [ k_ ] = INI_ReadFloat ( "Pos angle" ) ;
wii_Interior [ k_ ] = INI_ReadInt ( "Interior" ) ;
wii_VW [ k_ ] = INI_ReadInt ( "Virtual World" ) ;
INI_Save () ;
INI_Close () ;
if ( wii_Interior [ k_ ] > 0)
return SetPlayerInterior ( k_, wii_Interior [ k_ ] ) ;
if ( wii_VW [ k_ ] > 0)
return SetPlayerVirtualWorld ( k_, wii_VW [ k_ ] ) ;
SetPlayerPos ( k_, wii_X [ k_ ], wii_Y [ k_ ], wii_Z [ k_ ] ) ;
SetPlayerFacingAngle ( k_, wii_A [ k_ ] ) ;
printf ( "Acc name: %s loaded with success id: %d", str, k_ ) ;
return 1 ;
}
stock func_name ( k_ )
{
new str [ 30 ] ;
GetPlayerName ( k_, str, MAX_PLAYER_NAME ) ;
return str ;
}
I think it will be usefull for you. (Save pos)
Re: scriptinghelp -
Michael_Cuellar - 25.04.2012
just the firs part gives me a buttload of errors haha
Re: scriptinghelp -
Yuryfury - 25.04.2012
You will need to use a file saving system like YINI or DINI. Search for them on the forums. Dini is easier to start out with IMO.
This is a fairly old tutorial, but it is very helpful in showing you how to use dini
https://sampforum.blast.hk/showthread.php?tid=174575
Re: scriptinghelp -
Neo Karls - 25.04.2012
I think you are a beginner and thing you need you now is just a tutorial
https://sampforum.blast.hk/showthread.php?tid=299791
I think this will help you much..
Re: scriptinghelp -
WLSF - 26.04.2012
Quote:
Originally Posted by Michael_Cuellar
just the firs part gives me a buttload of errors haha
|
https://sampforum.blast.hk/showthread.php?tid=58458
Re: scriptinghelp -
Michael_Cuellar - 26.04.2012
What does that do
Re: scriptinghelp -
WLSF - 27.04.2012
Save your pos into a new file in 'scriptfiles'
pawn Код:
func_salvar ( playerid ) ; //it saves
func_carregar ( playerid ) ; //it loads