Help me. -
Rien - 01.01.2014
Hy,i have 2 problem :
- I have problem with an command
- I have problem with another command
)
1.Recently,i have created an command /fw who give user faction warn.The problem are :
My command is for all users(online & offline),when i give 2 FW they display i have 1 FW.And when the caracter enter again display i have 0 FW.Why?The command is:
Код:
CMD:fw(playerid, params[])
{
new playerb[32], string[128], file[32];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pFacRank] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not rank 6 +.");
if(sscanf(params, "s[32]s[128]", playerb, params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fw [playername] [reason]");
format(file, sizeof(file), "users/%s.ini", playerb);
if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
if(PlayerInfo[playerid][pFac] < dini_Int(file, "Fac")) return SendClientMessage(playerid, COLOR_GREY, "Player is not in your faction.");
if(PlayerInfo[playerid][pFac] > dini_Int(file, "Fac")) return SendClientMessage(playerid, COLOR_GREY, "Player is not in your faction.");
if(PlayerInfo[playerid][pFac] == dini_Int(file, "Fac"))
{
format(string, sizeof(string), "%s managed %s's faction warn to +1, reason: %s", playerb, NORPN(playerid), params);
SendClientMessage(playerid,COLOR_LIGHTGREEN, string);
format(string, sizeof(string), "%s recivied 1 FW from %s, reason: %s", playerb, NORPN(playerid), params);
Log("logs/fw.log", string);
// Banning
if(dini_Int(file, "FactioWarn") == 0)
{
dini_IntSet(file, "FactionWarn", 1);
return 1;
}
else if(dini_Int(file, "FactioWarn") == 1)
{
dini_IntSet(file, "FactionWarn", 2);
return 1;
}
else if(dini_Int(file, "FactioWarn") == 2)
{
dini_IntSet(file, "FactionWarn", 3);
return 1;
}
// Banreason
// BanList
/* new File:ban = fopen("ban.cfg", io_append);
format(string, sizeof(string), "%s\r\n", dini_Get(file, "IP"));
fwrite(ban, string);
fclose(ban);*/
}
return 1;
}
2.Another problem is :
I want at comand /members to display all members,not only online members.Who i can do that ?
The command /members is :
Код:
CMD:members(playerid, params[])
{
new string[128], online;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pFac])
{
foreach(Player, i)
{
if(PlayerInfo[i][pFac] == PlayerInfo[playerid][pFac])
{
online ++;
}
}
format(string, sizeof(string), "Online Faction Members: %d", online);
SendClientMessage(playerid, COLOR_ORANGE, string);
foreach(Player, i)
{
if(PlayerInfo[i][pFac] == PlayerInfo[playerid][pFac])
{
if(PlayerInfo[i][pFacLeader])
{
if(PlayerInfo[playerid][pFacLeader] && PlayerInfo[i][pFacDiv]) format(string, sizeof(string), "- [Leader] [%s] [%s (%d)] %s", RPFDN(i), RPFRN(i), PlayerInfo[i][pFacRank], NORPN(i));
else format(string, sizeof(string), "- [Leader] [%s (%d)] %s", RPFRN(i), PlayerInfo[i][pFacRank], NORPN(i));
if(PlayerInfo[playerid][pFac] == 3) format(string, sizeof(string), "- [Leader] [%s (%d)] %s (Success: %d | Fail: %d)", RPFRN(i), PlayerInfo[i][pFacRank], NORPN(i), PlayerInfo[i][pCSuccess], PlayerInfo[i][pCFail]);
}
else
{
if(PlayerInfo[playerid][pFacLeader] && PlayerInfo[i][pFacDiv]) format(string, sizeof(string), "- [%s] [%s (%d)] %s", RPFDN(i), RPFRN(i), PlayerInfo[i][pFacRank], NORPN(i));
else format(string, sizeof(string), "- [%s (%d)] %s", RPFRN(i), PlayerInfo[i][pFacRank], NORPN(i));
if(PlayerInfo[playerid][pFac] == 3) format(string, sizeof(string), "- [%s (%d)] %s (Success: %d | Fail: %d)", RPFRN(i), PlayerInfo[i][pFacRank], NORPN(i), PlayerInfo[i][pCSuccess], PlayerInfo[i][pCFail]);
}
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
}
if(PlayerInfo[playerid][pFam])
{
online = 0;
foreach(Player, i)
{
if(PlayerInfo[i][pFam] == PlayerInfo[playerid][pFam])
{
online ++;
}
}
format(string, sizeof(string), "Online Family Members: %d", online);
SendClientMessage(playerid, COLOR_ORANGE, string);
foreach(Player, i)
{
if(PlayerInfo[i][pFam] == PlayerInfo[playerid][pFam])
{
format(string, sizeof(string), "- [%s (%d)] %s", RPFaRN(i), PlayerInfo[i][pFamRank], NORPN(i));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
}
return 1;
}
+REP who help me.Thank's
Re: Help me. -
dominik523 - 01.01.2014
To check which users are members, online and offline, you would need also open files/database so you can compare if they are in the same faction. You just have here a command which will show you online members.
Re: Help me. -
Rien - 01.01.2014
Yes,but i want to show all player not only online.Who i cand do this ? I use dini ..