SA-MP Forums Archive
Problem with Mysql instert - 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: Problem with Mysql instert (/showthread.php?tid=435754)



Problem with Mysql - Stefand - 08.05.2013

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;
}



Re: Problem with Mysql instert - Stefand - 08.05.2013

Update: second problem added + code