Textdraw screen bug
#1

Hello.

I have a textdraw that bugging on screen, you can see on this picture what i mean.
Why and what can cause it?

As you see it is the upper textdraw that gets copied BIG and backwards down the screen.

EDIT: i found what coused the problem, but i don't know how to fix it.
It is the NPC bots that bugging the textdraw, i tried to fix it with this with no success
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(IsPlayerNPC(playerid))
    {
        if(GetVehicleModel(vehicleid) == 592)
        {
        TextDrawDestroy(bombtext[playerid]);
        //SetVehicleHealth(vehicleid, 2000.0);
        }
    }
    if(IsPlayerNPC(playerid))
    {
        if(GetVehicleModel(vehicleid) == 548)
        {
        TextDrawDestroy(bombtext[playerid]);
        //SetVehicleHealth(vehicleid, 2000.0);
        }
    }

//And also tested it this way

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(GetVehicleModel(vehicleid) == 592)
    {
        if(IsPlayerNPC(playerid))
        {
        TextDrawDestroy(bombtext[playerid]);
        //SetVehicleHealth(vehicleid, 2000.0);
        }
    }
    if(GetVehicleModel(vehicleid) == 548)
    {
        if(IsPlayerNPC(playerid))
        {
        TextDrawDestroy(bombtext[playerid]);
        //SetVehicleHealth(vehicleid, 2000.0);
        }
    }
Reply
#2

hm...
Post the code ?
Reply
#3

Quote:
Originally Posted by sGarfield
Посмотреть сообщение
hm...
Post the code ?
There is no wrong with the code, the bug disappear when i remove gl_npc filterscript.
So i must add something that disable the textdraw for NPCs.
Reply
#4

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(IsPlayerNPC(playerid))
    {
        if(GetVehicleModel(vehicleid) == 592)
        {
        //TextDrawDestroy(bombtext[playerid]);
        //SetVehicleHealth(vehicleid, 2000.0);
        }
    }
    if(IsPlayerNPC(playerid))
    {
        if(GetVehicleModel(vehicleid) == 548)
        {
        //TextDrawDestroy(bombtext[playerid]);
        //SetVehicleHealth(vehicleid, 2000.0);
        }
    }

//And also tested it this way

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(GetVehicleModel(vehicleid) == 592)
    {
        if(IsPlayerNPC(playerid))
        {
        ////TextDrawDestroy(bombtext[playerid]);
        //SetVehicleHealth(vehicleid, 2000.0);
        }
    }
    if(GetVehicleModel(vehicleid) == 548)
    {
        if(IsPlayerNPC(playerid))
        {
        //TextDrawDestroy(bombtext[playerid]);
        //SetVehicleHealth(vehicleid, 2000.0);
        }
    }

Post the "OnPlayerStateChange".
Reply
#5

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

Post the "OnPlayerStateChange".
I have nothing related on OnPlayerStateChange for that textdraw, but ok.
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if (newstate == PLAYER_STATE_DRIVER)
    {
        for (new i=1;i<OrgsCount+1;i++)
        {
           for (new a=0;a<MAX_ORG_VEHICLES;a++)
           {
                new vehicleid = GetPlayerVehicleID(playerid);
                if (IsVehicleConnected(vehicleid))
                {
                    if (vehicleid == Organization[i][Vehicles][a] && PlayerOrg[playerid] != i)
                    {
                            if (DoesOrgExist(GetOrgName(i)))
                            {
                            new string[100];
                            format(string,sizeof(string),"This vehicle belongs to %s. You are not authorized to use it", GetOrgName(i));
                            SendClientMessage(playerid, COLOR_RED, string);
                            RemovePlayerFromVehicle(playerid);
                            }
                        }
                }
           }
        }
    }

    return 1;
}
Reply
#6

