scriptinghelp
#1

how do I save players pos stats and skin?
Reply
#2

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

just the firs part gives me a buttload of errors haha
Reply
#4

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

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..
Reply
#6

Quote:
Originally Posted by Michael_Cuellar
Посмотреть сообщение
just the firs part gives me a buttload of errors haha
pawn Код:
#include <SII>
https://sampforum.blast.hk/showthread.php?tid=58458
Reply
#7

What does that do
Reply
#8

Save your pos into a new file in 'scriptfiles'

pawn Код:
func_salvar ( playerid ) ; //it saves
func_carregar ( playerid ) ; //it loads
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)