Problem with Mysql instert
#1

Hello,

Well I noticed in My database that when I join a faction it sets the FactionRankName correctly but it makes my country from The Netherlands to TChief....
How can that happen?
If you need to see parts of the script tell me then I will post them.

Also when I use a command like /hire or /setfactionleader it sets a prison time, like WTF?

pawn Код:
command(hire, playerid, params[])
{
    new id, string[128];
    if(sscanf(params, "d", id))
    {
        if(Player[playerid][FactionRank] == 7)
        {
            SendClientMessage(playerid, WHITE, "SYNTAX: /hire [Playerid]");
        }
        else
        {
            TextDrawShowForPlayer(playerid, Text:CantCommand);
            SetTimerEx("RemoveCantCommand", 3500, false, "d", playerid);
        }
    }
    else
    {
        if(Player[playerid][FactionRank] == 7)
        {
            if(Player[id][Faction] == 0)
            {
                Player[id][Faction] = Player[playerid][Faction];
                Player[id][FactionRank] = 1;
                format(string, sizeof(string), "%s has hired you to work for %s.", RPName(playerid), Factions[Player[playerid][Faction]][FactionName]);
                SendClientMessage(id, ADMINBLUE, string);
                format(string, sizeof(string), "You hired %s.", RPName(id));
                SendClientMessage(playerid, WHITE, string);
                format(Player[id][FactionRankName], 255, "%s", Factions[Player[playerid][Faction]][RankName1]);
            }
            else
            {
                SCM(playerid, WARNRED, "This player has already a job");
            }
        }
        SavePlayerData(id);
    }
    return 1;
}

command(setfactionleader, playerid, params[])
{
    new GroupID, id, string[128], query[500];
    if(sscanf(params, "ud", id, GroupID))
    {
        if(Player[playerid][Adminlevel] >= 6)
        {
            SendClientMessage(playerid, WHITE, "SYNTAX: /setfactionleader [playerid] [faction id]");
        }
        else
        {
            TextDrawShowForPlayer(playerid, Text:CantCommand);
            SetTimerEx("RemoveCantCommand", 3500, false, "d", playerid);
        }
    }
    else
    {
        if(Player[playerid][Adminlevel] >= 6)
        {
            format(string, sizeof(string), "You have set %s to be the leader of Faction %s.", RPName(id), Factions[GroupID][FactionName]);
            SendClientMessage(playerid, WHITE, string);
            format(string, sizeof(string), "You have been appointed to lead Faction %s, by %s.", Factions[GroupID][FactionName], RPName(playerid));
            SendClientMessage(id, ADMINBLUE, string);
            Player[id][Faction] = GroupID;
            Player[id][FactionRank] = 7;
            format(Player[id][FactionRankName], 255, "%s", Factions[GroupID][RankName7]);
            format(Factions[GroupID][FOwner], 255, "%s", GetName(id));
            format(query, sizeof(query), "UPDATE `Factions` SET `FOwner` = '%s' WHERE `FactionID` = %d",
                GetName(id),
                GroupID);
            mysql_function_query(connectionHandle, query, false, "DefaultCallback", "");
           
            format(query, sizeof(query), "UPDATE `Accounts` SET `Faction` = %d, `FactionRank` = %d, `FactionRankName` = '%s' WHERE `Username` = '%s'",
                GroupID,
                7,
                Factions[GroupID][RankName7],
                GetName(id));
            mysql_function_query(connectionHandle, query, false, "DefaultCallback", "");
           
        }
    }
    return 1;
}
Reply
#2

Update: second problem added + code
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)