SA-MP Forums Archive
Is it possible to update gametextforplayer? - 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)
+--- Thread: Is it possible to update gametextforplayer? (/showthread.php?tid=301173)



Is it possible to update gametextforplayer? - Dokins - 03.12.2011

as in:

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    new string[256];

    for(new x = 0; x < MAX_HOUSES; x++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseEntX[x], HouseEntY[x], HouseEntZ[x]))
        {
            if(pickupid == HousePickup[x])
            {
                if(!(strcmp(HouseOwner[x], "nobody", true)))
                {
                    UnOwnedString[x] = format(string, sizeof(string), "~r~For Sale : %s~n~~w~Price: $%d~n~~b~Type '/buyhouse' to purchase.", HouseName[x], HousePrice[x]);
                }
                else
                {
                    OwnedString[x] = format(string, sizeof(string), "~g~Address:~w~ %s ~n~ ~g~Owner:~w~ %s", HouseName[x], HouseOwner[x]);
                }

                GameTextForPlayer(playerid, string, 3000, 5);
                break;
            }
        }
CANNOT FIGURE WHY THE HELL THAT WONT UPDATE!! Sorry for cap's been at it for 2 hours.


Re: Is it possible to update gametextforplayer? - MP2 - 03.12.2011

What exactly do you mean by 'update'?


Re: Is it possible to update gametextforplayer? - Dokins - 03.12.2011

Well when I /buyhouse, it wont call "else" i've tried replacing it with an if statement also.


Re: Is it possible to update gametextforplayer? - MP2 - 03.12.2011

It would be better to have a boolean value to store whether a property is owned. Anyone can join with the name 'nobody'.


Re: Is it possible to update gametextforplayer? - Dokins - 03.12.2011

I tried that also. But it didnt work at all! it just didnt work.

Edit: I created a variable called ForSale and if it was for sale then it would display the first one and if it wasnt i.e 0. It would return the "else", It just returned else all the time.


Re: Is it possible to update gametextforplayer? - Emmet_ - 03.12.2011

Try this sir:

pawn Код:
if(strcmp(HouseOwner[x],"Nobody",true,5)) // This will check if it's not Nobody, but if it was, it would be if(!strcmp.
                {
                    OwnedString[x] = format(string, sizeof(string), "~g~Address:~w~ %s ~n~ ~g~Owner:~w~ %s", HouseName[x], HouseOwner[x]);
                }
                else
                {
                    UnOwnedString[x] = format(string, sizeof(string), "~r~For Sale : %s~n~~w~Price: $%d~n~~b~Type '/buyhouse' to purchase.", HouseName[x], HousePrice[x]);
                }



Re: Is it possible to update gametextforplayer? - Dokins - 03.12.2011

Still does the exact same thing, I've tried a variable but it just returns else.


Re: Is it possible to update gametextforplayer? - Dokins - 03.12.2011

Anyone else have an idea?


Re: Is it possible to update gametextforplayer? - HB - 03.12.2011

pawn Код:
if(!strcmp(HouseOwner[x], "nobody", true))
Also make your string 128. The max string output of the client messages is 128.