What do i do wrong?
#1

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

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

So, how to fix it?
Reply
#4

He just said lol
Reply
#5

i don't see any difference
Reply
#6

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

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

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;
}
Reply
#9

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


Forum Jump:


Users browsing this thread: 5 Guest(s)