SA-MP Forums Archive
Mysql help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Mysql help (/showthread.php?tid=421708)



Mysql help - Vivaz - 10.03.2013

Hello all. I'am creating VIP system with time.
There is vip check code:
Код HTML:
stock VipCheck2(playerid)
{
format(jQuery, MAX_QUERY_LENGTH, "SELECT Vipas TIMESTAMPDIFF(MINUTE, NOW(), DATE_ADD(Timesta, INTERVAL Time MINUTE)) FROM vips WHERE Vipas = '%s' AND (NOW() <= DATE_ADD(Timesta, INTERVAL Time MINUTE) OR ban_time = 0)", pName(playerid));
mysql_query(jQuery);
mysql_store_result();
new vipas[MAX_PLAYER_NAME],vTime,vresult[1000];
  if(mysql_num_rows() < 1)
  {
   mysql_fetch_row(vresult);
   j_sscanf(vresult, "p|si", vipas, vTime);
   PlayerInfo[playerid][pVip] = false;
SendClientMessage(playerid, COLOR_RED,"Jus pasibaige vip galiojimas");
format(jQuery,MAX_QUERY_LENGTH,"DELETE FROM vips WHERE Vipas='%s'",pName(playerid));
mysql_query(jQuery);
}
return 1;
}
I create 1 minute timer and I put this code.
I put a 100 minutes, but after one minute my VIP is false...
Can anyone help me?


Re: Mysql help - Knappen - 10.03.2013

Why is vresult a 1000? How long is your query length by the way?


Re: Mysql help - Vivaz - 10.03.2013

Here is a simple version of the learning