SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 07/01/2015, 10:52 PM   #1
lulo356
Gangsta
 
Join Date: Jun 2013
Posts: 501
Reputation: 4
Default Textdraw bug

When two players used the same command it will bugs the textdraw, it will show the other players information,

pawn Code:
public UpdateSpeed (playerid,vehid)
{
    new id = GetVehicleInfrontID (playerid);
    if (id < 0)
    {
        for (new i = 0; i < MAX_PLAYERS; i++)
        {
            PlayerTextDrawSetString (i,RadarHud[i], "Speed:-");
            PlayerTextDrawSetString (i,VehicleModel221[i],"Car Model:-");
        }
    }
    else
    {
        new str[258], Float: velocityX, Float: velocityY, Float: velocityZ;
        GetVehicleVelocity (id, velocityX, velocityY, velocityZ);
        new speed = floatround (floatsqroot (floatpower (velocityX, 2) + floatpower (velocityY, 2) + floatpower (velocityZ, 2)) * 187.666667, floatround_round);
        for (new i = 0; i < MAX_PLAYERS; i++)
        {
            format (str, sizeof (str), "Speed: %d", speed);
            PlayerTextDrawSetString (i,RadarHud[i], str);
            format (str, sizeof (str), "Car Model: %s", VehicleModel22 [GetVehicleModel (id) - 400]);
            PlayerTextDrawSetString (i,VehicleModel221[i], str);
        }
    }
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
             if (IsPlayerInVehicle (i, vehid))
        {
            PlayerTextDrawShow (i, RadarHud[i]);
            PlayerTextDrawShow (i, DashCamText);
            PlayerTextDrawShow (i, VehicleModel221[i]);
        }
    }
    return 1;
}

public CheckValidTextDraws()
{
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected (i))
        {
            if (IsPlayerInAnyVehicle (i))
            {
                new vehid = GetPlayerVehicleID (i);
                if (VehRadarID [vehid] > -1)
                {
                    PlayerTextDrawShow (i, RadarHud[i]);
                    PlayerTextDrawShow (i, DashCamText);
                    PlayerTextDrawShow (i, VehicleModel221[i]);
                    if (CheckingSpeed [vehid] > 0)
                    {
                        PlayerTextDrawShow (i, RadarHud[i]);
                        PlayerTextDrawShow (i, DashCamText);
                        PlayerTextDrawShow (i, VehicleModel221[i]);
                    }
                    else
                    {
                        PlayerTextDrawHide (i, RadarHud[i]);
                        PlayerTextDrawHide (i, DashCamText);
                        PlayerTextDrawHide(i, VehicleModel221[i]);
                   }
                }
                else
                {
                    PlayerTextDrawHide (i, RadarHud[i]);
                    PlayerTextDrawHide (i, DashCamText);
                    PlayerTextDrawHide(i, VehicleModel221[i]);
                    OldVehID [i] = 0;
                }
            }
        }
    }
    return 1;
}
__________________

lulo356 is offline   Reply With Quote
Old 07/01/2015, 11:40 PM   #2
Divergent
Big Clucker
 
Join Date: Nov 2014
Posts: 161
Reputation: 19
Default Re: Textdraw bug

You need to create a textdraw for each player

new textdraw[MAX_PLAYERS];

then show textdraw[playerid]

(textdraw = name of any textdraw)
Divergent is offline   Reply With Quote
Old 07/01/2015, 11:49 PM   #3
lulo356
Gangsta
 
Join Date: Jun 2013
Posts: 501
Reputation: 4
Default Re: Textdraw bug

Quote:
Originally Posted by Divergent View Post
You need to create a textdraw for each player

new textdraw[MAX_PLAYERS];

then show textdraw[playerid]

(textdraw = name of any textdraw)
Already have that man, and that doenst work.
__________________

lulo356 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] Making a Health/armour textdraw! (Global textdraw) -Rebel Son- Tutorials 22 21/02/2020 01:27 AM
Moving a textdraw on the y-axis doesn't work. (TextDraw Editor) AndySedeyn Scripting Help 1 14/06/2014 02:50 PM
[FilterScript] [FS] TextDraw editor 0.6 - Multiple textdraw support, for proffesional textdraws Zamaroht Filterscripts 369 20/01/2013 02:46 PM
[Tutorial] --: Creating Textdraw's In The Easiest Way :-- [Helpful for textdraw creators] Nirzor Tutorials 15 04/10/2012 12:32 PM


All times are GMT. The time now is 10:39 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.