[POMOC] SavePlayerPos kad se Reloguje


Započeo NiKTa, Februar 16, 2013, 22:23:33 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim:  U Pitanju je EuroProGaming RolePlay http://balkan-samp.com/forum/index.php?topic=59072.0
Detaljan opis problema: Ovako,pokusavam da napravim da se pozcija igraca sejvira kad izadje sa servera, pa onda kad udje da se stvori tu.Meni radi sejviranje pozicije,ali drugi igrac koji udje kad ja izadjem stvori se na mojoj poziciji (Evo Primera:)
Igrac Pica_Num  ID:0 ulazi na server i izlazi i pozicja mu se sejvira.
Igrac Kosta_Bot ID:0 ulazi na server i stvara se na poziciji Pica_Numa.!


Dio skripte://
Neke slike/video za lakse dobivanje pomoci(neobavezno)://

Blaeks

*

Madmen

ti si to sredio izgleda preko IDa 0 na sve igrace, zbagao si , radi sa playerid, ne sa foreachom

#include <a_samp>
#include <YSI\y_ini>

new
    Float: PosX[ MAX_PLAYERS ],
    Float: PosY[ MAX_PLAYERS ],
    Float: PosZ[ MAX_PLAYERS ],
    Float: Angle[ MAX_PLAYERS ],
    Interior[ MAX_PLAYERS ],
    VirtualWorld[ MAX_PLAYERS ]
;

stock user_ini_file(playerid)
{
    new
        string[ 128 ],
        user_name[ MAX_PLAYER_NAME ]
    ;

    GetPlayerName( playerid, user_name, MAX_PLAYER_NAME );
    format( string, sizeof ( string ), "%s.ini", user_name );
    /* scriptfiles directory */
    return
        string;
}

forward @load_user_position( playerid, name[], value[] );

@load_user_position( playerid, name[], value[] )
{
    INI_Float( "PositionX", PosX[ playerid ] );
    INI_Float( "PositionY", PosY[ playerid ] );
    INI_Float( "PositionZ", PosZ[ playerid ] );
    INI_Float( "Angle", Angle[ playerid ] );
    INI_Int( "Interior", Interior[ playerid ] );
    INI_Int( "VirtualWorld", VirtualWorld[ playerid ] );
    return ( 1 );
}

public OnPlayerDisconnect( playerid, reason )
{
    GetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
    GetPlayerFacingAngle( playerid, Angle[ playerid ] );

    new INI:File = INI_Open( user_ini_file( playerid ) );
    INI_SetTag( File, "position" );
    INI_WriteFloat( File, "PositionX", PosX[ playerid ] );
    INI_WriteFloat( File, "PositionY", PosY[ playerid ] );
    INI_WriteFloat( File, "PositionZ", PosZ[ playerid ] );
    INI_WriteFloat( File, "Angle", Angle[ playerid ] );
    INI_WriteInt( File, "Interior", GetPlayerInterior( playerid ) );
    INI_WriteInt( File, "VirtualWorld", GetPlayerVirtualWorld( playerid ) );
    INI_Close( File );
    return ( 1 );
}

public OnPlayerConnect( playerid )
{
    PosX[ playerid ] = 0;
    PosY[ playerid ] = 0;
    PosZ[ playerid ] = 0;
    Angle[ playerid ] = 0;
    Interior[ playerid ] = 0;
    VirtualWorld[ playerid ] = 0;

    INI_ParseFile( user_ini_file( playerid ), "load_user_%s", .bExtra = true, .extra = playerid );
    return ( 1 );
}


public OnPlayerSpawn( playerid )
{
    if ( PosX[ playerid ] != 0 && PosY[ playerid ] != 0 && PosZ[ playerid ] != 0 )
    {
        SetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
        SetPlayerFacingAngle( playerid, Angle[ playerid ] );
        SetPlayerInterior( playerid, Interior[ playerid ] );
        SetPlayerVirtualWorld( playerid, VirtualWorld[ playerid ] );
        SendClientMessage( playerid, -1, "welcome to your last position" );
    }
    return ( 1 );
}


Evo Pogledaj koliko ja vidim radjeno je sa playerid

Molim vas treba mi jako je bitno za server izvinjavam se za BUMP ali jako mi je bitno

Bleaks ae molim te pomozi ovo je za tebe maciji kasalj milm te radi u Dini