Quote:
Originally Posted by cruising
Посмотреть сообщение
I have nothing related on OnPlayerStateChange for that textdraw, but ok.
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if (newstate == PLAYER_STATE_DRIVER)
    {
        for (new i=1;i<OrgsCount+1;i++)
        {
           for (new a=0;a<MAX_ORG_VEHICLES;a++)
           {
                new vehicleid = GetPlayerVehicleID(playerid);
                if (IsVehicleConnected(vehicleid))
                {
                    if (vehicleid == Organization[i][Vehicles][a] && PlayerOrg[playerid] != i)
                    {
                            if (DoesOrgExist(GetOrgName(i)))
                            {
                            new string[100];
                            format(string,sizeof(string),"This vehicle belongs to %s. You are not authorized to use it", GetOrgName(i));
                            SendClientMessage(playerid, COLOR_RED, string);
                            RemovePlayerFromVehicle(playerid);
                            }
                        }
                }
           }
        }
    }

    return 1;
}
Where's on the show the textdraw ?
Reply
#7

Quote:
Originally Posted by sGarfield
Посмотреть сообщение
Where's on the show the textdraw ?
What? if you mean the code to show the textdraw, this is the code
pawn Код:
public ShowTextDraw(playerid, vehicleid, count)
{
        if(IsPlayerInVehicle(playerid, vehicleid)) {
            bombtext[playerid] = TextDrawCreate(500, 300, " ");
            TextDrawUseBox(bombtext[playerid], 1);
            TextDrawBoxColor(bombtext[playerid], 0x00000066);
            TextDrawFont(bombtext[playerid], 1);
            UpdateTextDraw(playerid);
            removetimer[playerid] = SetTimerEx("RemoveTextDraw", 2000, 1, "i", playerid);
            TextDrawShowForPlayer(playerid, bombtext[playerid]);
        } else {
            count ++;
            if(count < 20) SetTimerEx("ShowTextDraw", 500, 0, "iii", playerid, vehicleid, count);
        }
}
Reply
#8

try this:
pawn Код:
public ShowTextDraw(playerid, vehicleid, count)
{
    if(!IsPlayerNPC(playerid))
    {
        if(IsPlayerInVehicle(playerid, vehicleid))
        {
            bombtext[playerid] = TextDrawCreate(500, 300, " ");
            TextDrawUseBox(bombtext[playerid], 1);
            TextDrawBoxColor(bombtext[playerid], 0x00000066);
            TextDrawFont(bombtext[playerid], 1);
            UpdateTextDraw(playerid);
            removetimer[playerid] = SetTimerEx("RemoveTextDraw", 2000, 1, "i", playerid);
            TextDrawShowForPlayer(playerid, bombtext[playerid]);
        }
        else
        {
            count ++;
            if(count < 20) SetTimerEx("ShowTextDraw", 500, 0, "iii", playerid, vehicleid, count);
        }
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by sGarfield
Посмотреть сообщение
try this:
pawn Код:
public ShowTextDraw(playerid, vehicleid, count)
{
    if(!IsPlayerNPC(playerid))
    {
        if(IsPlayerInVehicle(playerid, vehicleid))
        {
            bombtext[playerid] = TextDrawCreate(500, 300, " ");
            TextDrawUseBox(bombtext[playerid], 1);
            TextDrawBoxColor(bombtext[playerid], 0x00000066);
            TextDrawFont(bombtext[playerid], 1);
            UpdateTextDraw(playerid);
            removetimer[playerid] = SetTimerEx("RemoveTextDraw", 2000, 1, "i", playerid);
            TextDrawShowForPlayer(playerid, bombtext[playerid]);
        }
        else
        {
            count ++;
            if(count < 20) SetTimerEx("ShowTextDraw", 500, 0, "iii", playerid, vehicleid, count);
        }
    }
    return 1;
}
Didnt help, but i have tested some stuffs and i now know what causing the problem, the textdraw menu use numpad 8 and 2 to change bomb types, same as you use on the andromada backflip, and 3 NPCs using a andromada and the backflip. So i guess i need to change the buttons and see if that fix the problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)