01.12.2015, 14:27
Quando eu edito uma facзгo em meu servidor, somente a de ID 0 estб salvando os cargos, as demais nгo estгo guardando os dados, a fac 0 й a Los Angeles Police Department, ela salva todos os cargos, mais as demais nгo, as demais estгo ficando com NULL no nome, jб tentei de tudo.
PHP код:
CMD:editfaction(playerid, params[])
{
static
id,
type[24],
string[128];
if (PlayerData[playerid][pAdmin] < 5 && !PlayerData[playerid][pFactionMod])
return SendErrorMessage(playerid, "Vocк nгo tem permissгo para usar este comando.");
if (sscanf(params, "ds[24]S()[128]", id, type, string))
{
SendSyntaxMessage(playerid, "/editfaction [id] [name]");
SendClientMessage(playerid, COLOR_YELLOW, "[NAMES]:{FFFFFF} name, color, type, models, locker, ranks, maxranks");
return 1;
}
if ((id < 0 || id >= MAX_FACTIONS) || !FactionData[id][factionExists])
return SendErrorMessage(playerid, "You have specified an invalid faction ID.");
if (!strcmp(type, "name", true))
{
new name[32];
if (sscanf(string, "s[32]", name))
return SendSyntaxMessage(playerid, "/editfaction [id] [name] [new name]");
format(FactionData[id][factionName], 32, name);
Faction_Save(id);
SendFactionAlert(COLOR_LIGHTRED, "[ADMIN]: %s has adjusted the name of faction ID: %d to \"%s\".", ReturnName(playerid, 0), id, name);
}
else if (!strcmp(type, "maxranks", true))
{
new ranks;
if (sscanf(string, "d", ranks))
return SendSyntaxMessage(playerid, "/editfaction [id] [maxranks] [maximum ranks]");
if (ranks < 1 || ranks > 17)
return SendErrorMessage(playerid, "The specified ranks can't be below 1 or above 17.");
FactionData[id][factionRanks] = ranks;
Faction_Save(id);
SendFactionAlert(COLOR_LIGHTRED, "[ADMIN]: %s has adjusted the maximum ranks of faction ID: %d to %d.", ReturnName(playerid, 0), id, ranks);
}
else if (!strcmp(type, "ranks", true))
{
Faction_ShowRanks(playerid, id);
}
else if (!strcmp(type, "color", true))
{
new color;
if (sscanf(string, "h", color))
return SendSyntaxMessage(playerid, "/editfaction [id] [color] [hex color]");
FactionData[id][factionColor] = color;
Faction_Update(id);
Faction_Save(id);
SendFactionAlert(COLOR_LIGHTRED, "[ADMIN]: %s has adjusted the {%06x}color{41FEFF} of faction ID: %d.", ReturnName(playerid, 0), color >>> 8, id);
}
else if (!strcmp(type, "type", true))
{
new typeint;
if (sscanf(string, "d", typeint))
{
SendSyntaxMessage(playerid, "/editfaction [id] [type] [faction type]");
SendClientMessage(playerid, COLOR_YELLOW, "[TYPES]:{FFFFFF} 1: Police | 2: News | 3: Medical | 4: Government | 5: Gang");
return 1;
}
if (typeint < 1 || typeint > 5)
return SendErrorMessage(playerid, "Invalid type specified. Types range from 1 to 5.");
FactionData[id][factionType] = typeint;
Faction_Save(id);
SendFactionAlert(COLOR_LIGHTRED, "[ADMIN]: %s has adjusted the type of faction ID: %d to %d.", ReturnName(playerid, 0), id, typeint);
}
else if (!strcmp(type, "models", true))
{
static
skins[8];
for (new i = 0; i < sizeof(skins); i ++)
skins[i] = (FactionData[id][factionSkins][i]) ? (FactionData[id][factionSkins][i]) : (19300);
PlayerData[playerid][pFactionEdit] = id;
ShowModelSelectionMenu(playerid, "Faction Skins", MODEL_SELECTION_SKINS, skins, sizeof(skins), -16.0, 0.0, -55.0);
}
else if (!strcmp(type, "locker", true))
{
PlayerData[playerid][pFactionEdit] = id;
Dialog_Show(playerid, FactionLocker, DIALOG_STYLE_LIST, "Faction Locker", "Set Location\nLocker Weapons", "Select", "Cancel");
}
return 1;
}

