SA-MP Forums Archive
What do i do wrong? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: What do i do wrong? (/showthread.php?tid=206401)



What do i do wrong? - Stefans94 - 03.01.2011

So this should save also the positions when i log out
Код:
public OnPlayerDisconnect(playerid, reason)
{
	new Float:Angle, Float:x, Float:y, Float:z;
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if(gPlayerLogged[playerid] == 1)
    {
    	GetPlayerPos(playerid, x, y, z);
        dini_IntSet(file, "Score", GetPlayerScore(playerid));
        dini_IntSet(file, "Money", GetPlayerMoney(playerid));
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
        dini_IntSet(file, "PlayerFace", GetPlayerFacingAngle(playerid, Angle));
        dini_FloatSet(file, "PosX", x);
	dini_FloatSet(file, "PosY", y);
	dini_FloatSet(file, "PosZ", z);
	dini_IntSet(file, "Skin", GetPlayerSkin(playerid));
    }
    gPlayerLogged[playerid] = 0;
	return 1;
}
But when i log out, the positions don't change.. they stay at the default ones


Re: What do i do wrong? - Marty_Alex - 03.01.2011

new Float:Angle, Float, Float:y, Float:z;
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(gPlayerLogged[playerid] == 1)


Re: What do i do wrong? - Stefans94 - 04.01.2011

So, how to fix it?


Re: What do i do wrong? - alpha500delta - 04.01.2011

He just said lol


Re: What do i do wrong? - Stefans94 - 05.01.2011

i don't see any difference


Re: What do i do wrong? - Stefans94 - 06.01.2011

Does anyone else see any difference? O.o because i still don't know how to fix it


Re: What do i do wrong? - bartje01 - 06.01.2011

lol. to be honnest, I don't see any difference

anyway:

https://sampforum.blast.hk/showthread.php?tid=172862

The tutorial section will help you many times :P


Re: What do i do wrong? - Calgon - 06.01.2011

Try this:

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new
        name[MAX_PLAYER_NAME],
        file[256]; // Do you NEED 256 cells?
   
    GetPlayerName(playerid, name, sizeof(name));
   
    format(file, sizeof(file), SERVER_USER_FILE, name); // Does this even work for you?
   
    if(gPlayerLogged[playerid] == 1)
    {
        new
            Float: Angle,
            Float:x,
            Float:y,
            Float:z; // Re-organized these, neater..
           
        GetPlayerPos(playerid, x, y, z);
        GetPlayerFacingAngle(playerid, Angle); // This function returns the angle to the output float (Angle)
       
        dini_IntSet(file, "Score", GetPlayerScore(playerid));
        dini_IntSet(file, "Money", GetPlayerMoney(playerid));
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
        dini_IntSet(file, "PlayerFace", Angle);
        dini_FloatSet(file, "PosX", x);
        dini_FloatSet(file, "PosY", y);
        dini_FloatSet(file, "PosZ", z);
        dini_IntSet(file, "Skin", GetPlayerSkin(playerid));
    }
    gPlayerLogged[playerid] = 0;
    return 1;
}



Re: What do i do wrong? - Stefans94 - 06.01.2011

i just started scripting samp, so i'm not really good XD