[SQLite] Factions wont change name
#1

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);*/

            }
        }
Reply
#2

anyone help me here?
Reply
#3

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);
Reply
#4

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?
Reply
#5

Can you post the part when you get input from the player/user?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)