Define business pickup on playerpickup
#1

That's what I got, and I want to define the pickup, I mean each business has it's own information and it's own pickup. So I want that when player pickup the business pickup, he will see business information of the pickup he took.

Код:
for(new idx=1; idx<MAX_BIZ; idx++)
	{
	    if(pickupid == ?)
	    {
		    new string[256];
		    if(BizInfo[idx][bFee])
			{
		 		format(string, sizeof(string), "%s~n~~w~OWNER : %s~n~ENTRANCE FEE : ~g~%d~n~~p~TO USE /ENTER", BizInfo[idx][bName], BizInfo[idx][bOwner], BizInfo[idx][bFee]);
			}
			else
			{
				format(string, sizeof(string), "%s~n~~w~OWNER : %s~n~ENTRANCE FEE : ~g~FREE~n~~p~TO USE /ENTER", BizInfo[idx][bName], BizInfo[idx][bOwner], BizInfo[idx][bFee]);
			}
			GameTextForPlayer(playerid, string, 3000, 5);
			return 1;
		}
		return 1;
	}
Reply
#2

Add 'bPickup' to your BizInfo-enum, when you create a pickup for a business, use:
pawn Код:
BizInfo[id][bPickup] = Create(Dynamic)Pickup(......);
Then at the callback OnPlayerPickUp(Dynamic)Pickup do something like:
pawn Код:
for(new idx=1; idx<MAX_BIZ; idx++)
{
    if(pickupid == BizInfo[idx][bPickup])
    {
        new string[256];
        if(BizInfo[idx][bFee])
        {
            format(string, sizeof(string), "%s~n~~w~OWNER : %s~n~ENTRANCE FEE : ~g~%d~n~~p~TO USE /ENTER", BizInfo[idx][bName], BizInfo[idx][bOwner], BizInfo[idx][bFee]);
        }
    else
        {
            format(string, sizeof(string), "%s~n~~w~OWNER : %s~n~ENTRANCE FEE : ~g~FREE~n~~p~TO USE /ENTER", BizInfo[idx][bName], BizInfo[idx][bOwner], BizInfo[idx][bFee]);
        }
        GameTextForPlayer(playerid, string, 3000, 5);
        break;
    }
}
Reply
#3

pawn Код:
#define MAX_BUSINESS_PICKUP 200
new pickups[MAX_BUSINESS_PICKUP];

public OnGameModeInt()
{
   pickups[0] = CreatePickUp(.....);
   pickups[1] = CreatePickUp(.....);
   pickups[2] = CreatePickUp(.....);
   ...........
   ...........
   pickups[199] = CreatePickUp(.....);
}

public OnPlayerPickPickUp(playerid, pickupid)
{
   for(new i=0; i < MAX_BUSINESS_PICKUP; i++)
   {
       if(pickupid[i] == pickupid)
       {
            // do something
       }
   }
}
Its Example for give an idea, that how it will work.
Reply
#4

Quote:
Originally Posted by Schneider
Посмотреть сообщение
Add 'bPickup' to your BizInfo-enum, when you create a pickup for a business, use:
pawn Код:
BizInfo[id][bPickup] = Create(Dynamic)Pickup(......);
Then at the callback OnPlayerPickUp(Dynamic)Pickup do something like:
pawn Код:
for(new idx=1; idx<MAX_BIZ; idx++)
{
    if(pickupid == BizInfo[idx][bPickup])
    {
        new string[256];
        if(BizInfo[idx][bFee])
        {
            format(string, sizeof(string), "%s~n~~w~OWNER : %s~n~ENTRANCE FEE : ~g~%d~n~~p~TO USE /ENTER", BizInfo[idx][bName], BizInfo[idx][bOwner], BizInfo[idx][bFee]);
        }
    else
        {
            format(string, sizeof(string), "%s~n~~w~OWNER : %s~n~ENTRANCE FEE : ~g~FREE~n~~p~TO USE /ENTER", BizInfo[idx][bName], BizInfo[idx][bOwner], BizInfo[idx][bFee]);
        }
        GameTextForPlayer(playerid, string, 3000, 5);
        break;
    }
}
Helped alot, I'm using dynamic system and when I created two businsess and changed their information they both had the same one... Its like always businsess 1 information.
Reply
#5

Are you changing that info within a loop?
Reply
#6

Quote:
Originally Posted by Schneider
Посмотреть сообщение
Are you changing that info within a loop?
Yes, the information is changing for each business and another problem just came up. First I was able to pickup the both business pickups and now only the second one I created work and I created more and they're not working.

EDIT: Actually on every pickup that I pick I get the same info. Even not business pickups.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)