Position is not saving after GMX
#1

Well most of my stats save after GMX but my position dont ..... I have tried a lot of things just none of them work


pawn Код:
CMD:restart(playerid, params[])
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
         GetPlayerPos(playerid,PlayerInfo[playerid][PosX],PlayerInfo[playerid][PosY],PlayerInfo[playerid][PosZ]);

         new INI:File = INI_Open(UserPath(playerid));
         INI_SetTag(File,"data");
         INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
         INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
         INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
         INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
         INI_WriteFloat(File,"PosX",PlayerInfo[playerid][PosX]);
         INI_WriteFloat(File,"PosY",PlayerInfo[playerid][PosY]);
         INI_WriteFloat(File,"PosZ",PlayerInfo[playerid][PosZ]);
         INI_WriteInt(File,"AdminLevel",PlayerData[playerid][AdminLevel]);
         INI_WriteString(File,"AdminName",PlayerData[playerid][AdminName]);
         INI_WriteInt(File,"AdminDuty",PlayerData[playerid][AdminDuty]);
         INI_WriteInt(File,"AdminSkin",PlayerData[playerid][AdminSkin]);
         INI_WriteInt(File,"OriginalSkin",PlayerData[playerid][OriginalSkin]);
         INI_WriteString(File,"OriginalName",PlayerData[playerid][OriginalName]);
         INI_Close(File);
       }
    }
    SendRconCommand("gmx");
    return 1;
}

pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{

    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Float("PosX",PlayerInfo[playerid][PosX]);
    INI_Float("PosY",PlayerInfo[playerid][PosY]);
    INI_Float("PosZ",PlayerInfo[playerid][PosZ]);
    INI_Int("AdminLevel",PlayerData[playerid][AdminLevel]);
    INI_String("AdminName",PlayerData[playerid][AdminName], 24);
    INI_Int("AdminDuty",PlayerData[playerid][AdminDuty]);
    INI_Int("AdminSkin",PlayerData[playerid][AdminSkin]);
    INI_Int("OriginalSkin",PlayerData[playerid][OriginalSkin]);
    INI_String("OriginalName",PlayerData[playerid][OriginalName], 24);

    return 1;
}
It saves every thing else a part from the coordinates


Thank You


Please Help Me Please
Reply
#2

Learn how to use loops correctly, the variable you are using to loop is " i " so in the command, change the playerid to i, and also kick all the players so they have to relog.
Reply
#3

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
Learn how to use loops correctly, the variable you are using to loop is " i " so in the command, change the playerid to i, and also kick all the players so they have to relog.
Yes, he's right.
You are looping, that means that you will count from ID 0 to the max ID, that it is 500. The loop will apply block code to all IDs, but you used playerid instead i, that means that you saved your data 500 times.
You gotta change playerid by i inside of the block code of the loop.
Do you understand me? Sorry for my bad english, I'm not very good at english and I'm not using translator, maybe I mistook in something.
Reply
#4

@[Vector]

He'll Learn from That,

+1

These Guy's Couldn't Of Said it Any Easier / Clearer.
You'll Need to learn About Loops, I've Added you on Skype, To Help With Further Inquires.
Reply
#5

I changed it to i but it did not work i made it so it kicks the players before the server restarts that works but is there any other way i can do it with out kicking them


Thank You


Please Help Me Please
Reply
#6

Please Help Me Please
Reply
#7

edit
pawn Код:
CMD:restart(playerid, params[])
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
         GetPlayerPos(playerid,PlayerInfo[playerid][PosX],PlayerInfo[playerid][PosY],PlayerInfo[playerid][PosZ]);

         new INI:File = INI_Open(UserPath(playerid));
         INI_SetTag(File,"data");
         INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
         INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
         INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
         INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
         INI_WriteFloat(File,"PosX",PlayerInfo[playerid][PosX]);
         INI_WriteFloat(File,"PosY",PlayerInfo[playerid][PosY]);
         INI_WriteFloat(File,"PosZ",PlayerInfo[playerid][PosZ]);
         INI_WriteInt(File,"AdminLevel",PlayerData[playerid][AdminLevel]);
         INI_WriteString(File,"AdminName",PlayerData[playerid][AdminName]);
         INI_WriteInt(File,"AdminDuty",PlayerData[playerid][AdminDuty]);
         INI_WriteInt(File,"AdminSkin",PlayerData[playerid][AdminSkin]);
         INI_WriteInt(File,"OriginalSkin",PlayerData[playerid][OriginalSkin]);
         INI_WriteString(File,"OriginalName",PlayerData[playerid][OriginalName]);
         INI_Close(File);
       }
    }
    SendRconCommand("gmx");
    return 1;
}
to


