SA-MP Forums Archive
How i make... - 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: How i make... (/showthread.php?tid=214233)



How i make... - Rock18 - 20.01.2011

Hello , i'd like to know how i can make a textdraw disappear after 10 seconds.I know , i have to use a timer but i don't know how to make the textdraw disspear .


AW: How i make... - Nero_3D - 20.01.2011

TextDrawDestroy(Text:text); or TextDrawHideForAll(Text:text); or TextDrawHideForPlayer(playerid, Text:text);

What they do should be clear just use the one you need


Re: How i make... - Rock18 - 20.01.2011

No errors but the textdraw doesn't appear
this is the code
Код:
#include <a_samp>

new Text:Textdraw0;

public OnFilterScriptInit()
{
	print("Textdraw file generated by");
	print("    Zamaroht's textdraw editor was loaded.");
	
	SetTimer("InCar",10000,1);

	Textdraw0 = TextDrawCreate(288.000000, 430.000000, "Apasa 2 pentru a repara masina si apasa CLICK pentru a adauga nitro!");
	TextDrawBackgroundColor(Textdraw0, 255);
	TextDrawFont(Textdraw0, 1);
	TextDrawLetterSize(Textdraw0, 0.280000, 1.000000);
	TextDrawColor(Textdraw0, 1502239743);
	TextDrawSetOutline(Textdraw0, 1);
	TextDrawSetProportional(Textdraw0, 1);

	return 1;
}

public OnFilterScriptExit()
{
	TextDrawHideForAll(Textdraw0);
	TextDrawDestroy(Textdraw0);
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
	{
		TextDrawShowForPlayer(playerid, Textdraw0);
	}
	else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
	{
		TextDrawHideForPlayer(playerid, Textdraw0);
	}
	return 1;
}

forward InCar();
public InCar()
{
TextDrawDestroy(Text:Textdraw0);
return 1;
}
What's wrong ?


Re: How i make... - silvan - 20.01.2011

if you " Destroy " it you're like deleting it from the server, if you want to remove it for just little time, use the Hide function instead... Destroy is there to remove it permanently till reset the script or define the textdraw again. correct me ppl if i'm wrong with this ^^.


Re: How i make... - Rock18 - 20.01.2011

Silvan , what i am trying to do is , when a player enter a car the textdraw will appear and say "Press 2 to repair the car and CLICK to add Nitro" after 10 seconds the textdraw disappears , when he enter in car again , textdraw appears ...after 10 seconds dispappears ... you understand ?


AW: How i make... - Nero_3D - 21.01.2011

Change
pawn Код:
SetTimer("InCar",10000,1);
to
pawn Код:
SetTimerEx("InCar",10000,0,"i",playerid);
and move it under
pawn Код:
TextDrawShowForPlayer(playerid, Textdraw0);
And change
pawn Код:
forward InCar();
public InCar()
{
TextDrawDestroy(Text:Textdraw0);
return 1;
}
to
pawn Код:
forward InCar(playerid);
public InCar(playerid) TextDrawHideForPlayer(playerid, Textdraw0);