Pickups.
#1

I have a problem with my pickups.

The house pickups show perfectly, but when it comes to business pickups, they don't work at all.

Can anyone help me please? Code is below.

pawn Код:
public PickupMessages(playerid)
{
    new string[512];
    for(new h = 1; h < MAX_HOUSES; h++)
    {
        if(IsPlayerInAnyVehicle(playerid)) return 1;
        if(IsPlayerInRangeOfPoint(playerid, 2.0, Houses[h][HouseExteriorX], Houses[h][HouseExteriorY], Houses[h][HouseExteriorZ]))
        {
            if(GetPlayerVirtualWorld(playerid) == 0)
            {
                if(strmatch(Houses[h][HouseOwner], "Nobody"))
                {
                    if(Player[playerid][AdminLevel] == 10)
                    {
                        format(string, sizeof(string), "~w~House %d~n~~b~%s~n~~w~Use ~b~/buyhouse~w~ to~n~buy this house~n~for ~g~$%d.", h, Houses[h][HouseName], Houses[h][HousePrice]);
                    }
                    else
                    {
                        format(string, sizeof(string), "~b~%s~n~~w~Use ~b~/buyhouse~w~ to~n~buy this house~n~for ~g~$%d.", Houses[h][HouseName], Houses[h][HousePrice]);
                    }
                }
                else
                {
                    if(Player[playerid][AdminLevel] == 10)
                    {
                        format(string, sizeof(string), "~w~House %d~n~~b~%s~n~~w~Owner:~g~ %s", h, Houses[h][HouseName], Houses[h][HouseOwner]);
                    }
                    else
                    {
                        format(string, sizeof(string), "~b~%s~n~~w~Owner:~g~ %s", Houses[h][HouseName], Houses[h][HouseOwner]);
                    }
                }
            }
        }
    }
    for(new b = 1; b < MAX_BUSINESS; b++)
    {
        if(IsPlayerInAnyVehicle(playerid)) return 1;
        if(IsPlayerInRangeOfPoint(playerid, 2.0, Business[b][BusinessExteriorX], Business[b][BusinessExteriorY], Business[b][BusinessExteriorZ]))
        {
            if(GetPlayerVirtualWorld(playerid) == 0)
            {
                if(Player[playerid][AdminLevel] == 10)
                {
                    format(string, sizeof(string), "~w~Business %d~n~~b~%s~n~~w~~n~Owner:~g~ %s~n~~w~Enter Fee: ~g~$%d~n~~w~~n~Type /enter to go inside", b, Business[b][BusinessName], Business[b][BusinessOwner], Business[b][BusinessEnterFee]);
                }
                else
                {
                    format(string, sizeof(string), "~w~Business~n~~b~%s~n~~w~~n~Owner:~g~ %s~n~~w~Enter Fee: ~g~$%d~n~~w~~n~Type /enter to go inside", Business[b][BusinessName], Business[b][BusinessOwner], Business[b][BusinessEnterFee]);
                }
            }
        }
    }
    GameTextForPlayer(playerid, string, 3000, 5);
    return 1;
}
Thanks!
Reply
#2

Have you added some prints to see where it stops working?
Reply
#3

I'll do that now and edit this.
Reply
#4

I added prints and it seems to stop on the line:

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 2.0, Business[b][BusinessExteriorX], Business[b][BusinessExteriorY], Business[b][BusinessExteriorZ]))
Even though I'm in range of it.
Reply
#5

There must be a problem with the co-ordinates saved in the "Business" var.

A quick way to test is to teleport yourself to that location, that way you know instantly if your co-ordinates are mixed up.
Reply
#6

How could I do that? Like, create a /gotobusiness command with the business ID in sscanf?

Then, check if it's letting me go to it? :3
Reply
#7

Quote:
Originally Posted by iGetty
Посмотреть сообщение
How could I do that? Like, create a /gotobusiness command with the business ID in sscanf?

Then, check if it's letting me go to it? :3
Use the co-ordinates from the Business file, and IG teleport yourself to those exact co-ordinates to see if they are accurate.
Reply
#8

Params is the index for your buisness.

pawn Код:
COMMAND:tp(playerid, params[])
{
    new idx = strval(params);
   
    if( idx > -1 && idx < sizeof(Business) )
    {
        SetPlayerPos(playerid, Business[idx][BusinessExteriorX], Business[idx][BusinessExteriorY], Business[idx][BusinessExteriorZ]);
    }
    return 1;
}
Reply
#9

Found the problem.. It seems to only let me go to ID 1..

No more than 1, or I'm falling in blueberry... What's wrong?

Here's my LoadBusinesses();

pawn Код:
stock LoadBusinesses()
{
    new
        Str[128],
        string[512],
        bID,
        bName[128],
        bOwner[24],
        Float:ExtX,
        Float:ExtY,
        Float:ExtZ,
        Float:IntX,
        Float:IntY,
        Float:IntZ,
        Price,
        Enterable,
        IntID,
        Fee,
        PayOut,
        Locked,
        World;

    mysql_query("SELECT * FROM `Businesses`");
    mysql_store_result();
    if(mysql_num_rows() > 0)
    {
        while(mysql_fetch_row(Str))
        {
            sscanf(Str, "p<|>is[128]s[24]ffffffiiiiiii", bID, bName, bOwner, ExtX, ExtY, ExtZ, IntX, IntY, IntZ, IntID, Price, Enterable, Fee, PayOut, Locked, World);
            BusinessPickup[bID] = CreatePickup(1272, 1, ExtX, ExtY, ExtZ, 0);
            new i = 1;
            Business[i][BusinessExteriorX] = ExtX;
            Business[i][BusinessExteriorY] = ExtY;
            Business[i][BusinessExteriorZ] = ExtZ;
            Business[i][BusinessInteriorX] = IntX;
            Business[i][BusinessInteriorY] = IntY;
            Business[i][BusinessInteriorZ] = IntZ;
            Business[i][BusinessInteriorID] = IntID;
            Business[i][BusinessPrice] = Price;
            Business[i][BusinessEnterable] = Enterable;
            Business[i][BusinessEnterFee] = Fee;
            Business[i][BusinessPayout] = PayOut;
            Business[i][BusinessLocked] = Locked;
            Business[i][BusinessWorld] = World;
            format(Business[i][BusinessName], 128, "%s", bName);
            format(Business[i][BusinessOwner], 24, "%s", bOwner);
            if(Enterable == 0)
            {
                format(string, sizeof(string), "{FF0000}%s\nOwner:{FFFFFF}%s\n{FF0000}Payout: {FFFFFF}$%d", bName, bOwner, PayOut);
            }
            else
            {
                format(string, sizeof(string), "{33FF33}%s\nEntrance Fee: {FFFFFF}$%d{33FF33}\nOwner: {FFFFFF}%s\n{33FF33}Payout: {FFFFFF}$%d", bName, Fee, bOwner,PayOut);
            }
            BusinessLabel[i] = Create3DTextLabel(string, BLUE, ExtX, ExtY, ExtZ, 7.0, 0, 1);
            i++;
            bTotal++;
        }
    }
    mysql_free_result();
    printf("%i businesses loaded from the MySQL Database.", bTotal);
}
It works for my houses, but not businesses.. It's also creating the business pickup and label in the correct place.
Reply
#10

pawn Код:
new i = 1;
Your resetting the index var to 1 every loop.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)