31.07.2015, 14:03
Hi, i have a small problem , i'am doing a Phone SMS system, when player do /t sms got a list of the SMS that will be loaded from the database, but the problem is when i do /t sms they got too many SMS query's and will not stop and still spamming it and server wil lag.
PHP код:
ListPlayerSMS(playerid)
{
static
query[160];
format(query, sizeof(query), "SELECT * FROM `sms` WHERE `ReceivNumber` = %d", pInfo[playerid][pNumber]);
return mysql_tquery(dbHandle, query, "OnSMSFind", "d", playerid);
}
PHP код:
public OnSMSFind(playerid)
{
new desc[255], numbersender, string[1024];
new rows = cache_num_rows();
if(rows)
{
new loaded;
while(loaded < rows)
{
numbersender = cache_get_field_content_int(loaded, "SmsNumber");
cache_get_field_content(loaded, "Text", desc, 255);
format(string, sizeof(string), "%s SMS from : {2ECC71}%d : {FFFFFF}%s\n", string, numbersender, desc);
}
Dialog_Show(playerid, DialogSMS, DIALOG_STYLE_TABLIST,"My SMS",string,"Close","");
}
else return Server(playerid, "You don't have any SMS.");
return 1;
}