Jump to content
  • 0

Problema salvare variabila


LeetRomania

Question

Salutare. As dori sa fac un system de secunde jucate pe server. Problema este ca daca un player se deconecteaza de pe server variabila se seteaza 0.

Am variabila: pSeconds;

Am facut ca la fiecare secunda sa se adauge cate o secunda in plus.

Exemplu:

if(IsPlayerAFK[x] < 60)
{
  playerVariables[x][pSeconds] ++;
}

La OnPlayerDisconnect am pus ceva de genul:

Update(playerid, pSecondsx);

As dori sa imi explicati de ce nu se salveaza in baza de date cate secunde a adunat playerul pe server.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Deci este definit:

#define pSecondsx

pe urma am acest public:


 

forward Update(playerid, type);
public Update(playerid, type)
{
    if(IsPlayerConnected(playerid))
    {
        new var[256];
        new playerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playerName, sizeof(playerName));
        {
            switch(type)
            {

                case pSecondsx:
				{
					format(var, sizeof(var), "UPDATE `players` SET `Seconds`='%d' WHERE `username`='%s'", playerVariables[playerid][pSeconds], playerName);
					mysql_query(handle ,var);
				}

            }
        }
    }
}

 

Edited by LeetRomania
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.