27.08.2014, 14:22
Quote:
|
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 Код:
![]() |
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;
}



