SA-MP Forums Archive
Why isnt this working? ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Why isnt this working? ? (/showthread.php?tid=174906)



Why isnt this working? ? - mrcoolballs - 07.09.2010

okay im trying to make a business script but i cant get this pickup to display the string when i pick it up!

pawn Код:
public OnPlayerPickUpPickup(playerid,pickupid)
{
    for(new C; C<BusinessCount+1; C++)
    {
        if(pickupid == 1272)
        {
            new str[150];
            new Pname[24];
            if(BusinessInfo[C][BusOwner] == -1) format(str, sizeof(str), "%s ~n~~r~Cost price: $%d ~b~Sale price: $%d ~n~ ~g~Earn ammount: $%d", BusinessInfo[C][BusName], BusinessInfo[C][BusCost], BusinessInfo[C][BusSell], BusinessInfo[C][BusEarn]); //Makes the string for a business with no owner.
            if(BusinessInfo[C][BusOwner] != -1)
            {
                GetPlayerName(BusinessInfo[C][BusOwner], Pname, 24);
                format(str, sizeof(str), "%s ~n~~r~Cost price: $%d ~b~Sale price: $%d ~n~ ~g~Earn ammount: $%d~n~~w~Owner: %s(%d)", BusinessInfo[C][BusName], BusinessInfo[C][BusCost], BusinessInfo[C][BusSell], BusinessInfo[C][BusEarn], Pname, BusinessInfo[C][BusOwner]);
                GameTextForPlayer(playerid, str, 3000, 3);
            }
           
        }
    }
    return 1;
}
and yes all the variables in the code do work properly, so any ideas as to why it doesnt display anything when i walk through the pickup?


Re: Why isnt this working? ? - LarzI - 07.09.2010

Are you sure the pickupid is 1272... ?
I believe that's the model, not the ID.


Re: Why isnt this working? ? - mrcoolballs - 07.09.2010

nope i just seached up on wiki and 1272 is a blue house icon, i can see the pickup just nothing happens when i walk into it


Re: Why isnt this working? ? - LarzI - 07.09.2010

After adding pickups (AddStaticPickup), they get assigned to an ID.
First pickup's ID = 0, next one's 1 etc..

I recommend making a global variable called something like "myPickup", then when you use AddStaticPickup, assign myPickup to it.

pawn Код:
myPickup = AddStaticPickup( stuff );
So then you can du
pawn Код:
if( pickupid == myPickup )



Re: Why isnt this working? ? - mrcoolballs - 07.09.2010

damn, unfortunetly it still isnt working, i just tried that