Textdraw help at spawn
#1

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;
 }
Reply
#2

you need to have a textdraw editor for that and also you need to use GetPlayerKeys to hide the textdraw using LMB
Reply
#3

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)