Payday fraction
#1

how to split the amount entered into the player of the members, who are now?

PHP код:
for(new 0MAX_PLAYERSi++)
         {
             if(
pl[i][pMember]==number||pl[i][pLeader]==number)
                   
GivePlayerMoney(???) 
         } 
Reply
#2

https://sampwiki.blast.hk/wiki/GivePlayerMoney
Reply
#3

Код:
stock countFactionMembers(factionid)
{
	new count;
	foreach(Player, i)
	{
		if(pl[i][pMember] == factionid || pl[i][pLeader] == factionid)
		{
			count++;
		}
	}
	return count;
}

	for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(pl[i][pMember]==number||pl[i][pLeader]==number)
        {
        	GivePlayerMoney(i, money/countFactionMembers(number));
        }
        
    }
Reply
#4

PHP код:
for(new 0MAX_PLAYERSi++)
         {
             if(
pl[i][pMember]==fidzp||pl[i][pLeader]==fidzp){
             
            
GivePlayerMoney(i,strval(inputtext)/i);}
         } 
- NO!
Reply
#5

Quote:
Originally Posted by XVlaDX
Посмотреть сообщение
Код:
stock countFactionMembers(factionid)
{
	new count;
	foreach(Player, i)
	{
		if(pl[i][pMember] == factionid || pl[i][pLeader] == factionid)
		{
			count++;
		}
	}
	return count;
}
PHP код:
new.pwn(2195) : error 017undefined symbol "foreach"
new.pwn(2197) : error 017undefined symbol "i" 
Reply
#6

Quote:
Originally Posted by EvgeniyHostel1992
Посмотреть сообщение
PHP код:
new.pwn(2195) : error 017undefined symbol "foreach"
new.pwn(2197) : error 017undefined symbol "i" 
Include the foreach library
Reply
#7

What are you trying to do?
Reply
#8

divide(split) the amount of money you enter for your gang players who are online
Reply
#9

Try this:
PHP код:
stock countFactionMembers(factionid)
{
    new 
count;
    foreach (new 
Player)
    {
        if(
pl[i][pMember] == factionid || pl[i][pLeader] == factionid)
        {
            
count++;
        }
    }
    return 
count;

I'm not sure what "number" is so I left it as it was
PHP код:
new amount strval(inputtext)
foreach (new 
Player)
{
    if(
pl[i][pMember]==number||pl[i][pLeader]==number)
    {
        
GivePlayerMoney(iamount/2);
    }

Hope this will help you

EDIT: I assume that you already have included foreach.
Reply
#10

Quote:
Originally Posted by kovac
Посмотреть сообщение
Try this:
PHP код:
stock countFactionMembers(factionid)
{
    new 
count;
    foreach (new 
Player)
    {
        if(
pl[i][pMember] == factionid || pl[i][pLeader] == factionid)
        {
            
count++;
        }
    }
    return 
count;

I'm not sure what "number" is so I left it as it was
PHP код:
new amount strval(inputtext)
foreach (new 
Player)
{
    if(
pl[i][pMember]==number||pl[i][pLeader]==number)
    {
        
GivePlayerMoney(iamount/2);
    }

Hope this will help you

EDIT: I assume that you already have included foreach.
That wouldn't satisfy his requirements. You're dividing the amount of money entered by 2 instead of the number of online faction members. & I'm not sure why you included countFactionMembers if you're not going to use it in your command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)