pawn Код:
CMD:restart(playerid, params[])
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
         GetPlayerPos(i,PlayerInfo[i][PosX],PlayerInfo[i][PosY],PlayerInfo[i][PosZ]);

         new INI:File = INI_Open(UserPath(i));
         INI_SetTag(File,"data");
         INI_WriteInt(File,"Cash",GetPlayerMoney(i));
         INI_WriteInt(File,"Admin",PlayerInfo[i][pAdmin]);
         INI_WriteInt(File,"Kills",PlayerInfo[i][pKills]);
         INI_WriteInt(File,"Deaths",PlayerInfo[i][pDeaths]);
         INI_WriteFloat(File,"PosX",PlayerInfo[i][PosX]);
         INI_WriteFloat(File,"PosY",PlayerInfo[i][PosY]);
         INI_WriteFloat(File,"PosZ",PlayerInfo[i][PosZ]);
         INI_WriteInt(File,"AdminLevel",PlayerData[i][AdminLevel]);
         INI_WriteString(File,"AdminName",PlayerData[i][AdminName]);
         INI_WriteInt(File,"AdminDuty",PlayerData[i][AdminDuty]);
         INI_WriteInt(File,"AdminSkin",PlayerData[i][AdminSkin]);
         INI_WriteInt(File,"OriginalSkin",PlayerData[i][OriginalSkin]);
         INI_WriteString(File,"OriginalName",PlayerData[i][OriginalName]);
         INI_Close(File);
       }
    }
    SendRconCommand("gmx");
    return 1;
}
Reply
#8

Quote:
Originally Posted by TheArcher
Посмотреть сообщение
edit
pawn Код:
CMD:restart(playerid, params[])
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
         GetPlayerPos(playerid,PlayerInfo[playerid][PosX],PlayerInfo[playerid][PosY],PlayerInfo[playerid][PosZ]);

         new INI:File = INI_Open(UserPath(playerid));
         INI_SetTag(File,"data");
         INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
         INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
         INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
         INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
         INI_WriteFloat(File,"PosX",PlayerInfo[playerid][PosX]);
         INI_WriteFloat(File,"PosY",PlayerInfo[playerid][PosY]);
         INI_WriteFloat(File,"PosZ",PlayerInfo[playerid][PosZ]);
         INI_WriteInt(File,"AdminLevel",PlayerData[playerid][AdminLevel]);
         INI_WriteString(File,"AdminName",PlayerData[playerid][AdminName]);
         INI_WriteInt(File,"AdminDuty",PlayerData[playerid][AdminDuty]);
         INI_WriteInt(File,"AdminSkin",PlayerData[playerid][AdminSkin]);
         INI_WriteInt(File,"OriginalSkin",PlayerData[playerid][OriginalSkin]);
         INI_WriteString(File,"OriginalName",PlayerData[playerid][OriginalName]);
         INI_Close(File);
       }
    }
    SendRconCommand("gmx");
    return 1;
}
to


pawn Код:
CMD:restart(playerid, params[])
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
         GetPlayerPos(i,PlayerInfo[i][PosX],PlayerInfo[i][PosY],PlayerInfo[i][PosZ]);

         new INI:File = INI_Open(UserPath(i));
         INI_SetTag(File,"data");
         INI_WriteInt(File,"Cash",GetPlayerMoney(i));
         INI_WriteInt(File,"Admin",PlayerInfo[i][pAdmin]);
         INI_WriteInt(File,"Kills",PlayerInfo[i][pKills]);
         INI_WriteInt(File,"Deaths",PlayerInfo[i][pDeaths]);
         INI_WriteFloat(File,"PosX",PlayerInfo[i][PosX]);
         INI_WriteFloat(File,"PosY",PlayerInfo[i][PosY]);
         INI_WriteFloat(File,"PosZ",PlayerInfo[i][PosZ]);
         INI_WriteInt(File,"AdminLevel",PlayerData[i][AdminLevel]);
         INI_WriteString(File,"AdminName",PlayerData[i][AdminName]);
         INI_WriteInt(File,"AdminDuty",PlayerData[i][AdminDuty]);
         INI_WriteInt(File,"AdminSkin",PlayerData[i][AdminSkin]);
         INI_WriteInt(File,"OriginalSkin",PlayerData[i][OriginalSkin]);
         INI_WriteString(File,"OriginalName",PlayerData[i][OriginalName]);
         INI_Close(File);
       }
    }
    SendRconCommand("gmx");
    return 1;
}
I have done that it still dont work


Thank You


Please Help Me Please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)