09.11.2013, 13:49
I'm doing it to check if the player is vip.
The tables is empty, but he always returns 1.
If someone can help me, thank you very much!
pawn Код:
new Stra[94], Nome[21];
GetPlayerName(playerid,Nome,21);
format(Stra, 94, "SELECT `Nome`, `Quantidade`, `TempoExpire` FROM `viplist` WHERE `Nome`='%s'", Nome);
mysql_function_query(Connect, Stra, true, "CheckVip", "i",playerid);
CheckVip(playerid);
pawn Код:
forward CheckVip(playerid);
public CheckVip(playerid)
{
new row, field, temp[25], quantidade, TempExpire;
cache_get_data(row,field, Connect);
if(row==1)
{//Are Always running here. but in mysql table But in mysql table, there is nothing. is empty
cache_get_row(0, 1, temp), quantidade = strval(temp);
cache_get_row(0, 2, temp), TempExpire = strval(temp);
new calculo = (2592000 * quantidade) + TempExpire;
if(calculo < gettime())
{
new Nome[21];
GetPlayerName(playerid,Nome,21);
SendClientMessage(playerid, -1,"");
SendClientMessage(playerid, -1,"Sua conta vip venceu, renove-a para continuar com seus benefнcios!");
new Str[51];
format(Str,51,"DELETE FROM `viplist` WHERE `Nome`='%s'",Nome);
mysql_function_query(Connect, Str, false, "", "");
return 1;
}
else
{
if (PlayerInfo[playerid][pVIP] == 1)
{
SendClientMessage(playerid, COR_VIP,"{C6E2FF}{FFFFFF}[{00FF00}B{f3f300}V{909090}S{FFFFFF}]{CCCCFF} : Vocк e jogador [VIP-PRATA]");
}
else if (PlayerInfo[playerid][pVIP] == 2)
{
SendClientMessage(playerid, COR_VIP,"{FFF68F}{FFFFFF}[{00FF00}B{f3f300}V{909090}S{FFFFFF}]{CCCCFF} : Vocк e jogador [VIP-OURO]");
}
else if (PlayerInfo[playerid][pVIP] == 3)
{
SendClientMessage(playerid, COR_VIP,"{97FFFF}{FFFFFF}[{00FF00}B{f3f300}V{909090}S{FFFFFF}]{CCCCFF} : Vocк e jogador [VIP-Sуcio]");
}
else if (PlayerInfo[playerid][pVIP] == 4)
{
SendClientMessage(playerid, COR_VIP,"{97FFFF}{FFFFFF}[{00FF00}B{f3f300}V{909090}S{FFFFFF}]{CCCCFF} : Vocк e jogador [Sуcio-Diamante]");
}
}
}
else
{
}
return 1;
}
If someone can help me, thank you very much!