Portal SAMP
[Ajuda] argument type mismatch - Versão de Impressão

+- Portal SAMP (https://portalsamp.com)
+-- Fórum: SA-MP (https://portalsamp.com/forumdisplay.php?fid=5)
+--- Fórum: Área de suporte (https://portalsamp.com/forumdisplay.php?fid=6)
+--- Tópico: [Ajuda] argument type mismatch (/showthread.php?tid=1336)



argument type mismatch - [email protected] - 01/07/2021

Boa noite, fiz uma TextDraw para colocar em uma GameMode e deu esse erro:  error 035: argument type mismatch (argument 2)

Linha do erro:

Código:
public OnPlayerConnect(playerid)
{
        TextDrawShowForPlayer(playerid, TDEditor_TD);
    return 1;
}

TextDraw:

Código:
new Text:TDEditor_TD[1];


public OnGameModeInit()
{
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    /////////////////////////////////////////////////////////////////////////////
    TDEditor_TD[0] = TextDrawCreate(533.631286, 330.583282, "The Drifters Club");
    TextDrawLetterSize(TDEditor_TD[0], 0.400000, 1.600000);
    TextDrawAlignment(TDEditor_TD[0], 1);
    TextDrawColor(TDEditor_TD[0], -65281);
    TextDrawSetShadow(TDEditor_TD[0], 0);
    TextDrawSetOutline(TDEditor_TD[0], 2);
    TextDrawBackgroundColor(TDEditor_TD[0], 255);
    TextDrawFont(TDEditor_TD[0], 1);
    TextDrawSetProportional(TDEditor_TD[0], 1);
    TextDrawSetShadow(TDEditor_TD[0], 0);
    return 1;
}

Eu não entendi esse erro alguém pode me ajudar? Sempre fiz uma TextDraw e coloquei desse jeito e nunca deu esse erro.


RE: argument type mismatch - zBL4CK - 01/07/2021

Código PHP:
TextDrawShowForPlayer(playeridTDEditor_TD[0]); 

Você esqueceu de colocar o valor da matriz


RE: argument type mismatch - xbruno1000x - 01/07/2021

Código:
new Text:TDEditor_TD[1];


Você criou 1 variável TDEditor_TD. Quando se põe valor no final, você deve inserir o valor no final a partir de 0.

Código:
TDEditor_TD[0]; //Caso sejam duas variáveis, a próxima será 1...2...3 e por aí vai, sempre sendo um valor a menos que a new

Quando se cria apenas 1 variável, não é necessário usar esse valor no final, poderia ser apenas
Código:
new Text:TDEditor_TD;