SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 16/11/2016, 09:06 AM   #1
marley
Little Clucker
 
Join Date: Mar 2008
Posts: 26
Reputation: 0
Default TextDraw Headache

Hey, I'm currently trying to improve the GUI of my server, so I've decided to try and keep the chat clearer by sending errors messages via TD rather than SCM. Now I haven't been using Textdraws all to often, and have only really used them for the zones and speedo within the server, so in all honesty I'm a TD n00b.

Now all I want is to be able to create a TD onplayerconnect which is blank, and then the set the string with an error message and showfor a short period of time before hiding it again when an error occurs. At the moment the textdraw correctly shows the error message and disappears but for some reason doesn't create the TD in the correct place on the screen (Bottom centre) but creates it int he middle of the screen and I can't for the life of me understand why, any help would be appreciated.

Code:
 new PlayerText:ErrorMessage[MAX_PLAYERS];


forward ShowErrorMessage(playerid,string[]);
public ShowErrorMessage(playerid, string[])
{
	if(LoggedIn[playerid] == 0) return 1;
	PlayerTextDrawSetString(playerid, ErrorMessage[playerid], string);
	PlayerTextDrawShow(playerid, ErrorMessage[playerid]);
	SetTimerEx("HideErrorMessage",41000, false, "i",playerid);
	PlayerPlaySound(playerid, 1085, 0, 0, 0);
	return 1;
}

forward HideErrorMessage(playerid);
public HideErrorMessage(playerid)
{
	PlayerTextDrawHide(playerid,ErrorMessage[playerid]);
	return 1;
}


public OnPlayerConnect(playerid)
{

	//--Error Message--//
	ErrorMessage[playerid] = CreatePlayerTextDraw(playerid,240.0,400.0,"_");
	PlayerTextDrawAlignment(playerid,ErrorMessage[playerid], 1);
	PlayerTextDrawFont(playerid,ErrorMessage[playerid],1);
	PlayerTextDrawLetterSize(playerid,ErrorMessage[playerid], 0.310, 1.400);
	PlayerTextDrawBoxColor(playerid,ErrorMessage[playerid], 0x99);
	PlayerTextDrawTextSize(playerid,ErrorMessage[playerid], 520.000, 0.000);
	PlayerTextDrawSetShadow(playerid,ErrorMessage[playerid],0);

}

//example of when Error message is used

CMD:me(playerid,params[])// /me command
{
	new string[128], action[128];// Store the intial action
	if(sscanf(params, "s[100]",action)) return ShowErrorMessage(playerid,"Usage: /me [Action]");//Error handling

 	return 1;
}
Any help would be appreciated thank you!
marley is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving a textdraw on the y-axis doesn't work. (TextDraw Editor) AndySedeyn Scripting Help 1 14/06/2014 02:50 PM
[FilterScript] [FS] TextDraw editor 0.6 - Multiple textdraw support, for proffesional textdraws Zamaroht Filterscripts 369 20/01/2013 02:46 PM
[Tutorial] --: Creating Textdraw's In The Easiest Way :-- [Helpful for textdraw creators] Nirzor Tutorials 15 04/10/2012 12:32 PM
CreateDynamicMapIcon headache... Ash. Help Archive 8 23/04/2011 04:38 AM


All times are GMT. The time now is 01:46 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.