19.05.2013, 18:25
I've just started my donator system and i've made it so it checks if the player is vip or not when they spawn, If they're vip it then checks the expiration date and removes them from the donators list after the 30 days has gone, But if they're still vip with lets say 25 days left i wan't it to show they've got 25 days left and i've coded it that way but for some reason it isn't showing up.
Let me add, Its inserting into the database table correctly with the correct date and expiration date.
Code:
Let me add, Its inserting into the database table correctly with the correct date and expiration date.
Code:
pawn Код:
- OnPlayerSpawn -
CheckAccountDonator(playerid);
-Checking -
stock CheckAccountDonator(playerid)
{
new bExpiration;
format(Query, sizeof(Query), "SELECT * FROM `Donators` WHERE (Username = '%s') AND status = 1", GetPName(playerid), GetIP(playerid));
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() >= 1)
{
while(mysql_fetch_row_format(Query,"|"))
{
mysql_fetch_field_row(Query, "Expiration"); bExpiration = strval(Query);
if(bExpiration > 0)
{
if(gettime() >= bExpiration)
{
format(Query, sizeof(Query), "DELETE FROM `Donators` WHERE Username = %s", GetPName(playerid));
mysql_query(Query);
SendClientMessage(playerid,-1,"Your time as a Donator has run out and you've been removed from donator status");
pData[playerid][DonatorLevel] = 0;
}
else
{
new string[100];
format(string, sizeof(string),"Welcome Back, %s you've got %d days level as a donator",(bExpiration-gettime())/2592000);
SendClientMessage(playerid,-1,string);
}
}
}
return 1;
}
return 0;
}