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



CreateTextDraw - Man43 - 13.05.2017

Hello what's wrong here..


Код:
HouseMenu = TextDrawCreate(7.000000, 123.000000, "~r~~g~House Menu");
  TextDrawAlignment(HouseMenu, 0);
  TextDrawBackgroundColor(HouseMenu, 0x0000ffff);
  TextDrawFont(HouseMenu, 1);
  TextDrawLetterSize(HouseMenu, 0.299999, 0.900000);
  TextDrawColor(HouseMenu, 0xffff00ff);
  TextDrawSetOutline(HouseMenu, 1);
  TextDrawSetProportional(HouseMenu, 1);
  TextDrawSetShadow(HouseMenu, 1);
  
  HouseMenu1 = TextDrawCreate(7.000000, 136.000000, "House Menu\n\n~w~1. ~r~Enter This House ~g~(Coming Soon)\n~w~2. ~r~Renting ~g~(Coming Soon)\n~w~3. ~r~Break This house ~g~(Coming Soon)\n~w~4. ~r~Password ~g~(Coming Soon)");
  TextDrawAlignment(HouseMenu1, 0);
  TextDrawLetterSize(HouseMenu1, 0.299999, 0.900000);
  TextDrawColor(HouseMenu1, 0xffff00ff);
  TextDrawSetOutline(HouseMenu1, 1);
  TextDrawSetProportional(HouseMenu1, 1);
  TextDrawSetShadow(HouseMenu1, 1);


  HouseBuy = TextDrawCreate(7.000000, 123.000000, "Do you want buy this house?");
  TextDrawAlignment(HouseBuy, 0);
  TextDrawBackgroundColor(HouseBuy, 0xF6F600AA);
  TextDrawFont(HouseBuy, 1);
  TextDrawLetterSize(HouseBuy, 0.499999, 1.200000);
  TextDrawColor(HouseBuy, 0x0000ffff);
  TextDrawSetOutline(HouseBuy, 1);
  TextDrawSetProportional(HouseBuy, 1);
  TextDrawSetShadow(HouseBuy, 1);
  
  HouseBuy1 = TextDrawCreate(7.000000, 136.000000, "~n~~w~1. ~p~Purchase House ~r~(Soon)\n\n2. Visit House ~r~(Soon)");
  TextDrawAlignment(HouseBuy1, 0);
  TextDrawLetterSize(HouseBuy1, 0.299999, 0.900000);
  TextDrawColor(HouseBuy1, 0xffff00ff);
  TextDrawSetOutline(HouseBuy1, 1);
  TextDrawSetProportional(HouseBuy1, 1);
  TextDrawSetShadow(HouseBuy1, 1);
Im not showing it when entering the CP's

TextDrawShowForPlayer(playerid,HouseMenu);
TextDrawShowForPlayer(playerid,HouseMenu1);
TextDrawShowForPlayer(playerid,HouseBuy);
TextDrawShowForPlayer(playerid,HouseBuy1);


Re: CreateTextDraw - Stones - 13.05.2017

Do you have anything under
Код:
OnPlayerSpawn
and
Код:
OnPlayerEnterCheckPoint
?


Re: CreateTextDraw - Man43 - 13.05.2017

No sir, i have on

OnPlayerEnterDynamicCheckpoint


Re: CreateTextDraw - Stones - 13.05.2017

Код:
public OnPlayerEnterDynamicCP(playerid)
{
     TextDrawShowForPlayer(playerid,HouseMenu);
     TextDrawShowForPlayer(playerid,HouseMenu1);
     TextDrawShowForPlayer(playerid,HouseBuy);
     TextDrawShowForPlayer(playerid,HouseBuy1);
}
I'm presuming this is what you already have ?


Re: CreateTextDraw - Tord - 13.05.2017

If you plan to show unique house information for each checkpoint - I suggest you to use Player Textdraws, as the information varies between each case. Two players may enter the checkpoints simultaneously, and that will mix up the information for the textdraws as they are set up right now.

Aside from that, make sure that you "show" the textdraws as @Stones above mentioned, and that they are created properly when the gamemode/filterscript initialises.


Re: CreateTextDraw - Man43 - 13.05.2017