Blaeks

*

Madmen

zasto komplikujes ovakav sistem cuvanja kada mozes to sa jednom varijablom?

pod onplayerdisconect
INI_WriteFloat(File,"PosX",x);
    INI_WriteFloat(File,"PosY",y);
    INI_WriteFloat(File,"PosZ",z);

pod loaduser_....
INI_Int("PosX",PlayerInfo[playerid][pX]);
    INI_Int("PosY",PlayerInfo[playerid][pY]);
    INI_Int("PosZ",PlayerInfo[playerid][pZ]);


pod enum pInfo
pX,
    pY,
    pZ,


i pod onplayerspawn stavis ovo

               
new x = PlayerInfo[playerid][pX];
		new y = PlayerInfo[playerid][pY];
		new z = PlayerInfo[playerid][pZ];
		SetPlayerPos(playerid, x,y,z);


sad naravno ako imasu onplayerspawn pjailed pod if ovo stavljas ovo pod else ako je slobodan ..

Hvala Dimi probacu pa cu postati da li radi posto sam sad na mobu

Citat: NiKTa poslato Februar 18, 2013, 10:43:26 PRE PODNE
Hvala Dimi probacu pa cu postati da li radi posto sam sad na mobu

probao ne probao radi 100 posto :P Ja sam to odradio i sljaka :)

Ok ok hvala legendo nego samo posto je ova skripta sjebana a ja ocu da je uredim
ima nesto Setplayerspawn i to pa cu videti ja bi vole da radi :)

Blaeks

*

Madmen

nisi morao tako, no svejedno, ukoliko ovo radi, javi mi na PM da mogu da lock

Ne radi mozda je do toga posto u sripti nista nije radjeno u YSI ja ti kazem bolje pogledaj skriptu pa mi reci kako jer kad bi video mozda bi mi tacno rekao inace dobijam ove erore
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\pawno\include\YSI\y_amx.inc(365) : warning 219: local variable "base" shadows a variable at a preceding level
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\pawno\include\YSI\y_amx.inc(413) : warning 219: local variable "base" shadows a variable at a preceding level
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\pawno\include\YSI\y_amx.inc(648) : warning 219: local variable "base" shadows a variable at a preceding level
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\pawno\include\YSI\y_ini.inc(1342) : warning 219: local variable "temp" shadows a variable at a preceding level
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(270) : error 017: undefined symbol "PlayerInfo"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(271) : error 017: undefined symbol "PlayerInfo"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(272) : error 017: undefined symbol "PlayerInfo"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(2851) : error 001: expected token: "}", but found "-identifier-"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(3008) : error 010: invalid function or declaration
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4314) : error 017: undefined symbol "pSpol"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4315) : error 017: undefined symbol "pSpol"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4316) : error 017: undefined symbol "pGodine"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4317) : error 017: undefined symbol "pPnumber"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4325) : error 017: undefined symbol "pPhoneBook"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4348) : error 017: undefined symbol "pHeadValue"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4356) : error 017: undefined symbol "pMember"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4360) : error 017: undefined symbol "pHeadValue"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4507) : error 017: undefined symbol "pPrikazaniStatsi"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4508) : error 017: undefined symbol "pStats2"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4509) : error 017: undefined symbol "pStats3"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4510) : error 017: undefined symbol "pStats4"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4628) : error 017: undefined symbol "pLevel"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4655) : error 017: undefined symbol "pLeader"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4666) : error 017: undefined symbol "pLeader"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4677) : error 017: undefined symbol "pLeader"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4687) : error 017: undefined symbol "pMember"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4692) : error 017: undefined symbol "pLeader"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4702) : error 017: undefined symbol "pLeader"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4703) : error 017: undefined symbol "pMember"
C:\Documents and Settings\Nikola\Desktop\SAMP 0.3x\gamemodes\BURP2.pwn(4720) : error 017: undefined symbol "pLeader"

I Bleaks Oces li molim te da mi pokazes tvoj nacin????

Ako.ti je dini prebaci u dini ....taj princip radi sto posto

Ae ae kad te molim a poskusaj ako hoces da skines skriptu i uradis pa da mi kazes? eno stavio sam je u prvom postu tamo gde sam objasnjavao....posto nz kako da prebacim
Poslednja Izmena: Februar 18, 2013, 17:44:32 POSLE PODNE od NiKTa