SA-MP Forums Archive
Where did I do wrong? - 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: Where did I do wrong? (/showthread.php?tid=427655)



Where did I do wrong? - Pawnie - 02.04.2013

Hello guys, well my textdraws seems not to work at all.

Код:
new Text:JoinArena;
new ArenaStarted;


//GameModeInit
JoinArena = TextDrawCreate(503.000000, 389.000000, "Join Arena");
	TextDrawBackgroundColor(JoinArena, 255);
	TextDrawFont(JoinArena, 1);
	TextDrawLetterSize(JoinArena, 0.519999, 1.600000);
	TextDrawColor(JoinArena, -1);
	TextDrawSetOutline(JoinArena, 0);
	TextDrawSetProportional(JoinArena, 1);
	TextDrawSetShadow(JoinArena, 1);
    TextDrawTextSize(JoinArena, 15.0, 75.0);

public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(_:clickedid != INVALID_TEXT_DRAW) 
    {
        if(clickedid == JoinArena)
        {
	        if(ArenaStarted == 1)
	        {
	         	SendClientMessage(playerid, COLOR_RED, "Arena already started. Putting you in queue!");
					TextDrawHideForPlayer(playerid, JoinArena);
	         	return 1;
			}
			else
			{
			    SendClientMessage(playerid, COLOR_YELLOW, "<!>Bla!");
    			CancelSelectTextDraw(playerid);
			}
		}
		return 1;
    }

    return 1;
}

public OnPlayerConnect(playerid)
{

    TextDrawSetSelectable(JoinArena, true);
    SelectTextDraw(playerid, 0x00FF00FF);
	PlayerTextDrawSetSelectable(playerid, PlayerText:JoinArena, 1);
    
    TextDrawShowForPlayer(playerid, JoinArena);
	 return 1;
}

forward ArenaStarts();
public ArenaStarts() //Starts the ArenaStarts timer, which is the queue timer. If the player is in queue he will get Tp-ed into the arena
{
	foreach (new i : Player)
	{
        ArenaStarted = 0;
        SendClientMessageToAll(COLOR_YELLOW, "ARENA IS FINISHED! Enter the queue in order to join arena!");
        SetTimer("ArenaJoin", 30000, false);
        SetTimerEx("count1", 1000, false, "i", i);
        //SetArenaPos - being worked.
	}
	return 1;
}

forward ArenaStart();
public ArenaStart() //Starts the actual arena, also sets the arenastarted to 1 so players cannot join it. They can only join the queue
{
    foreach (new i : Player)
	{
	    ArenaStarted = 1;
	    SetTimer("ArenaStarts", 90000, false);
	}
	return 1;
}
You see the textdraw, you are set into the Textdraw selection but you cannot click it. Once you click it nothing happens.


Re: Where did I do wrong? - DiGiTaL_AnGeL - 02.04.2013

TextDrawTextSize.
I didn't knew about this function too, but realcop told me :
Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Take this as an example:
pawn Код:
PlayerTextDrawTextSize(playerid,Textdraw0, 130.000000, 0.000000);
If I just had that code, you wouldn't be able to select the TD. For some reason, most editors don't seem to account for this automatically, so we as programmers have to go in and do it ourselves. If you're not lazy, it's no big deal! However, I used TD's like crazy in my mode, so it is a pain in the ass...

Anyways!

pawn Код:
PlayerTextDrawTextSize(playerid,Textdraw0, 130.000000, 10.000000);
I changed the 0.00000000 to 10.00000000- the TD should become "selectable" now.



Re: Where did I do wrong? - Pawnie - 02.04.2013

Ahhhh, I got it now

I also added
TextDrawTextSize(JoinArena, 505.000000, 391.000000)
and it works perfectly. Thanks for the tips. +Rep