Код:
if(HInfo[i][Owned] == 1 && strcmp(HInfo[i][Owner],pName) != 0)//Checking if the house is owned but the house owner and the players name don't match.
  {
  TextDrawShowForPlayer(playerid,HouseMenu);
  TextDrawShowForPlayer(playerid,HouseMenu1);
  SendClientMessage(playerid,-1,"Error: You cannot entering this house.");
  }
  if(HInfo[i][Owned] == 0)//Simply checking if the house isn't owned.
  {
  TextDrawShowForPlayer(playerid,HouseBuy);
  TextDrawShowForPlayer(playerid,HouseBuy1);
  SendClientMessage(playerid,-1,"If you like this house type /buyhouse.");
  }
OnPlayerEnterDynamicCheckpoint


Re: CreateTextDraw - Tord - 13.05.2017

Have you created Dynamic Checkpoints, or have you created Checkpoints?

One doesn't worth on both


Re: CreateTextDraw - Man43 - 13.05.2017

Yes im creating 2 dynamic checkpoints
Код:
CMD:createhouse(playerid,params[])
{
  if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You aren't an admin!");//Check if the player is currently rcon logged in.
  new HousePrice,id = HouseCount;//Creating the house price for the selected value in the command, and the last house id created.
  if(sscanf(params,"i",HousePrice)) return SendClientMessage(playerid,-1,"USAGE: /createhouse <price>");//Checking if the player uses the correct syntax. The parameter "i" in sscanf means integer, also could be used as "d".
  new Float:x,Float:y,Float:z;//Creating the floats, to store the player's position.
  GetPlayerPos(playerid,x,y,z);//Getting the player's position and storing it
  HInfo[id][Price] = HousePrice;//Setting the house price to the selected one.
  HInfo[id][Owned] = 0;//Setting the house id owned = 0
  HInfo[id][XPos] = x;//Storing the XPos value to the player's x.
  HInfo[id][YPos] = y;//Storing the YPos value to the player's y.
  HInfo[id][ZPos] = z;//Storing the ZPos value to the player's z.
  HInfo[id][VirtualWorld] = GetPlayerVirtualWorld(playerid);
  format(HInfo[id][Owner],24,"Nonusablenameforthishouse");//Formating the "Owner" house id value to "Nonusablenameforthishouse".
  SendClientMessage(playerid,-1,"House created");
  HouseEnter[id] = CreateDynamicCP(x,y,z,1.5,GetPlayerVirtualWorld(playerid));//Creating the checkpoint and storing it in the HouseEnter value.
  HouseExit[id] = CreateDynamicCP(443.9237,509.4609,1001.4195,1.5,GetPlayerVirtualWorld(playerid));//Creating the house exit checkpoint and storing it in the HouseExit value.
  new file[40],labelstring[100];//Creating the "file", and the labelstring var.
  format(file,sizeof(file),"FHouse/Houses/%i.ini",id);//Formating the var to the selected house directory.
  INI_Open(file);//Opening the file with SII.
  INI_WriteInt("Price",HousePrice);//Writing in the place "Price" the inputted "Price" value.
  INI_WriteInt("Owned",0);//Setting to "Owned" = 0 in the ini file.
  INI_WriteInt("VirtualWorld",GetPlayerVirtualWorld( playerid));//Writing "VirtualWorld" = GetPlayerVirtualWorld(..);
  INI_WriteFloat("XPos",x);//Writing the players pos for the check point position.
  INI_WriteFloat("YPos",y);//Self explanatory.
  INI_WriteFloat("ZPos",z);//Self explanatory.
  INI_WriteString("Owner","Nonusablenameforthishouse ");//Writing a string in "Owned" to "Nonusablenameforthishouse"
  INI_Save();//Saving file with SII.
  INI_Close();//Closing the file with SII.
  format(labelstring,sizeof(labelstring),"{FFFFFF}[{FF0000}House For Sale{FFFFFF}]\n{FF0000}Price: {0FFF00}%i",HousePrice);
  HInfo[id][HouseLabel] = Create3DTextLabel(labelstring,0xFF0000FF,x,y,z,25.0,GetPlayerVirtualWorld(playerid));
  HouseCount++;
  return 1;
}



Re: CreateTextDraw - Tord - 13.05.2017

I can't see what's wrong with your code.

What happens? I assume nothing, since no textdraws show up.
Have you tried adding debug messages, saying something like "You entered a house checkpoint" - in order to find out if the code is being called or not?


Re: CreateTextDraw - Man43 - 13.05.2017

noo. There are no errors.. Only there a problem... Look here.

Im creating a menus but after i entering the checkpoints im not see it What's wrong there?