SA-MP Forums Archive
Textdraws - 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: Textdraws (/showthread.php?tid=211738)



Textdraws - Baboon - 15.01.2011

So here is my main question: Why does it shows the changed (formatted) textdraw for everyone, but why not only for the player who has bought the weapon? How can I fix this?

Code:
public OnPlayerSelectedMenuRow(playerid, row)//shop
{
        TogglePlayerControllable(playerid,1);
	new Menu: Current = GetPlayerMenu(playerid);
	ShowMenuForPlayer(HIMenu,playerid);
	if(Current == HIMenu)
	{
		SetPlayerInterior(playerid,6);
		switch(row)
		{
			case 0:
      		        {
				if(GetPlayerMoney(playerid) >= 15000)//m4
				{
				        if(m4text[playerid] == 1)
					{
					    ShowMenuForPlayer(HIMenu,playerid);
						return SendClientMessage(playerid, WHITE, "you already bought this weapon...");
					}
					GivePlayerMoney(playerid, -15000);
					ShowMenuForPlayer(HIMenu,playerid);
					TogglePlayerControllable(playerid,0);
					m4text[playerid] = 1;
					ak74textspawn[playerid] = 0;
					if(ak74text[playerid] == 1)
					{
						ak74text[playerid] = 0;
					}
					if(mp5text[playerid] == 1)
					{
						mp5text[playerid] = 0;
					}
					if(shotguntext[playerid] == 1)
					{
						shotguntext[playerid] = 0;
					}
					SetPVarString(playerid,"currentprimary","M4A1");
    			        }
				else
				{
    				SendClientMessage(playerid, WHITE, "You don't have enough money.");
    				ShowMenuForPlayer(HIMenu,playerid);
					TogglePlayerControllable(playerid,0);
				}
   			}
Code:
public updateweapon()
{
	for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
	{
	    GetPVarString(playerid, "currentprimary", Primary, 25);
	    GetPVarString(playerid, "currentsecondary", Secondary, 25);
	    GetPVarString(playerid, "currentextra", Extra, 25);
	    TextDrawSetString(primary,Primary);
	    TextDrawSetString(secondary,Secondary);
	    TextDrawSetString(extra,Extra);
	}
	return 1;
}
the show is in the shop (at player spawn)....
changing public updateweapon() to public updateweapon(playerid) didn't helped either..
Any ideas to fix this? Is there some kind of TextDrawSetStringForPlayer ?? It is for my shop..


Re: Textdraws - *IsBack - 16.01.2011

I can't see TextDrawShowForPlayer anywhere in the script you posted.. :/


Re: Textdraws - Baboon - 16.01.2011

Quote:

the show is in the shop (at player spawn)....

So under if(shop[playerid] == 1)
the show is there.

but I guess it is the TextDrawSetString, isnt there some kind of function that this only counts for one player?