db_get_field_assoc(qresult, "Label_ID", value, 5); // Label ID LabelInfo[i][LabelID] = strval(value); db_get_field_assoc(qresult, "Label_Text", value, 30); // Label Text LabelInfo[i][LabelText] = How to get the text :/
format(LabelInfo[i][LabelText], 64, value);
LabelInfo[i][LabelID] = db_get_field_assoc_int(qresult, "Label_ID"); // Label ID
db_get_field_assoc(qresult, "Label_Text", LabelInfo[i][LabelText], 30); // Label Text
Originally Posted by a_sampdb.inc
native db_get_field(DBResult:dbresult, field, result[], maxlength);
native db_get_field_int(DBResult:result, field = 0); native Float:db_get_field_float(DBResult:result, field = 0); native db_get_field_assoc(DBResult:dbresult, const field[], result[], maxlength); native db_get_field_assoc_int(DBResult:result, const field[]); native Float:db_get_field_assoc_float(DBResult:result, const field[]); |
COMMAND:clabel(playerid, params[]) { if(IsPlayerAdmin(playerid)) { new query[400], Float:x, Float:y, Float:z, text ; GetPlayerPos(playerid, x, y, z); if(sscanf(params, "s[30]", text)) { SendClientMessage(playerid, 0xFFFFFFFF, "{B7B7B7}[SERVER] {FFFFFF}Usage: \"clabel <Text>\""); } else { format(query, sizeof(query), "INSERT INTO `Label` (Label_Text, Label_X, Label_Y, Label_Z) VALUES ('%s', '%f', '%f', '%f')", text, x, y, z); db_query(DB: LabelDB, query); reloadLabels(); } } else { SendClientMessage(playerid, 0xFFFFFFFF, "{B7B7B7}[SERVER] {FFFFFF}You do not have permission to use that command."); } return 1; }
new query[400], Float:x, Float:y, Float:z, text // you forgot to add [30] here => text[30] ;
sscanf is unable to verify if the given variables matches the specified pattern
I think in your case it simply overwrote up to 29 cells before "text" in the stack because you declared "text" with only 1 cell Код:
new query[400], Float:x, Float:y, Float:z, text // you forgot to add [30] here => text[30] ; |