Help with code
#1

Hi. I have code:

Code:
		for(new Bussines; Bussines < MAX_BUSSINES; Bussines ++)
	{
		if(Bussinesinf[Bussines][Buyed])
		{
			Bussinesinf[Bussines][Profit] += Bussinesinf[Bussines][Earning];
		}
	}
This code will add Profit for Bussines. Also I done timer. This code adding for all bussines profit. Now I want to do, that this code will add profit only for connected ( online ) bussines owners. How to do that?

Bussines owner:
Code:
Bussinesinf[Bussines][Owner]
Reply
#2

Still need help :/
Reply
#3

if Bussinesinf[Bussines][Owner] is a string that stores player name
PHP Code:
new ownerid;
for(new 
BussinesBussines MAX_BUSSINESBussines ++)
    {
        if(
Bussinesinf[Bussines][Buyed])
        {
                    
sscanf(Bussinesinf[Bussines][Owner], "r"ownerid);
                    if(
ownerid != INVALID_PLAYER_ID)
                   {
                       
Bussinesinf[Bussines][Profit] += Bussinesinf[Bussines][Earning];
                   }
        }
    } 
Reply
#4

Quote:
Originally Posted by Shinja
View Post
if Bussinesinf[Bussines][Owner] is a string that stores player name
PHP Code:
new ownerid;
for(new 
BussinesBussines MAX_BUSSINESBussines ++)
    {
        if(
Bussinesinf[Bussines][Buyed])
        {
                    new 
owneridsscanf(Bussinesinf[Bussines][Owner], "r"ownerid);
                    if(
ownerid != INVALID_PLAYER_ID)
                   {
                       
Bussinesinf[Bussines][Profit] += Bussinesinf[Bussines][Earning];
                   }
        }
    } 
You declare two times ownerid, there is a problem.
Reply
#5

Quote:
Originally Posted by Dutheil
View Post
You declare two times ownerid, there is a problem.
Owh just a typo because i copied it later, thanks for reminding me
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)