10.08.2015, 11:08
This is not working anymore:
After I added this :
Each have a timer, updatemoney have 1 sec timer, and xp have 1 min timer
PHP код:
public updatemoney()
{
foreach(Player, i)
{
if(gLogged[i] == 1){
P_Data[i][pCash] = GetPlayerMoney(i);
new query[256];
mysql_format(handle, query, sizeof(query), "UPDATE `conturi` SET `Cash`='%d', 'Level'='%d', 'Skin'='%d' WHERE `Nume`='%s'", P_Data[i][pCash], P_Data[i][pLevel],P_Data[i][pSkin],GetName(i));// facem update-ul la baza de date
mysql_query(handle, query);
}
}
return 1;
}
PHP код:
public xp()
{
foreach(Player, i)
{
new query[256], maxp;
P_Data[i][pXP] = P_Data[i][pXP] + 1;
mysql_format(handle, query, sizeof(query), "UPDATE `conturi` SET `XP`='%d' WHERE `Nume`='%s'", P_Data[i][pXP],GetName(i));
mysql_query(handle, query);
if(P_Data[i][pLevel] == 1)
{
maxp = 60;
P_Data[i][pXPm] = maxp;
if(P_Data[i][pXP] >= maxp)
{
P_Data[i][pXP] = 0;
P_Data[i][pLevel] = P_Data[i][pLevel] + 1;
}
}
if(P_Data[i][pLevel] == 2)
{
maxp = 120;
P_Data[i][pXPm] = maxp;
if(P_Data[i][pXP] >= maxp)
{
P_Data[i][pXP] = 0;
P_Data[i][pLevel] = P_Data[i][pLevel] + 1;
}
}
if(P_Data[i][pLevel] == 3)
{
maxp = 300;
P_Data[i][pXPm] = maxp;
if(P_Data[i][pXP] >= maxp)
{
P_Data[i][pXP] = 0;
P_Data[i][pLevel] = P_Data[i][pLevel] + 1;
}
}
if(P_Data[i][pLevel] == 4)
{
maxp = 600;
P_Data[i][pXPm] = maxp;
if(P_Data[i][pXP] >= maxp)
{
P_Data[i][pXP] = 0;
P_Data[i][pLevel] = P_Data[i][pLevel] + 1;
}
}
if(P_Data[i][pLevel] == 5)
{
maxp = 800;
P_Data[i][pXPm] = maxp;
if(P_Data[i][pXP] >= maxp)
{
P_Data[i][pXP] = 0;
P_Data[i][pLevel] = P_Data[i][pLevel] + 1;
}
}
if(P_Data[i][pLevel] == 6)
{
maxp = 900;
P_Data[i][pXPm] = maxp;
if(P_Data[i][pXP] >= maxp)
{
P_Data[i][pXP] = 0;
P_Data[i][pLevel] = P_Data[i][pLevel] + 1;
}
}
if(P_Data[i][pLevel] == 7)
{
maxp = 1120;
P_Data[i][pXPm] = maxp;
if(P_Data[i][pXP] >= maxp)
{
P_Data[i][pXP] = 0;
P_Data[i][pLevel] = P_Data[i][pLevel] + 1;
}
}
if(P_Data[i][pLevel] == 8)
{
maxp = 1210;
P_Data[i][pXPm] = maxp;
if(P_Data[i][pXP] >= maxp)
{
P_Data[i][pXP] = 0;
P_Data[i][pLevel] = P_Data[i][pLevel] + 1;
}
}
if(P_Data[i][pLevel] == 9)
{
maxp = 1500;
P_Data[i][pXPm] = maxp;
if(P_Data[i][pXP] >= maxp)
{
P_Data[i][pXP] = 0;
P_Data[i][pLevel] = P_Data[i][pLevel] + 1;
}
}
if(P_Data[i][pLevel] == 10)
{
maxp = 1800;
P_Data[i][pXPm] = maxp;
if(P_Data[i][pXP] >= maxp)
{
P_Data[i][pXP] = 0;
P_Data[i][pLevel] = P_Data[i][pLevel] + 1;
}
}
}
}