12.11.2018, 22:17
First, you should end your command till here:
Because you don't have the color for the faction yet, so your INSERT query may not be right. The INSERT query part should be done under "DIALOG_FACTION_COLOR".
I don't know if SAMP's SQLite is up-to-date for running this "last_insert_rowid()" but apart from that query looks wrong (i have to say i haven't quiet used SQLite in a while), there is no table name mentioned in your query so i guess it will give you a syntax error!
Here's how i would do it:
pawn Код:
ShowPlayerDialog(playerid,DIALOG_FACTION_COLOR,DIALOG_STYLE_LIST,"Faction Color",""BLUE"Blue\n"RED"RED\n"WHITE"White\n"PINK"Pink\n"CYAN"Cyan\n"ORANGE"Orange\n"GREEN"Green\n"YELLOW"Yellow","Select","Cancel");
I don't know if SAMP's SQLite is up-to-date for running this "last_insert_rowid()" but apart from that query looks wrong (i have to say i haven't quiet used SQLite in a while), there is no table name mentioned in your query so i guess it will give you a syntax error!
Here's how i would do it:
pawn Код:
format(Query, sizeof(Query), "SELECT id FROM Factions WHERE FactionName = '%q' LIMIT 1", FactionInfo[playerid][factionname]);
result = db_query(Database, Query);
if (result == DBResult:0 || db_num_rows(result) == 0) {
// INSERT statement didn't work so the faction wasn't created
return 1;
}
FactionInfo[playerid][factionid] = db_get_field_int(result);
db_free_result(result);

