[Ajuda] SelectTextDraw (dou +++ rep)
#1

Olб a todos membros do fуrum da SA-MP.

A minha dъvida й sobre a funзгo (SelectTextDraw).
Й o seguinte eu estou a fazer um esquema de TextDraw e decidi implementar essa funзгo, mas quando se clica (OnPlayerClickTextDraw) tem lб no fim a funзгo (CancelSelectTextDraw). Sу que quando eu faзo novamente o comando a funзгo (SelectTextDraw) nгo й chamada. Й mesmo problema do meu cуdigo ou da funзгo ?

Espero resposta, quem responde-me dou ++rep
Reply
#2

Seu cуdigo, mais provбvel. =S
Reply
#3

Eu tenho o textdraw criado e tem a funзгo de ter clicбvel.

Depois tenho o comando

pawn Код:
if(strcmp(cmd, "/textdraw", true) == 0)
        {
            TextDrawShowForPlayer(playerid, TextDraw01);
            TextDrawShowForPlayer(playerid, TextDraw02);
            TextDrawShowForPlayer(playerid, TextDraw03);
            TextDrawShowForPlayer(playerid, TextDraw04);
            TextDrawShowForPlayer(playerid, TextDraw05);
            SelectTextDraw(playerid, COLOR_GREEN);
            return 1;
        }
depois apareзo tudo bem para clicar..

E depois sigo para a public OnPlayerClickTextDraw

E dentro dela estб..

pawn Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(clickedid == TextDraw01)
    {
       SendClientMessage(playerid, -1, " clicou no TextDraw01 ");
    }
    if(clickedid == TextDraw02)
    {
       SendClientMessage(playerid, -1, " clicou no TextDraw02 ");
    }
    if(clickedid == TextDraw03)
    {
       SendClientMessage(playerid, -1, " clicou no TextDraw03 ");
    }
    if(clickedid == TextDraw04)
    {
       SendClientMessage(playerid, -1, " clicou no TextDraw04 ");
    }
    if(clickedid == TextDraw05)
    {
       SendClientMessage(playerid, -1, " clicou no TextDraw05 ");
    }
    TextDrawHideForPlayer(playerid, TextDraw01);
TextDrawHideForPlayer(playerid, TextDraw02);
TextDrawHideForPlayer(playerid, TextDraw03);
TextDrawHideForPlayer(playerid, TextDraw04);
TextDrawHideForPlayer(playerid, TextDraw05);
CancelSelectTextDraw(playerid);
return 1;
}
Reply
#4

Testa:

pawn Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(clickedid == TextDraw01)
    {
       SendClientMessage(playerid, -1, " clicou no TextDraw01 ");
    }
    else if(clickedid == TextDraw02)
    {
       SendClientMessage(playerid, -1, " clicou no TextDraw02 ");
    }
    else if(clickedid == TextDraw03)
    {
       SendClientMessage(playerid, -1, " clicou no TextDraw03 ");
    }
    else if(clickedid == TextDraw04)
    {
       SendClientMessage(playerid, -1, " clicou no TextDraw04 ");
    }
    else if(clickedid == TextDraw05)
    {
       SendClientMessage(playerid, -1, " clicou no TextDraw05 ");
       return 1;
    }
    TextDrawHideForPlayer(playerid, TextDraw01);
    TextDrawHideForPlayer(playerid, TextDraw02);
    TextDrawHideForPlayer(playerid, TextDraw03);
    TextDrawHideForPlayer(playerid, TextDraw04);
    TextDrawHideForPlayer(playerid, TextDraw05);
    CancelSelectTextDraw(playerid);
    return 1;
}
Reply
#5

Ajuste o TextDrawTextSize
Reply
#6

pawn Код:
TextDrawTextSize(Infos, 0.449999, 1.299998);
O que estб errado ? =o
Reply
#7

Cade a funзгo
PHP код:
PlayerTextDrawSetSelectable 
Reply
#8

No gamemode, tenho..

pawn Код:
TextDrawSetSelectable(Textdraw01, true);
Reply
#9

Sigua esse Exemplo da Wiki-samp
pawn Код:
new Text:gTextDraw;
 
public OnGameModeInit()
{
    gTextDraw = TextDrawCreate(10.000000, 141.000000, "MyTextDraw");      
    TextDrawTextSize(gTextDraw,60.000000, 20.000000);
    TextDrawAlignment(gTextDraw,0);
    TextDrawBackgroundColor(gTextDraw,0x000000ff);
    TextDrawFont(gTextDraw,1);
    TextDrawLetterSize(gTextDraw,0.250000, 1.000000);
    TextDrawColor(gTextDraw,0xffffffff);
    TextDrawSetProportional(gTextDraw,1);
    TextDrawSetShadow(gTextDraw,1);
    TextDrawSetSelectable(gTextDraw, 1);
    return 1;
}
 
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_SUBMISSION)
    {
        SelectTextDraw(playerid, 0xFF4040AA);
    }
    return 1;
}
 
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(clickedid == gTextDraw)
    {
         SendClientMessage(playerid, 0xFFFFFFAA, "vc clicou.");
         CancelSelectTextDraw(playerid);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)