[SQLite] Factions wont change name - 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: [SQLite] Factions wont change name (
/showthread.php?tid=534179)
[SQLite] Factions wont change name -
JordanDoughty - 28.08.2014
Hi!
so the faction names in the .db were as such:
LSPD
LSFMD
FBI
then when I did the command /editfaction, typed in faction id 1 (LSPD) and changed name
they turned into some weird line.
pawn Код:
case EDITFACTION_NAME:
{
new string[256];
if(!response)
{
SendClientMessage(playerid, -1, "Your no longer going to edit a faction.");
return 1;
}
else {
new value = PlayerInfo[playerid][EditFaction];
format(string, sizeof(string), "UPDATE `Groups` SET `Name`='%s' WHERE `GroupID`='%i'", strval(inputtext), value);
db_free_result(db_query(Database, string));
printf("Faction name: %s:", value);
ReloadFactions();
/*format(string, sizeof(string), "Your entering faction ID: %s", inputtext);
SendClientMessage(playerid, -1, string);
PlayerInfo[playerid][EditFaction] = strval(inputtext);*/
}
}
Re: [SQLite] Factions wont change name -
JordanDoughty - 28.08.2014
anyone help me here?
Re : [SQLite] Factions wont change name -
MisterMania67 - 28.08.2014
pawn Код:
format(string, sizeof(string), "UPDATE `Groups` SET `Name`='%s' WHERE `GroupID`='%i'", strval(inputtext), value);
`Name`='%s' is a string and you use strval.
The right query:
pawn Код:
format(string, sizeof(string), "UPDATE `Groups` SET `Name`='%s' WHERE `GroupID`='%i'", inputtext, value);
And here, value is integer, not a string.
pawn Код:
printf("Faction name: %s:", value);
Re: [SQLite] Factions wont change name -
JordanDoughty - 28.08.2014
pawn Код:
case EDITFACTION_FACID:
{
new string[256];
if(!response)
{
SendClientMessage(playerid, -1, "Your no longer going to edit a faction.");
return 1;
}
else {
if(strval(inputtext) < 0 || strval(inputtext) > 9) return SendClientMessage(playerid, -1, "SERVER: Invalid Faction ID.");
format(string, sizeof(string), "Your entering faction ID: %s", inputtext);
SendClientMessage(playerid, -1, string);
PlayerInfo[playerid][EditFaction] = strval(inputtext);
ShowPlayerDialog(playerid, EDITFACTION_OPTIONS, DIALOG_STYLE_LIST, "Select a Option", "Name", "Select", "Quit");
}
}
This is the code, Why when I select faction id 4 it edits faction id 3?
Re: [SQLite] Factions wont change name -
MattTucker - 28.08.2014
Can you post the part when you get input from the player/user?