07.07.2014, 20:18
Hi!
Well, I'm having problems with my faction system.
Basically, the command /foff is supposed to display everyone who is offline in the faction.
The command /ouninvite offline-uninvites the requested player.
However, whenever I uninvite a player from the faction the FOFF list doesnt get automatically updated.
It ONLY gets updated whenever the player logs in..
Thanks in advanced if you help!
Offline Uninvite CMD:
RemovePlayerFromFactionFile [STOCK] :
FOFF Command:
Well, I'm having problems with my faction system.
Basically, the command /foff is supposed to display everyone who is offline in the faction.
The command /ouninvite offline-uninvites the requested player.
However, whenever I uninvite a player from the faction the FOFF list doesnt get automatically updated.
It ONLY gets updated whenever the player logs in..
Thanks in advanced if you help!
Offline Uninvite CMD:
PHP Code:
COMMAND:ouninvite(playerid, params[])
{
if(PlayerInfo[playerid][ranklvl] != 0) return SendClientError(playerid, CANT_USE_CMD);
if(PlayerInfo[playerid][playerteam] == CIV) return SendClientError(playerid, CANT_USE_CMD);
new iPlayer[ MAX_PLAYER_NAME ];
if( sscanf ( params, "s", iPlayer)) return SCP(playerid, "[Exact_Name]");
if(GetPlayerId(iPlayer) != INVALID_PLAYER_ID) return SendClientError(playerid, "That player is connected! Use /uninvite!");
new fname[ MAX_PLAYER_NAME + 10 ];
format(fname, sizeof(fname), "%s.dudb.sav", iPlayer);
if(!dini_Exists(fname)) return SendClientError(playerid, "Player not found in the database!");
if(strcmp(dini_Get(fname, "teamname"), PlayerInfo[playerid][PTeamName], true)) return SendClientError(playerid, "Player not in your faction!");
dini_Set(fname, "teamname", "Civilian");
dini_IntSet(fname, "ranklvl", -1);
dini_IntSet(fname, "playerteam", 255);
dini_IntSet(fname, "fpay", 0);
dini_Set(fname, "family", "None");
format(iStr, sizeof(iStr), "# [%s] %s has offline-uninvited %s.", NoUnderscore(PlayerInfo[playerid][PTeamName]), RPName(playerid), iPlayer);
SendClientMessageToTeam(PlayerInfo[playerid][playerteam],iStr,COLOR_PLAYER_VLIGHTBLUE);
RemovePlayerFromFactionFile(aname);
format(iStr, sizeof(iStr),"10[O-UNINVITE] %s has been offline-kicked from %s.", iPlayer,PlayerInfo[playerid][PTeamName]);
iEcho(iStr);
return 1;
}
PHP Code:
stock RemovePlayerFromFactionFile(playername[])
{
new FactionFileAndOkay[20];
if(dUserINT(playername).("playerteam") == 1)
{
for(new i = 0; i < 150; i++)
{
format(FactionFileAndOkay, sizeof(FactionFileAndOkay), "Member%d", i);
if(strcmp(dini_Get("Corleone.ini", FactionFileAndOkay), playername) == 0)
{
dini_Set("Corleone.ini", FactionFileAndOkay, "None");
}
if(strcmp(dini_Get("Corleone.ini", FactionFileAndOkay), "None") == 0) continue;
}
}
else if(dUserINT(playername).("playerteam") == 2)
{
for(new i = 0; i < 150; i++)
{
format(FactionFileAndOkay, sizeof(FactionFileAndOkay), "Member%d", i);
if(strcmp(dini_Get("Tattaglia.ini", FactionFileAndOkay), playername) == 0)
{
dini_Set("Tattaglia.ini", FactionFileAndOkay, "None");
}
if(strcmp(dini_Get("Tattaglia.ini", FactionFileAndOkay), "None") == 0) continue;
}
}
else if(dUserINT(playername).("playerteam") == 3)
{
for(new i = 0; i < 150; i++)
{
format(FactionFileAndOkay, sizeof(FactionFileAndOkay), "Member%d", i);
if(strcmp(dini_Get("Stracci.ini", FactionFileAndOkay), playername) == 0)
{
dini_Set("Stracci.ini", FactionFileAndOkay, "None");
}
if(strcmp(dini_Get("Stracci.ini", FactionFileAndOkay), "None") == 0) continue;
}
}
else if(dUserINT(playername).("playerteam") == 4)
{
for(new i = 0; i < 150; i++)
{
format(FactionFileAndOkay, sizeof(FactionFileAndOkay), "Member%d", i);
if(strcmp(dini_Get("Cuneo.ini", FactionFileAndOkay), playername) == 0)
{
dini_Set("Cuneo.ini", FactionFileAndOkay, "None");
}
if(strcmp(dini_Get("Cuneo.ini", FactionFileAndOkay), "None") == 0) continue;
}
}
else if(dUserINT(playername).("playerteam") == 5)
{
for(new i = 0; i < 150; i++)
{
format(FactionFileAndOkay, sizeof(FactionFileAndOkay), "Member%d", i);
if(strcmp(dini_Get("Barzini.ini", FactionFileAndOkay), playername) == 0)
{
dini_Set("Barzini.ini", FactionFileAndOkay, "None");
}
if(strcmp(dini_Get("Barzini.ini", FactionFileAndOkay), "None") == 0) continue;
}
}
else if(dUserINT(playername).("playerteam") == 6)
{
for(new i = 0; i < 150; i++)
{
format(FactionFileAndOkay, sizeof(FactionFileAndOkay), "Member%d", i);
if(strcmp(dini_Get("Paterno.ini", FactionFileAndOkay), playername) == 0)
{
dini_Set("Paterno.ini", FactionFileAndOkay, "None");
}
if(strcmp(dini_Get("Paterno.ini", FactionFileAndOkay), "None") == 0) continue;
}
}
else if(dUserINT(playername).("playerteam") == 7)
{
for(new i = 0; i < 150; i++)
{
format(FactionFileAndOkay, sizeof(FactionFileAndOkay), "Member%d", i);
if(strcmp(dini_Get("LSPD.ini", FactionFileAndOkay), playername) == 0)
{
dini_Set("LSPD.ini", FactionFileAndOkay, "None");
}
if(strcmp(dini_Get("LSPD.ini", FactionFileAndOkay), "None") == 0) continue;
}
}
else if(dUserINT(playername).("playerteam") == 8)
{
for(new i = 0; i < 150; i++)
{
format(FactionFileAndOkay, sizeof(FactionFileAndOkay), "Member%d", i);
if(strcmp(dini_Get("Hitman.ini", FactionFileAndOkay), playername) == 0)
{
dini_Set("Hitman.ini", FactionFileAndOkay, "None");
}
if(strcmp(dini_Get("Hitman.ini", FactionFileAndOkay), "None") == 0) continue;
}
}
else if(dUserINT(playername).("playerteam") == 9)
{
for(new i = 0; i < 150; i++)
{
format(FactionFileAndOkay, sizeof(FactionFileAndOkay), "Member%d", i);
if(strcmp(dini_Get("SDC.ini", FactionFileAndOkay), playername) == 0)
{
dini_Set("SDC.ini", FactionFileAndOkay, "None");
}
if(strcmp(dini_Get("SDC.ini", FactionFileAndOkay), "None") == 0) continue;
}
}
else if(dUserINT(playername).("playerteam") == 10)
{
for(new i = 0; i < 150; i++)
{
format(FactionFileAndOkay, sizeof(FactionFileAndOkay), "Member%d", i);
if(strcmp(dini_Get("SASF.ini", FactionFileAndOkay), playername) == 0)
{
dini_Set("SASF.ini", FactionFileAndOkay, "None");
}
if(strcmp(dini_Get("SASF.ini", FactionFileAndOkay), "None") == 0) continue;
}
}
else if(dUserINT(playername).("playerteam") == 11)
{
for(new i = 0; i < 150; i++)
{
format(FactionFileAndOkay, sizeof(FactionFileAndOkay), "Member%d", i);
if(strcmp(dini_Get("Government.ini", FactionFileAndOkay), playername) == 0)
{
dini_Set("Government.ini", FactionFileAndOkay, "None");
}
if(strcmp(dini_Get("Government.ini", FactionFileAndOkay), "None") == 0) continue;
}
}
else if(dUserINT(playername).("playerteam") == 12)
{
for(new i = 0; i < 150; i++)
{
format(FactionFileAndOkay, sizeof(FactionFileAndOkay), "Member%d", i);
if(strcmp(dini_Get("Leone.ini", FactionFileAndOkay), playername) == 0)
{
dini_Set("Leone.ini", FactionFileAndOkay, "None");
}
if(strcmp(dini_Get("Leone.ini", FactionFileAndOkay), "None") == 0) continue;
}
}
else if(dUserINT(playername).("playerteam") == 13)
{
for(new i = 0; i < 150; i++)
{
format(FactionFileAndOkay, sizeof(FactionFileAndOkay), "Member%d", i);
if(strcmp(dini_Get("FBI.ini", FactionFileAndOkay), playername) == 0)
{
dini_Set("FBI.ini", FactionFileAndOkay, "None");
}
if(strcmp(dini_Get("FBI.ini", FactionFileAndOkay), "None") == 0) continue;
}
}
else if(dUserINT(playername).("playerteam") == 14)
{
for(new i = 0; i < 150; i++)
{
format(FactionFileAndOkay, sizeof(FactionFileAndOkay), "Member%d", i);
if(strcmp(dini_Get("Kemirov.ini", FactionFileAndOkay), playername) == 0)
{
dini_Set("Kemirov.ini", FactionFileAndOkay, "None");
}
if(strcmp(dini_Get("Kemirov.ini", FactionFileAndOkay), "None") == 0) continue;
}
}
else if(dUserINT(playername).("playerteam") == 15)
{
for(new i = 0; i < 150; i++)
{
format(FactionFileAndOkay, sizeof(FactionFileAndOkay), "Member%d", i);
if(strcmp(dini_Get("DeMeo.ini", FactionFileAndOkay), playername) == 0)
{
dini_Set("DeMeo.ini", FactionFileAndOkay, "None");
}
if(strcmp(dini_Get("DeMeo.ini", FactionFileAndOkay), "None") == 0) continue;
}
}
return 1;
}
PHP Code:
COMMAND:foff(playerid, params[])
{
GetPlayerName(playerid, aname, sizeof(aname));
new Faction, facc[20], ListOfMembers[128];
Faction = dUserINT(aname).("playerteam");
if(PlayerInfo[playerid][playerteam] == CIV || PlayerInfo[playerid][playerteam] == 0) return SendClientMessage(playerid, COLOR_ERROR, "ERROR: You are not authorized to perform this command.");
if(Faction == 1)
{
SendClientMessage(playerid, COLOR_HELPEROOC, "Offline Corleone members:");
for(new i = 0; i < 150; i++)
{
format(facc, sizeof(facc), "Member%d", i);
if(strcmp(dini_Get("Corleone.ini", facc), "None") == 0) continue;
if(NameToID(dini_Get("Corleone.ini", facc)) != -1) continue;
format(ListOfMembers, sizeof(ListOfMembers), "Rank & name: %s %s. Tier: %d.", dUser(dini_Get("Corleone.ini", facc)).("rankname"), dini_Get("Corleone.ini", facc), dUserINT(dini_Get("Corleone.ini", facc)).("ranklvl"));
SendClientMessage(playerid, -1, ListOfMembers);
}
}
if(Faction == 2)
{
SendClientMessage(playerid, COLOR_HELPEROOC, "Offline Tattaglia members:");
for(new i = 0; i < 150; i++)
{
format(facc, sizeof(facc), "Member%d", i);
if(strcmp(dini_Get("Tattaglia.ini", facc), "None") == 0) continue;
if(NameToID(dini_Get("Tattaglia.ini", facc)) != -1) continue;
format(ListOfMembers, sizeof(ListOfMembers), "Rank & name: %s %s. Tier: %d.", dUser(dini_Get("Tattaglia.ini", facc)).("rankname"), dini_Get("Tattaglia.ini", facc), dUserINT(dini_Get("Tattaglia.ini", facc)).("ranklvl"));
SendClientMessage(playerid, -1, ListOfMembers);
}
}
if(Faction == 3)
{
SendClientMessage(playerid, COLOR_HELPEROOC, "Offline Stracci members:");
for(new i = 0; i < 150; i++)
{
format(facc, sizeof(facc), "Member%d", i);
if(strcmp(dini_Get("Stracci.ini", facc), "None") == 0) continue;
if(NameToID(dini_Get("Stracci.ini", facc)) != -1) continue;
format(ListOfMembers, sizeof(ListOfMembers), "Rank & name: %s %s. Tier: %d.", dUser(dini_Get("Stracci.ini", facc)).("rankname"), dini_Get("Stracci.ini", facc), dUserINT(dini_Get("Stracci.ini", facc)).("ranklvl"));
SendClientMessage(playerid, -1, ListOfMembers);
}
}
if(Faction == 4)
{
SendClientMessage(playerid, COLOR_HELPEROOC, "Offline Cuneo members:");
for(new i = 0; i < 150; i++)
{
format(facc, sizeof(facc), "Member%d", i);
if(strcmp(dini_Get("Cuneo.ini", facc), "None") == 0) continue;
if(NameToID(dini_Get("Cuneo.ini", facc)) != -1) continue;
format(ListOfMembers, sizeof(ListOfMembers), "Rank & name: %s %s. Tier: %d.", dUser(dini_Get("Cuneo.ini", facc)).("rankname"), dini_Get("Cuneo.ini", facc), dUserINT(dini_Get("Cuneo.ini", facc)).("ranklvl"));
SendClientMessage(playerid, -1, ListOfMembers);
}
}
if(Faction == 5)
{
SendClientMessage(playerid, COLOR_HELPEROOC, "Offline Barzini members:");
for(new i = 0; i < 150; i++)
{
format(facc, sizeof(facc), "Member%d", i);
if(strcmp(dini_Get("Barzini.ini", facc), "None") == 0) continue;
if(NameToID(dini_Get("Barzini.ini", facc)) != -1) continue;
format(ListOfMembers, sizeof(ListOfMembers), "Rank & name: %s %s. Tier: %d.", dUser(dini_Get("Barzini.ini", facc)).("rankname"), dini_Get("Barzini.ini", facc), dUserINT(dini_Get("Barzini.ini", facc)).("ranklvl"));
SendClientMessage(playerid, -1, ListOfMembers);
}
}
if(Faction == 6)
{
SendClientMessage(playerid, COLOR_HELPEROOC, "Offline Paterno members:");
for(new i = 0; i < 150; i++)
{
format(facc, sizeof(facc), "Member%d", i);
if(strcmp(dini_Get("Paterno.ini", facc), "None") == 0) continue;
if(NameToID(dini_Get("Paterno.ini", facc)) != -1) continue;
format(ListOfMembers, sizeof(ListOfMembers), "Rank & name: %s %s. Tier: %d.", dUser(dini_Get("Paterno.ini", facc)).("rankname"), dini_Get("Paterno.ini", facc), dUserINT(dini_Get("Paterno.ini", facc)).("ranklvl"));
SendClientMessage(playerid, -1, ListOfMembers);
}
}
if(Faction == 7)
{
SendClientMessage(playerid, COLOR_HELPEROOC, "Offline LSPD members:");
for(new i = 0; i < 150; i++)
{
format(facc, sizeof(facc), "Member%d", i);
if(strcmp(dini_Get("LSPD.ini", facc), "None") == 0) continue;
if(NameToID(dini_Get("LSPD.ini", facc)) != -1) continue;
format(ListOfMembers, sizeof(ListOfMembers), "Rank & name: %s %s. Tier: %d.", dUser(dini_Get("LSPD.ini", facc)).("rankname"), dini_Get("LSPD.ini", facc), dUserINT(dini_Get("LSPD.ini", facc)).("ranklvl"));
SendClientMessage(playerid, -1, ListOfMembers);
}
}
if(Faction == 8)
{
SendClientMessage(playerid, COLOR_HELPEROOC, "Offline Corleone members:");
for(new i = 0; i < 150; i++)
{
format(facc, sizeof(facc), "Member%d", i);
if(strcmp(dini_Get("Hitman.ini", facc), "None") == 0) continue;
if(NameToID(dini_Get("Hitman.ini", facc)) != -1) continue;
format(ListOfMembers, sizeof(ListOfMembers), "Rank & name: %s %s. Tier: %d.", dUser(dini_Get("Hitman.ini", facc)).("rankname"), dini_Get("Hitman.ini", facc), dUserINT(dini_Get("Hitman.ini", facc)).("ranklvl"));
SendClientMessage(playerid, -1, ListOfMembers);
}
}
if(Faction == 9)
{
SendClientMessage(playerid, COLOR_HELPEROOC, "Offline SDC members:");
for(new i = 0; i < 150; i++)
{
format(facc, sizeof(facc), "Member%d", i);
if(strcmp(dini_Get("SDC.ini", facc), "None") == 0) continue;
if(NameToID(dini_Get("SDC.ini", facc)) != -1) continue;
format(ListOfMembers, sizeof(ListOfMembers), "Rank & name: %s %s. Tier: %d.", dUser(dini_Get("SDC.ini", facc)).("rankname"), dini_Get("SDC.ini", facc), dUserINT(dini_Get("SDC.ini", facc)).("ranklvl"));
SendClientMessage(playerid, -1, ListOfMembers);
}
}
if(Faction == 10)
{
SendClientMessage(playerid, COLOR_HELPEROOC, "Offline SASF members:");
for(new i = 0; i < 150; i++)
{
format(facc, sizeof(facc), "Member%d", i);
if(strcmp(dini_Get("SASF.ini", facc), "None") == 0) continue;
if(NameToID(dini_Get("SASF.ini", facc)) != -1) continue;
format(ListOfMembers, sizeof(ListOfMembers), "Rank & name: %s %s. Tier: %d.", dUser(dini_Get("SASF.ini", facc)).("rankname"), dini_Get("SASF.ini", facc), dUserINT(dini_Get("SASF.ini", facc)).("ranklvl"));
SendClientMessage(playerid, -1, ListOfMembers);
}
}
if(Faction == 11)
{
SendClientMessage(playerid, COLOR_HELPEROOC, "Offline Government members:");
for(new i = 0; i < 150; i++)
{
format(facc, sizeof(facc), "Member%d", i);
if(strcmp(dini_Get("Government.ini", facc), "None") == 0) continue;
if(NameToID(dini_Get("Government.ini", facc)) != -1) continue;
format(ListOfMembers, sizeof(ListOfMembers), "Rank & name: %s %s. Tier: %d.", dUser(dini_Get("Government.ini", facc)).("rankname"), dini_Get("Government.ini", facc), dUserINT(dini_Get("Government.ini", facc)).("ranklvl"));
SendClientMessage(playerid, -1, ListOfMembers);
}
}
if(Faction == 12)
{
SendClientMessage(playerid, COLOR_HELPEROOC, "Offline Leone members:");
for(new i = 0; i < 150; i++)
{
format(facc, sizeof(facc), "Member%d", i);
if(strcmp(dini_Get("Leone.ini", facc), "None") == 0) continue;
if(NameToID(dini_Get("Leone.ini", facc)) != -1) continue;
format(ListOfMembers, sizeof(ListOfMembers), "Rank & name: %s %s. Tier: %d.", dUser(dini_Get("Leone.ini", facc)).("rankname"), dini_Get("Leone.ini", facc), dUserINT(dini_Get("Leone.ini", facc)).("ranklvl"));
SendClientMessage(playerid, -1, ListOfMembers);
}
}
if(Faction == 13)
{
SendClientMessage(playerid, COLOR_HELPEROOC, "Offline FBI members:");
for(new i = 0; i < 150; i++)
{
format(facc, sizeof(facc), "Member%d", i);
if(strcmp(dini_Get("FBI.ini", facc), "None") == 0) continue;
if(NameToID(dini_Get("FBI.ini", facc)) != -1) continue;
format(ListOfMembers, sizeof(ListOfMembers), "Rank & name: %s %s. Tier: %d.", dUser(dini_Get("FBI.ini", facc)).("rankname"), dini_Get("FBI.ini", facc), dUserINT(dini_Get("FBI.ini", facc)).("ranklvl"));
SendClientMessage(playerid, -1, ListOfMembers);
}
}
if(Faction == 14)
{
SendClientMessage(playerid, COLOR_HELPEROOC, "Offline Kemirov members:");
for(new i = 0; i < 150; i++)
{
format(facc, sizeof(facc), "Member%d", i);
if(strcmp(dini_Get("Kemirov.ini", facc), "None") == 0) continue;
if(NameToID(dini_Get("Kemirov.ini", facc)) != -1) continue;
format(ListOfMembers, sizeof(ListOfMembers), "Rank & name: %s %s. Tier: %d.", dUser(dini_Get("Kemirov.ini", facc)).("rankname"), dini_Get("Kemirov.ini", facc), dUserINT(dini_Get("Kemirov.ini", facc)).("ranklvl"));
SendClientMessage(playerid, -1, ListOfMembers);
}
}
if(Faction == 15)
{
SendClientMessage(playerid, COLOR_HELPEROOC, "Offline DeMeo members:");
for(new i = 0; i < 150; i++)
{
format(facc, sizeof(facc), "Member%d", i);
if(strcmp(dini_Get("DeMeo.ini", facc), "None") == 0) continue;
if(NameToID(dini_Get("DeMeo.ini", facc)) != -1) continue;
format(ListOfMembers, sizeof(ListOfMembers), "Rank & name: %s %s. Tier: %d.", dUser(dini_Get("DeMeo.ini", facc)).("rankname"), dini_Get("DeMeo.ini", facc), dUserINT(dini_Get("DeMeo.ini", facc)).("ranklvl"));
SendClientMessage(playerid, -1, ListOfMembers);
}
}
return 1;
}