[SQLite] Dynamic Factions
#10

Quote:
Originally Posted by Kyance
Посмотреть сообщение
Eh, I think it's a flaw with sscanf(using the strings in a middle of something).
You can create a command - editfaction, and then edit the ranks/name etc.
Example;
pawn Код:
CMD:editfaction(playerid, params[]) {
    if(InFaction(playerid) && FactionRank(playerid) == 5) ShowPlayerDialog(playerid, DIALOG_EDITFACTION, DIALOG_STYLE_LIST, "Editing your faction", "Edit Name\nEdit Type\nEdit Rank 1\nEdit Rank 2\nEdit Rank 3\nEdit Rank 4\nEdit Rank 5\nEdit Rank 6", "Select", "Close");
    else //error message here
    return 1;
}
I think you should know what to do next
Thanks one last thing, is this code right to remove the faction from the databasE?

pawn Код:
stock DeleteFaction(FactionID, name[], type, rank0[], rank1[], rank2[], rank3[], rank4[], rank5[], rank6[])
{
    new Query[256], DBResult:Result;
    new active = 0;
    new playerid;
    format(Query, sizeof(Query), "DELETE FROM Groups WHERE ACTIVE='%i' NAME='%s', TYPE='%i', RANK0='%s',  RANK1='%s',  RANK2='%s',  RANK3='%s',  RANK4='%s',  RANK5='%s' and RANK6='%s'", active, name, type, rank0, rank1, rank2, rank3, rank4, rank5, rank6);
    Result = db_query(Database, Query);
    if(Result)
    {
        printf("[debug] %s deleted faction called %s(%i)", GetName(playerid), name);
        SendClientMessage(playerid, -1, "Faction successfully deleted");
        ReloadFactions();
    }
    else
    {
        printf("[debug] couldn't delete faction called %s(%i)", name, type, GetName(playerid));
        SendClientMessage(playerid, -1, "Couldn't delete faction..");
    }
    db_free_result(Result);
}
pawn Код:
CMD:deletefaction(playerid, params[])
{
    new name[128], type, rank0[128], rank1[128], rank2[128], rank3[128], rank4[128], rank5[128], rank6[128], FactionID;
    if(!PermissionCheck(playerid, 6)) return SendClientMessageEx(playerid, COLOR_GREY, "You are not authourized to use this command.");
    if(sscanf(params, "i", FactionID)) return SendClientMessageEx(playerid, COLOR_GREY, "Usage: /deletefaction [ID]");
    DeleteFaction(FactionID, name, type, rank0, rank1, rank2, rank3, rank4, rank5, rank6);
    return 1;
}
Reply


Messages In This Thread
[SQLite] Dynamic Factions - by JordanDoughty - 23.08.2014, 17:21
Re: [SQLite] Dynamic Factions - by JordanDoughty - 23.08.2014, 18:10
Re: [SQLite] Dynamic Factions - by HazardouS - 23.08.2014, 18:43
Re: [SQLite] Dynamic Factions - by JordanDoughty - 24.08.2014, 13:28
Re: [SQLite] Dynamic Factions - by JordanDoughty - 24.08.2014, 19:09
Re: [SQLite] Dynamic Factions - by JordanDoughty - 26.08.2014, 15:17
Re: [SQLite] Dynamic Factions - by Kyance - 26.08.2014, 15:34
Re: [SQLite] Dynamic Factions - by JordanDoughty - 26.08.2014, 18:18
Re: [SQLite] Dynamic Factions - by Kyance - 27.08.2014, 05:38
Re: [SQLite] Dynamic Factions - by JordanDoughty - 27.08.2014, 14:22

Forum Jump:


Users browsing this thread: 1 Guest(s)