Stupid textdraws...
#1

Deleted
Reply
#2

I doubt it. If an error tells you that the amount of arguments isn't correct, what is the first thing you do? Right, you check your arguments. PlayerTextDraw functions require a playerid.
Reply
#3

Change
pawn Код:
TD = CreatePlayerTextDraw(3.666702, 281.659332, "/god:");
// TO
TD[playerid] = CreatePlayerTextDraw(3.666702, 281.659332, "/god:");
And as stated above add playerid.
Reply
#4

Quote:
Originally Posted by Antonio144
Посмотреть сообщение
Change

And as stated above add playerid.
But where and how?
Reply
#5

https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw

CreatePlayerTextDraw(playerid,.....)
Reply
#6

YES FINALLY THANKS
Reply
#7

Shit. I got no error codes but the overall code doesn't work :/

Код:
new God[MAX_PLAYERS] = 0;
new PlayerText:TD[MAX_PLAYERS];

//PlayerConnect
{
TD[playerid] = CreatePlayerTextDraw(playerid,3.666702, 281.659332, "/god:");
PlayerTextDrawLetterSize(playerid,TD[playerid], 0.285999, 1.371851);
PlayerTextDrawAlignment(playerid,TD[playerid], 1);
PlayerTextDrawColor(playerid,TD[playerid], -1);
PlayerTextDrawSetShadow(playerid,TD[playerid], 2);
PlayerTextDrawSetOutline(playerid,TD[playerid], 0);
PlayerTextDrawBackgroundColor(playerid,TD[playerid], 51);
PlayerTextDrawFont(playerid,TD[playerid], 2);
PlayerTextDrawSetProportional(playerid,TD[playerid], 1);

new text[32];
switch(God[playerid])
{
case 0: format(text, sizeof(text), "/god: AUS");
case 1: format(text, sizeof(text), "/god: AN");
}
PlayerTextDrawSetString(playerid, TD[playerid], text);
PlayerTextDrawShow(playerid, TD[playerid]);

//PlayerSpawn

God[playerid] = 1;

//Playercommand

if(strcmp("/god", cmdtext, true, 10) == 0)
    {
	 	if (God[playerid] == 1)
        {
            SendClientMessage(playerid, Rot, "God Modus aus. Du bist nun Verwundbar!");
            SetPlayerHealth(playerid, 100);
            SetPlayerArmour(playerid, 100);
            God[playerid] = 0;
            return 1;
        }
        else if(God[playerid] == 0)
        {
            SendClientMessage(playerid, Hellblau, "God Modus an. Du bist nun Unverwundbar.");
            God[playerid] = 1;
            SetPlayerArmour(playerid, 10000);
            SetPlayerHealth(playerid, 10000);
            return 1;
        }
Does someone know an answer? The Textdraw just keeps on "/god: AUS" no matter what I do
Reply
#8

When player spawns you need to update the textdraw.

And the switch on OnPlayerConnect is redundant. I mean, when player connects God[] will always be 0. This might not be the full code so it is possible I am wrong.
Reply
#9

Do you have an example?
Reply
#10

pawn Код:
new God[MAX_PLAYERS] = 0;
new PlayerText:TD[MAX_PLAYERS];


//PlayerSpawn

TD[playerid] = CreatePlayerTextDraw(playerid,3.666702, 281.659332, "/god: AUS");
PlayerTextDrawLetterSize(playerid,TD[playerid], 0.285999, 1.371851);
PlayerTextDrawAlignment(playerid,TD[playerid], 1);
PlayerTextDrawColor(playerid,TD[playerid], -1);
PlayerTextDrawSetShadow(playerid,TD[playerid], 2);
PlayerTextDrawSetOutline(playerid,TD[playerid], 0);
PlayerTextDrawBackgroundColor(playerid,TD[playerid], 51);
PlayerTextDrawFont(playerid,TD[playerid], 2);
PlayerTextDrawSetProportional(playerid,TD[playerid], 1);
PlayerTextDrawShow(playerid, TD[playerid]);

/*When player spawns it will show the textdraw "/god: AUS" (god mode off)*/

//Playercommand

if(strcmp("/god", cmdtext, true, 10) == 0)
    {
        if (God[playerid] == 1)
        {
            SendClientMessage(playerid, Rot, "God Modus aus. Du bist nun Verwundbar!");
            SetPlayerHealth(playerid, 100);
            SetPlayerArmour(playerid, 100);
            God[playerid] = 0;
            new text[32];
            format(text, sizeof(text), "/god: AUS");
            PlayerTextDrawSetString(playerid, TD[playerid], text);
            return 1
        }
        else if(God[playerid] == 0)
        {
            SendClientMessage(playerid, Hellblau, "God Modus an. Du bist nun Unverwundbar.");
            God[playerid] = 1;
            SetPlayerArmour(playerid, 10000);
            SetPlayerHealth(playerid, 10000);
            new text[32];
            format(text, sizeof(text), "/god: AN");
            PlayerTextDrawSetString(playerid, TD[playerid], text);
            return 1;
        }
/*Textdraw will be updated with text of current god mode status*/
I hope I got the idea right.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)