Members
#1

How to find out the number of online subordinates of one of the gangs and multiply this amount by the amount?

I want that at the salary of each gang from their treasury the amount which was spent for online of all gang
Reply
#2

I made you an example. Hope it will help you

PHP код:
#define MAX_GANGS 1000
GetGangMembersCount(gangid)
{
    new 
count;
    foreach (new 
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 
0MAX_GANGSi++)
    {
        foreach (new 
Player)
        {
            if(
IsPlayerConnected(p) && PlayerInfo[p][Gang] == i)
            {
                
amount 1000*GetGangMembersCount(i)
                
GivePlayerMoney(pamount)
                
                
GetPlayerName(pnamesizeof(name));
                
format(stringsizeof(string), "DEBUG: Player: %s - Money given: %d - Online members: %d"nameamountGetGangMembersCount(i))
                
SendClientMessage(playerid, -1string);
            }
        }
    }
    return 
1;

Reply
#3

error 021: symbol already defined: "GetGangMembersCount"
Reply
#4

Quote:
Originally Posted by EvgeniyHostel1992
Посмотреть сообщение
error 021: symbol already defined: "GetGangMembersCount"
So you already have function with same name somewhere in your script, just rename it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)