OnPlayerClickTextDraw Problem
#1

My server have test draw, i want to display it when login, there is my server, i write and complete, but can't click TextDraw In-Game
there is my server
Код:
#include <a_samp>
#include <core>
#include <float>
#define DIALOG_1 0
#define DIALOG_2 1
#define DIALOG_3 2
#define DIALOG_4 3
new bool:CloseTextDraw[MAX_PLAYERS];
#pragma tabsize 0
new text:TDEditor_TD0;
new text:TDEditor_TD1;
new text:TDEditor_TD2;
new text:TDEditor_TD3;
new text:TDEditor_TD4;
new text:TDEditor_TD5;
new text:TDEditor_TD6;
new text:TDEditor_TD7;
new text:TDEditor_TD8;

main()
{
	print("\n----------------------------------");
	print("  Bare Script\n");
	print("----------------------------------\n");
}

public OnPlayerConnect(playerid)
{
TogglePlayerSpectating(playerid, 1);
TextDrawShowForPlayer(playerid, TDEditor_TD0);
TextDrawShowForPlayer(playerid, TDEditor_TD1);
TextDrawShowForPlayer(playerid, TDEditor_TD2);
TextDrawShowForPlayer(playerid, TDEditor_TD3);
TextDrawShowForPlayer(playerid, TDEditor_TD4);
TextDrawShowForPlayer(playerid, TDEditor_TD5);
TextDrawShowForPlayer(playerid, TDEditor_TD6);
TextDrawShowForPlayer(playerid, TDEditor_TD7);
TextDrawShowForPlayer(playerid, TDEditor_TD8);
SelectTextDraw(playerid, 0xFF4040AA);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	new idx;
	new cmd[256];
	
	cmd = strtok(cmdtext, idx);

	if(strcmp(cmd, "/yadayada", true) == 0) {
    	return 1;
	}

	return 0;
}

public OnPlayerSpawn(playerid)
{
TextDrawHideForPlayer(playerid, TDEditor_TD0);
TextDrawHideForPlayer(playerid, TDEditor_TD1);
TextDrawHideForPlayer(playerid, TDEditor_TD2);
TextDrawHideForPlayer(playerid, TDEditor_TD3);
TextDrawHideForPlayer(playerid, TDEditor_TD4);
TextDrawHideForPlayer(playerid, TDEditor_TD5);
TextDrawHideForPlayer(playerid, TDEditor_TD6);
TextDrawHideForPlayer(playerid, TDEditor_TD7);
TextDrawHideForPlayer(playerid, TDEditor_TD8);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
   	return 1;
}



