[Ajuda] Textdraw em GangZone
#1

Olб!
Eu queria saber como criar um textdraw quando um jogador entrar na gangzone!

Tentei procurar por tutoriais, ajudas e etc, mas nгo encontrei muita coisa que ajudasse.

Criei um post no 'Dъvidas Curtas', porem o Viniborn disse:
Quote:

Vocк pode usar o conceito 'IsPlayerInArea' junto com TextDrawShowForPlayer e TextDrawHideForPlayer

Cheguei a ver o IsPlayerInArea no Wiki SA-MP, mas nгo entendi.

Se alguйm quiser me ajuda, fico agradecido por demais.
Reply
#2

use CreateDynamicRectangle e IsPlayerInDynamicArea do "streamer" acompanhado de um timer
Reply
#3

Mais como eu disse ali no tуpico, eu nгo entendi nem o IsPlayerInArea, como vou entender coisa mais avanзada que isso?

Veja, eu peguei um cуdigo feito pelo Jim._.Carrey(Crйditos totalmente a ele):

pawn Код:
#include <a_samp>

new Text:Test;
new GangZone;

forward Novatos(playerid);
forward Quebrar(playerid);

public OnGameModeInit()
{
    GangZone = GangZoneCreate(1816.444824, 1462.439941, 2032.444824, 1702.439941);

    Test = TextDrawCreate(443.000000, 423.000000,"Novato");
    TextDrawUseBox(Test, 0);
    TextDrawFont(Test, 3);
    TextDrawSetShadow(Test,0);
    TextDrawSetOutline(Test,2);
    TextDrawBackgroundColor(Test,0x000000FF);
    TextDrawColor(Test,0xFFFFFFFF);
    TextDrawAlignment(Test,3);
    TextDrawLetterSize(Test,0.5,1.5);

    SetTimer("Quebrar", 5000, 1);

    return 1;
}

public Novatos(playerid)
{
    if(IsPlayerInPlace(playerid, 1816.444824, 1462.439941, 2032.444824, 1702.439941))
    {
    TextDrawShowForPlayer(playerid, Test);
    }
    return 1;
}

public OnPlayerSpawn(playerid)
{
    GangZoneShowForPlayer(playerid, GangZone, -66);
    return 1;
}

public Quebrar(playerid)
{
    TextDrawHideForPlayer(playerid, Test);
    return 1;
}

stock IsPlayerInPlace(playerid,Float:XMin,Float:YMin,Float:XMax,Float:YMax )
{
    new RetValue = 0;
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z );
    if( X >= XMin && Y >= YMin && X < XMax && Y < YMax )
    {
       RetValue = 1;
    }
    return RetValue;
}
Quando eu entro na GangZone, a textdraw nгo aparece e eu nгo faзo a mнnima ideia do que pode ser.
Reply
#4

pawn Код:
#include <a_samp>
#include <streamer>

new Text:Test, GangZone, AreaGangZone;

public OnGameModeInit()
{
    GangZone = GangZoneCreate(1816.444824, 1462.439941, 2032.444824, 1702.439941);
    AreaGangZone = CreateDynamicRectangle(1816.444824, 1462.439941, 2032.444824, 1702.439941, -1, -1, -1);

    Test = TextDrawCreate(443.000000, 423.000000,"Novato");
    TextDrawUseBox(Test, 0);
    TextDrawFont(Test, 3);
    TextDrawSetShadow(Test,0);
    TextDrawSetOutline(Test,2);
    TextDrawBackgroundColor(Test,0x000000FF);
    TextDrawColor(Test,0xFFFFFFFF);
    TextDrawAlignment(Test,3);
    TextDrawLetterSize(Test,0.5,1.5);
    return 1;
}

public OnPlayerEnterDynamicArea(playerid, areaid)
{
    if(areaid == AreaGangZone)
    {
        TextDrawShowForPlayer(playerid, Test);
    }
    return 1;
}

public OnPlayerLeaveDynamicArea(playerid, areaid)
{
    if(areaid == AreaGangZone)
    {
        TextDrawHideForPlayer(playerid, Test);
    }
    return 1;
}

public OnPlayerSpawn(playerid)
{
    GangZoneShowForPlayer(playerid, GangZone, -66);
    return 1;
}
A funзгo OnPlayerEnterDynamicArea й chamada sempre que vocк entra em alguma 'Бrea' predefinida, nela vocк pode configurar para executar as funзхes relacionadas а o que vocк quer que apareзa quando o jogador entrar na(s) 'Бrйa'.
OnPlayerLeaveDynamicArea й o oposto, й tudo relacionado quando vocк sai de uma 'Бrea'...

Espero que tenha aprendido
Reply
#5

Quote:
Originally Posted by THE_FALLEN
Посмотреть сообщение
pawn Код:
#include <a_samp>
#include <streamer>

new Text:Test, GangZone, AreaGangZone;

public OnGameModeInit()
{
    GangZone = GangZoneCreate(1816.444824, 1462.439941, 2032.444824, 1702.439941);
    AreaGangZone = CreateDynamicRectangle(1816.444824, 1462.439941, 2032.444824, 1702.439941, -1, -1, -1);

    Test = TextDrawCreate(443.000000, 423.000000,"Novato");
    TextDrawUseBox(Test, 0);
    TextDrawFont(Test, 3);
    TextDrawSetShadow(Test,0);
    TextDrawSetOutline(Test,2);
    TextDrawBackgroundColor(Test,0x000000FF);
    TextDrawColor(Test,0xFFFFFFFF);
    TextDrawAlignment(Test,3);
    TextDrawLetterSize(Test,0.5,1.5);
    return 1;
}

public OnPlayerEnterDynamicArea(playerid, areaid)
{
    if(areaid == AreaGangZone)
    {
        TextDrawShowForPlayer(playerid, Test);
    }
    return 1;
}

public OnPlayerLeaveDynamicArea(playerid, areaid)
{
    if(areaid == AreaGangZone)
    {
        TextDrawHideForPlayer(playerid, Test);
    }
    return 1;
}

public OnPlayerSpawn(playerid)
{
    GangZoneShowForPlayer(playerid, GangZone, -66);
    return 1;
}
A funзгo OnPlayerEnterDynamicArea й chamada sempre que vocк entra em alguma 'Бrea' predefinida, nela vocк pode configurar para executar as funзхes relacionadas а o que vocк quer que apareзa quando o jogador entrar na(s) 'Бrйa'.
OnPlayerLeaveDynamicArea й o oposto, й tudo relacionado quando vocк sai de uma 'Бrea'...

Espero que tenha aprendido
Agora nem a GangZone apareceu, nгo apareceu nada.
Reply
#6

Vocк fez algo errado.. olhe se vocк colocou GangZoneShowForPlayer no OnPlayerSpawn.
Reply
#7

Quote:
Originally Posted by THE_FALLEN
Посмотреть сообщение
Vocк fez algo errado.. olhe se vocк colocou GangZoneShowForPlayer no OnPlayerSpawn.
Sim, estб lб. Devo tirar ou mudar ele de lugar? Onde devo colocar?
Reply
#8

Teoricamente a gz nao й para interferir no textdraw, o normal й ela tar la.. verifica tudo de novo passo a passo...
Reply
#9

Mais eu peguei exatamente o cуdigo que vocк fez ali em cima.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)