COMMAND:helplist(playerid, params[])
{
new query[420];
if(!Player[playerid][Admin] && !Player[playerid][Helper]) return SendClientError(playerid,"You are not authorized to use this command");
for(new i=1; i<100; i++)
{
format(query,sizeof(query),"SELECT * FROM helplist WHERE ID='%s' AND active='1'",i);
mysql_tquery(connection,query,"helpList","ud",playerid,i);
}
return 1;
}
forward helpList(playerid,helpid);
public helpList(playerid,helpid)
{
new string[420],temp_sentby[35],temp_wat[420];
cache_get_field_content(helpid, "sentby", temp_sentby);
cache_get_field_content(helpid, "wat", temp_wat);
format(string,sizeof(string),"{FFFFFF}[{6f757d}Help ID%d{FFFFFF}] {6f757d}%s{FFFFFF}: '{6f757d}%s{FFFFFF}'",helpid,temp_sentby,temp_wat);
SendClientMessage(playerid,-1,string);
return 1;
}
mysql_tquery(connection, "SELECT * FROM helplist WHERE active = 1", "helplist", "i", playerid); forward helplist(playerid); public helplist(playerid) { new rows = cache_num_rows(); if (!rows) return SendClientMessage(playerid, -1, "No active questions."); new id, temp_sentby[35], tmp_wat[144]; for (new i = 0; i < rows; i++) { id = cache_get_field_content_int(i, "ID"); cache_get_field_content(i, "sentby", temp_sentby); cache_get_field_content(i, "wat", temp_wat); format(temp_wat, sizeof (temp_wat), "{FFFFFF}[{6f757d}Help ID%d{FFFFFF}] {6f757d}%s{FFFFFF}:'{6f757d}%s{FFFFFF}'",id,temp_sentby,temp_wat); SendClientMessage(playerid, color, temp_wat); } return 1; }
"u" isn't an actual thing for callbacks, it only works in sscanf.
It should be i or d (integer) You shouldn't use a loop for that. Just use something like this: Код:
mysql_tquery(connection, "SELECT * FROM helplist WHERE active = 1", "helplist", "i", playerid); forward helplist(playerid); public helplist(playerid) { new rows = cache_num_rows(); if (!rows) return SendClientMessage(playerid, -1, "No active questions."); new id, temp_sentby[35], tmp_wat[144]; for (new i = 0; i < rows; i++) { id = cache_get_field_content_int(i, "ID"); cache_get_field_content(i, "sentby", temp_sentby); cache_get_field_content(i, "wat", temp_wat); format(temp_wat, sizeof (temp_wat), "{FFFFFF}[{6f757d}Help ID%d{FFFFFF}] {6f757d}%s{FFFFFF}:'{6f757d}%s{FFFFFF}'",id,temp_sentby,temp_wat); SendClientMessage(playerid, color, temp_wat); } return 1; } |
Do you get spammed with the same message? If not, post some of them.
Also, please post a picture or something of your table. |
Are you actually getting spammed? Or are you getting sent 2 messages?
Because in the post above you said this: When you actually have 2 questions 'active' |
[21:13:14] {FFFFFF}[{6f757d}Help ID: 1{FFFFFF}] {6f757d}xd{FFFFFF}:'{6f757d}{FFFFFF}' [21:13:14] {FFFFFF}[{6f757d}Help ID: 1{FFFFFF}] {6f757d}xd{FFFFFF}:'{6f757d}{FFFFFF}' [21:13:14] {FFFFFF}[{6f757d}Help ID: 1{FFFFFF}] {6f757d}xd{FFFFFF}:'{6f757d}{FFFFFF}' [21:13:14] {FFFFFF}[{6f757d}Help ID: 1{FFFFFF}] {6f757d}xd{FFFFFF}:'{6f757d}{FFFFFF}' [21:13:14] {FFFFFF}[{6f757d}Help ID: 1{FFFFFF}] {6f757d}xd{FFFFFF}:'{6f757d}{FFFFFF}' [21:13:14] {FFFFFF}[{6f757d}Help ID: 1{FFFFFF}] {6f757d}xd{FFFFFF}:'{6f757d}{FFFFFF}' [21:13:14] {FFFFFF}[{6f757d}Help ID: 1{FFFFFF}] {6f757d}xd{FFFFFF}:'{6f757d}{FFFFFF}' [21:13:14] {FFFFFF}[{6f757d}Help ID: 1{FFFFFF}] {6f757d}xd{FFFFFF}:'{6f757d}{FFFFFF}' [21:13:14] {FFFFFF}[{6f757d}Help ID: 1{FFFFFF}] {6f757d}xd{FFFFFF}:'{6f757d}{FFFFFF}' [21:13:14] {FFFFFF}[{6f757d}Help ID: 1{FFFFFF}] {6f757d}xd{FFFFFF}:'{6f757d}{FFFFFF}' [21:13:15] {FFFFFF}[{6f757d}Help ID: 1{FFFFFF}] {6f757d}xd{FFFFFF}:'{6f757d}{FFFFFF}'
format(temp_wat, sizeof (temp_wat), "%s{FFFFFF}[{6f757d}Help ID%d{FFFFFF}] {6f757d}%s{FFFFFF}:'{6f757d}%s{FFFFFF}'",temp_wat, id,temp_sentby,temp_wat); return SCM |