Textdraw help at spawn - 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: Textdraw help at spawn (
/showthread.php?tid=407176)
Textdraw help at spawn -
BodyBoardVEVO - 12.01.2013
How I can make this
I know it's something like this...
But i dont know how to fix or something... I was 2 errors, help me to create this textdraw at spawn
pawn Код:
#include <a_samp>
#include <dudb>
new Text:text1;
text1 = TextDrawCreate(7.000000, 136.000000, "~w~As A Civilian, Your Job Is~n~~w~To Rob Banks, Casinos, Stores,~n~~w~People, And Get Away From~n~~w~The~b~Police~w~.");
TextDrawAlignment(text1, 0);
TextDrawLetterSize(text1, 0.299999, 0.900000);
TextDrawColor(text1, 0xffff00ff);
TextDrawSetOutline(text1, 1);
TextDrawSetProportional(text1, 1);
TextDrawSetShadow(text1, 1);
return true;
}
forward HideDraw(playerid);
public HideDraw(playerid)
{
TextDrawHideForPlayer(playerid, text1);
return 1;
}
Re: Textdraw help at spawn - Patrick - 12.01.2013
you need to have a textdraw editor for that and also you need to use
GetPlayerKeys to hide the textdraw using LMB
Re: Textdraw help at spawn -
Threshold - 13.01.2013
This function is called when a player presses a key:
https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
A list of a available keys detectable:
https://sampwiki.blast.hk/wiki/GetPlayerKeys
You need to detect KEY_FIRE, if dialog is open, close it and revert player settings to dialog closed. By dialog I mean textdraw, I keep saying dialog for some reason.
A short example:
pawn Код:
new InfoDialogOpen[MAX_PLAYERS]; //Used to detect whether the textdraw is showing or not
new Text:text1;
public OnGameModeInit() //Or OnFilterScriptInit()
{
text1 = TextDrawCreate(7.000000, 136.000000, "~w~As A Civilian, Your Job Is~n~~w~To Rob Banks, Casinos, Stores,~n~~w~People, And Get Away From~n~~w~The~b~Police~w~.");
TextDrawAlignment(text1, 0);
TextDrawLetterSize(text1, 0.299999, 0.900000);
TextDrawColor(text1, 0xffff00ff);
TextDrawSetOutline(text1, 1);
TextDrawSetProportional(text1, 1);
TextDrawSetShadow(text1, 1);
return 1;
}
public OnPlayerConnect(playerid)
{
InfoDialogOpen[playerid] = 0; //Dialog is closed
return 1;
}
public OnPlayerSpawn(playerid)
{
if(InfoDialogOpen[playerid] == 0)
{
TextDrawShowForPlayer(playerid, text1);
InfoDialogOpen[playerid] = 1;
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(InfoDialogOpen[playerid] == 1) //If they have the dialog open
{
if(newkeys == KEY_FIRE)
{
TextDrawHideForPlayer(playerid, text1); //Close textdraw
InfoDialogOpen[playerid] = 0; //textdraw is closed
}
}
return 1;
}