SA-MP Forums Archive
Showing TextDraw All The Time. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Showing TextDraw All The Time. (/showthread.php?tid=160555)



Showing TextDraw All The Time. - [L3th4l] - 17.07.2010

Guys, I'm using Luby's drift point counter. I need help showing the textdraw( which i included, cause it did not come with it) all the time. The problem is that if i put the text under onplayer connect, it will just show it and it will hide, also on playerspawn. Reason is that because its only shown everytime i make a drift.

So i got this,
pawn Код:
public Drift()
{
    new Float:Angle1, Float:Angle2, Float:BySpeed, s[256];
    new Float:Z,Float:X,Float:Y,Float:SpeedX;
    for(new g=0;g<200;g++)
    {
        GetPlayerPos(g, X, Y, Z);
        SpeedX = floatsqroot(floatadd(floatadd(floatpower(floatabs(floatsub(X,SavedPos[ g ][ sX ])),2),floatpower(floatabs(floatsub(Y,SavedPos[ g ][ sY ])),2)),floatpower(floatabs(floatsub(Z,SavedPos[ g ][ sZ ])),2)));
        Angle1 = ReturnPlayerAngle(g);
        Angle2 = GetPlayerTheoreticAngle(g);
        BySpeed = floatmul(SpeedX, 12);
        if(IsPlayerInAnyVehicle(g) && IsCar(GetPlayerVehicleID(g)) && floatabs(floatsub(Angle1, Angle2)) > DRIFT_MINKAT && floatabs(floatsub(Angle1, Angle2)) < DRIFT_MAXKAT && BySpeed > DRIFT_SPEED)
        {
            if(PlayerDriftCancellation[g] > 0)KillTimer(PlayerDriftCancellation[g]);
            PlayerDriftCancellation[g] = 0;
            DriftPointsNow[g] += floatval( floatabs(floatsub(Angle1, Angle2)) * 3 * (BySpeed*0.1) )/10;
            PlayerDriftCancellation[g] = SetTimerEx("DriftCancellation", 3000, 0, "d", g);
        }
        if(DriftPointsNow[g] > 0)
        {
            format(s,sizeof(s),"Drift Points: $ %d",DriftPointsNow[g]);
            TextDrawShowForPlayer(g,DriftText);
            TextDrawSetString(DriftText,s);
        }
        SavedPos[ g ][ sX ] = X;
        SavedPos[ g ][ sY ] = Y;
        SavedPos[ g ][ sZ ] = Z;
    }
}
ok, so after i finish drifting, the textdraw will hide.

btw, here is the DriftCancellation:

pawn Код:
public DriftCancellation(playerid)
{
    PlayerDriftCancellation[playerid] = 0;
    GivePlayerMoney(playerid, DriftPointsNow[playerid]);
    DriftPointsNow[playerid] = 0;
    TextDrawSetString(DriftText,DriftPointsNow);
}
So the question is, how to make the textdraw show ALL the time?


Re: Showing TextDraw All The Time. - Kar - 17.07.2010

show rest. what is driftpointsnow defined as?


Re: Showing TextDraw All The Time. - [L3th4l] - 17.07.2010

pawn Код:
new DriftPointsNow[ 200 ],  PlayerDriftCancellation[ 200 ]
Thats what it has.


Re: Showing TextDraw All The Time. - Kitten - 17.07.2010

ur using lubys drift counter old one with editied textdraw so u can just show ur whole script if you want him to help u :X


Re: Showing TextDraw All The Time. - Kar - 17.07.2010

pawn Код:
public Drift()
{
    new Float:Angle1, Float:Angle2, Float:BySpeed, s[256];
    new Float:Z,Float:X,Float:Y,Float:SpeedX;
    for(new g=0;g<200;g++)
    {
        GetPlayerPos(g, X, Y, Z);
        SpeedX = floatsqroot(floatadd(floatadd(floatpower(floatabs(floatsub(X,SavedPos[ g ][ sX ])),2),floatpower(floatabs(floatsub(Y,SavedPos[ g ][ sY ])),2)),floatpower(floatabs(floatsub(Z,SavedPos[ g ][ sZ ])),2)));
        Angle1 = ReturnPlayerAngle(g);
        Angle2 = GetPlayerTheoreticAngle(g);
        BySpeed = floatmul(SpeedX, 12);
        if(IsPlayerInAnyVehicle(g) && IsCar(GetPlayerVehicleID(g)) && floatabs(floatsub(Angle1, Angle2)) > DRIFT_MINKAT && floatabs(floatsub(Angle1, Angle2)) < DRIFT_MAXKAT && BySpeed > DRIFT_SPEED)
        {
            if(PlayerDriftCancellation[g] > 0)KillTimer(PlayerDriftCancellation[g]);
            PlayerDriftCancellation[g] = 0;
            DriftPointsNow[g] += floatval( floatabs(floatsub(Angle1, Angle2)) * 3 * (BySpeed*0.1) )/10;
            PlayerDriftCancellation[g] = SetTimerEx("DriftCancellation", 3000, 0, "d", g);
        }
        if(DriftPointsNow[g] >= 0)
        {
            format(s,sizeof(s),"Drift Points: $ %d",DriftPointsNow[g]);
            TextDrawShowForPlayer(g,DriftText);
            TextDrawSetString(DriftText,s);
        }
        SavedPos[ g ][ sX ] = X;
        SavedPos[ g ][ sY ] = Y;
        SavedPos[ g ][ sZ ] = Z;
    }
}
try that.


Re: Showing TextDraw All The Time. - [L3th4l] - 17.07.2010

did not worked. adding the >= had the system not to count the points


Re: Showing TextDraw All The Time. - Kar - 17.07.2010

o well idk. sorry;\ u have to show rest btw...