public OnGameModeInit()
{


TDEditor_TD0 = TextDrawCreate(140.625000, 121.749992, "box");
TextDrawLetterSize(TDEditor_TD0, 0.000000, 19.187500);
TextDrawTextSize(TDEditor_TD0, 514.000000, 0.000000);
TextDrawAlignment(TDEditor_TD0, 1);
TextDrawColor(TDEditor_TD0, -1);
TextDrawUseBox(TDEditor_TD0, 1);
TextDrawBoxColor(TDEditor_TD0, 255);
TextDrawSetShadow(TDEditor_TD0, 0);
TextDrawSetOutline(TDEditor_TD0, 0);
TextDrawBackgroundColor(TDEditor_TD0, 255);
TextDrawFont(TDEditor_TD0, 1);
TextDrawSetProportional(TDEditor_TD0, 1);
TextDrawSetShadow(TDEditor_TD0, 0);

TDEditor_TD1 = TextDrawCreate(156.875000, 133.999969, "box");
TextDrawLetterSize(TDEditor_TD1, 0.000000, 1.437500);
TextDrawTextSize(TDEditor_TD1, 318.000000, 0.000000);
TextDrawAlignment(TDEditor_TD1, 1);
TextDrawColor(TDEditor_TD1, -1);
TextDrawUseBox(TDEditor_TD1, 1);
TextDrawBoxColor(TDEditor_TD1, -16776961);
TextDrawSetShadow(TDEditor_TD1, 0);
TextDrawSetOutline(TDEditor_TD1, 0);
TextDrawBackgroundColor(TDEditor_TD1, 255);
TextDrawFont(TDEditor_TD1, 1);
TextDrawSetProportional(TDEditor_TD1, 1);
TextDrawSetShadow(TDEditor_TD1, 0);

TDEditor_TD2 = TextDrawCreate(337.125854, 133.616638, "box");
TextDrawLetterSize(TDEditor_TD2, 0.000000, 1.437500);
TextDrawTextSize(TDEditor_TD2, 500.000854, 0.000000);
TextDrawAlignment(TDEditor_TD2, 1);
TextDrawColor(TDEditor_TD2, -1);
TextDrawUseBox(TDEditor_TD2, 1);
TextDrawBoxColor(TDEditor_TD2, -16776961);
TextDrawSetShadow(TDEditor_TD2, 0);
TextDrawSetOutline(TDEditor_TD2, 0);
TextDrawBackgroundColor(TDEditor_TD2, 255);
TextDrawFont(TDEditor_TD2, 1);
TextDrawSetProportional(TDEditor_TD2, 1);
TextDrawSetShadow(TDEditor_TD2, 0);

TDEditor_TD3 = TextDrawCreate(337.225860, 240.523162, "box");
TextDrawLetterSize(TDEditor_TD3, 0.000000, 1.437500);
TextDrawTextSize(TDEditor_TD3, 500.100860, 0.000000);
TextDrawAlignment(TDEditor_TD3, 1);
TextDrawColor(TDEditor_TD3, -1);
TextDrawUseBox(TDEditor_TD3, 1);
TextDrawBoxColor(TDEditor_TD3, -16776961);
TextDrawSetShadow(TDEditor_TD3, 0);
TextDrawSetOutline(TDEditor_TD3, 0);
TextDrawBackgroundColor(TDEditor_TD3, 255);
TextDrawFont(TDEditor_TD3, 1);
TextDrawSetProportional(TDEditor_TD3, 1);
TextDrawSetShadow(TDEditor_TD3, 0);

TDEditor_TD4 = TextDrawCreate(155.873870, 240.639877, "box");
TextDrawLetterSize(TDEditor_TD4, 0.000000, 1.437500);
TextDrawTextSize(TDEditor_TD4, 317.398010, 0.000000);
TextDrawAlignment(TDEditor_TD4, 1);
TextDrawColor(TDEditor_TD4, -1);
TextDrawUseBox(TDEditor_TD4, 1);
TextDrawBoxColor(TDEditor_TD4, -16776961);
TextDrawSetShadow(TDEditor_TD4, 0);
TextDrawSetOutline(TDEditor_TD4, 0);
TextDrawBackgroundColor(TDEditor_TD4, 255);
TextDrawFont(TDEditor_TD4, 1);
TextDrawSetProportional(TDEditor_TD4, 1);
TextDrawSetShadow(TDEditor_TD4, 0);

TDEditor_TD5 = TextDrawCreate(193.125000, 132.250076, "dang_nhap");
TextDrawLetterSize(TDEditor_TD5, 0.400000, 1.600000);
TextDrawAlignment(TDEditor_TD5, 1);
TextDrawColor(TDEditor_TD5, -1);
TextDrawSetShadow(TDEditor_TD5, 0);
TextDrawSetOutline(TDEditor_TD5, 0);
TextDrawBackgroundColor(TDEditor_TD5, 255);
TextDrawFont(TDEditor_TD5, 2);
TextDrawSetProportional(TDEditor_TD5, 1);
TextDrawSetShadow(TDEditor_TD5, 0);

 
TDEditor_TD6 = TextDrawCreate(387.500000, 132.250015, "dang_ki");
TextDrawLetterSize(TDEditor_TD6, 0.400000, 1.600000);
TextDrawAlignment(TDEditor_TD6, 1);
TextDrawColor(TDEditor_TD6, -1);
TextDrawSetShadow(TDEditor_TD6, 0);
TextDrawSetOutline(TDEditor_TD6, 0);
TextDrawBackgroundColor(TDEditor_TD6, 255);
TextDrawFont(TDEditor_TD6, 2);
TextDrawSetProportional(TDEditor_TD6, 1);
TextDrawSetShadow(TDEditor_TD6, 0);

TDEditor_TD7 = TextDrawCreate(197.500000, 239.583343, "thong_tin");
TextDrawLetterSize(TDEditor_TD7, 0.400000, 1.600000);
TextDrawAlignment(TDEditor_TD7, 1);
TextDrawColor(TDEditor_TD7, -1);
TextDrawSetShadow(TDEditor_TD7, 0);
TextDrawSetOutline(TDEditor_TD7, 0);
TextDrawBackgroundColor(TDEditor_TD7, 255);
TextDrawFont(TDEditor_TD7, 2);
TextDrawSetProportional(TDEditor_TD7, 1);
TextDrawSetShadow(TDEditor_TD7, 0);

TDEditor_TD8 = TextDrawCreate(394.375000, 239.583251, "thoat");
TextDrawLetterSize(TDEditor_TD8, 0.400000, 1.600000);
TextDrawAlignment(TDEditor_TD8, 1);
TextDrawColor(TDEditor_TD8, -1);
TextDrawSetShadow(TDEditor_TD8, 0);
TextDrawSetOutline(TDEditor_TD8, 0);
TextDrawBackgroundColor(TDEditor_TD8, 255);
TextDrawFont(TDEditor_TD8, 2);
TextDrawSetProportional(TDEditor_TD8, 1);
TextDrawSetShadow(TDEditor_TD8, 0);

CreateObject(18685, -1978.024291, 698.321960, 116.337944, 0.000000, 0.000000, 0.000000);
CreateObject(18685, -1963.524169, 698.254272, 110.530006, 0.000000, 0.000000, 0.000000);
CreateObject(18685, -1946.862426, 703.784179, 111.003936, 0.000000, 0.000000, 0.000000);
CreateObject(18685, -1925.727539, 699.682922, 94.239471, 0.000000, 0.000000, 0.000000);
CreateObject(18685, -1967.538085, 704.658264, 84.664375, 0.000000, 0.000000, 0.000000);
CreateObject(18685, -1952.495727, 702.428527, 73.010231, 0.000000, 0.000000, 0.000000);
CreateObject(18685, -1992.343383, 682.812011, 99.208236, 0.000000, 0.000000, 0.000000);
CreateObject(18685, -1991.730102, 690.763305, 66.122108, 0.000000, 0.000000, 0.000000);
CreateObject(18685, -1994.706787, 671.660888, 72.001434, 0.000000, 0.000000, 0.000000);
CreateObject(18685, -1997.201538, 637.765686, 70.674072, 0.000000, 0.000000, 0.000000);
CreateObject(18685, -1997.760498, 630.682373, 86.484962, 0.000000, 0.000000, 0.000000);
CreateObject(18685, -1993.781738, 648.667053, 113.226562, 0.000000, 0.000000, 0.000000);
CreateObject(18685, -1993.278198, 627.450073, 107.081062, 0.000000, 0.000000, 0.000000);
CreateObject(18682, -1984.688354, 615.688598, 99.696891, 0.000000, 0.000000, 0.000000);
CreateObject(18682, -1959.941406, 616.471862, 65.973213, 0.000000, 0.000000, 0.000000);
CreateObject(18682, -1926.114868, 618.816589, 114.189254, 0.000000, 0.000000, 0.000000);
CreateObject(18685, -1971.994873, 620.362670, 131.815444, 0.000000, 0.000000, 0.000000);
CreateObject(18682, -1907.688964, 629.269470, 135.066955, 0.000000, 0.000000, 0.000000);
CreateObject(18682, -1907.473510, 664.968261, 122.089134, 0.000000, 0.000000, 0.000000);
CreateObject(18682, -1902.050659, 640.101196, 108.568145, 0.000000, 0.000000, 0.000000);
CreateObject(18682, -1905.754028, 674.513793, 97.731964, 0.000000, 0.000000, 0.000000);
CreateObject(18682, -1909.753417, 634.529846, 73.201766, 0.000000, 0.000000, 0.000000);
CreateObject(18682, -1911.594726, 679.134887, 58.172752, 0.000000, 0.000000, 0.000000);
CreateObject(18682, -1914.219848, 695.497985, 68.812637, 0.000000, 0.000000, 0.000000);
CreateObject(18682, -1944.964599, 705.314331, 71.962860, 0.000000, 0.000000, 0.000000);
CreateObject(18682, -1955.469116, 676.881652, 121.686347, 0.000000, 0.000000, 0.000000);
CreateObject(18682, -1954.063964, 663.945922, 115.154716, 0.000000, 0.000000, 0.000000);
CreateObject(18682, -1926.744750, 651.226257, 125.537391, 0.000000, 0.000000, 0.000000);
CreateObject(18682, -1953.452880, 659.070007, 64.297111, 0.000000, 0.000000, 0.000000);
	SetGameModeText("Bare Script");
	ShowPlayerMarkers(1);
	ShowNameTags(1);
	AllowAdminTeleport(1);


   
return 1;
}
strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
	new Babatz = GetPlayerVehicleSeat(playerid);
    if(!IsPlayerInAnyVehicle(playerid))
    {
    	SetPlayerPosFindZ(playerid, fX, fY, fZ);
    }
    else
    {
    	new Batz = GetPlayerVehicleID(playerid);
     	SetVehiclePos(Babatz,fX,fY,fZ);
      	PutPlayerInVehicle(playerid,Babatz,Batz);
 	}
    return 1;
}
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
      if(clickedid == TDEditor_TD5)
        {
        ShowPlayerDialog(playerid, DIALOG_1, DIALOG_STYLE_PASSWORD, "Dang Nhap", "Hay Nhap Mat Khau De Dang Nhap","Dang Nhap","Huy");
        SelectTextDraw(playerid, 0x00FF00FF);

        return 1;
        }
        else if(clickedid == TDEditor_TD6)
        {
		ShowPlayerDialog(playerid, DIALOG_2, DIALOG_STYLE_INPUT, "Dang Ki", "Hay Nhap Mat Khau De Dang Ki","Dang Nhap","Huy");
        SelectTextDraw(playerid, 0x00FF00FF);

		return 1;
		}
      else if(clickedid == TDEditor_TD7)
        {
        ShowPlayerDialog(playerid, DIALOG_3, DIALOG_STYLE_MSGBOX, "Thong Tin May Chu","San Andreas File-X-survival V1.2 by Le Phi Truong va Le Phi Long","Hieu Ro","Huy");
        SelectTextDraw(playerid, 0x00FF00FF);

        return 1;
        }
      else if(clickedid == TDEditor_TD8)
        {
        Kick(playerid);
		SelectTextDraw(playerid, 0x00FF00FF);

		return 1;
        }
	 return 0;
}
Anyone can help me
Reply
#2

What do you mean can't click the textdraw? Do you mean the textdraw is not showing when you logged-in?
Reply
#3

1. You never made it clickable
2. You never defined the range for each button.

Read this please: https://sampforum.blast.hk/showthread.php?tid=328267
This turorial explains enough to understand the problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)