#define MAX_GANGS 1000
GetGangMembersCount(gangid)
{
new count;
foreach (new i : Player) // or for(new i = 0; i < MAX_PLAYERS; i++) if you don't use foreach
{
if(IsPlayerConnected(i) && PlayerInfo[i][Gang] == gangid)
{
count++;
}
}
return count;
}
CMD:salary(playerid)
{
new string[128], name[MAX_PLAYER_NAME], amount;
for(new i = 0; i < MAX_GANGS; i++)
{
foreach (new p : Player)
{
if(IsPlayerConnected(p) && PlayerInfo[p][Gang] == i)
{
amount = 1000*GetGangMembersCount(i)
GivePlayerMoney(p, amount)
GetPlayerName(p, name, sizeof(name));
format(string, sizeof(string), "DEBUG: Player: %s - Money given: %d - Online members: %d", name, amount, GetGangMembersCount(i))
SendClientMessage(playerid, -1, string);
}
}
}
return 1;
}
error 021: symbol already defined: "GetGangMembersCount"
|