SA-MP Forums Archive
Problems with for() - 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: Problems with for() (/showthread.php?tid=266371)



Problems with for() - Gomma - 04.07.2011

Hello,

I created a little Bizz & House System for my server. Everything is working fine but this part. I wrote this under OnPlayerPickupPickup, but it doesn't seem to work:

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
for(new bid = 0; bid < sizeof(BizzInfo) ; bid++)
    {
        if(pickupid == BizzInfo[bid][BPick])
        {
            new string[164];

            if(BizzInfo[bid][HasOwner] == 0)
            {
                format(string,sizeof(string),"~w~Name: ~y~%s~n~~w~Besitzer: ~g~Keiner~n~~r~/bizzinfo",BizzInfo[bid][Name]);
                GameTextForPlayer(playerid,string,2500,3);
            }
            else if(BizzInfo[bid][HasOwner] == 1)
            {
                format(string,sizeof(string),"~w~Name: ~y~%s~n~~w~Besitzer: ~g~%s~n~~r~/bizzinfo",BizzInfo[bid][Name],BizzInfo[bid][Owner]);
                GameTextForPlayer(playerid,string,2500,3);
            }
        }
    }
   
    for(new hid = 0; hid < sizeof(HouseInfo) ; hid++)
    {
        if(pickupid == HouseInfo[hid][HPick])
        {
            new string[164];

            if(HouseInfo[hid][HasOwner] == 0)
            {
                format(string,sizeof(string),"~w~Besitzer: ~g~Keiner~n~~y~ID: %d~n~~r~/hausinfo",HouseInfo[hid][ID]);
                GameTextForPlayer(playerid,string,2500,3);
            }
            else if(HouseInfo[hid][HasOwner] == 1)
            {
                format(string,sizeof(string),"~w~Besitzer: ~g~%s~n~~y~ID: %d~n~~r~/hausinfo",HouseInfo[hid][Owner],HouseInfo[hid][ID]);
                GameTextForPlayer(playerid,string,2500,3);
            }
        }
    }
return 1;
}
# The variables BizzInfo and HouseInfo are defined at a other part of the script. Don't worry about them.


So I don't really know how to do this or what is wrong with the code.

Anyway, thanks in advance


AW: Re: Problems with for() - Gomma - 04.07.2011

Quote:
Originally Posted by ******
Посмотреть сообщение
OK, well what would help is telling us what it's meant to do and what it does do. Just saying "it doesn't work" is no help as we've got no way of knowing what it should be doing that it isn't.
Well it is supposed to display a GameText, showing some informations about the Bizz / House to a player.


BizzInfo[bid][BPick] = The pickup for businesses

HouseInfo[hid][HPick] = The pickup for houses


So far, it only works for one pickup. That means it does display the informations for a house pickup, but not those for a business pickup when you pick them up.