Need help with Textdraw bar
#1

Hellu,
I am working on a Gamemode and there are many gamemodes in gamemode folder which changes by a timer one by one. OT: there is a stealing gamemode in which we have to steal the cargobob from the Security Guards.
For that i have created a textdraw which will show the Delievering progress of cargobob.
I want to make it like when the thieve enter the cargobob and go for the CHECKPOINT to Deliever it so the progress bar should increase as much as the player go near the checkpoint. and at a specific destination, progress bar should stop after delievering it to the checkpoint.
Have a look on the textdraw below ( attachments ):
Reply
#2

Use progress bar include :- https://sampforum.blast.hk/showthread.php?tid=537468

And create your own bar where ever you want. and create a timer which repeat itself and check if the player is still on checkpoint ( IsPlayerInDynamicCP if you're using streamer ) increase the player progress bar. and when its 100% destroy the timer and hide the progress bar
Reply
#3

Can i have some tips(codes) how to make :c?
Don't have much knowledge about Textdraws update
Reply
#4

pawn Код:
#include <a_samp>
#include <progress2>
#include <streamer>

new
        PlayerBar:Progress[ MAX_PLAYERS ],
        PlayerText:Capturing[ MAX_PLAYERS ],
        PlayerTimer[ MAX_PLAYERS ] = -1,
        PlayerDelieverValue[ MAX_PLAYERS ] = 0;
public OnPlayerConnect(playerid)
{
        Progress[ playerid ] = CreatePlayerProgressBar( playerid , 253.000000, 381.000000, 121.000000, 5.000000, 11206655, 100.000000 , BAR_DIRECTION_RIGHT );
    Capturing[playerid] = CreatePlayerTextDraw( playerid , 253.000000, 381.000000 , "Deliver progress...0%" );
    PlayerTextDrawLetterSize( playerid , Capturing[playerid] , 0.220000, 0.9 );
    PlayerTextDrawAlignment( playerid , Capturing[playerid] , 1 );
    PlayerTextDrawColor( playerid , Capturing[playerid] , -1 );
    PlayerTextDrawSetShadow( playerid , Capturing[playerid] , 0 );
    PlayerTextDrawSetOutline( playerid , Capturing[playerid] , -1 );
    PlayerTextDrawBackgroundColor( playerid , Capturing[playerid] , 255 );
    PlayerTextDrawFont( playerid , Capturing[playerid] , 1 );
    PlayerTextDrawSetProportional( playerid , Capturing[playerid] , 1 );
    PlayerTextDrawSetShadow( playerid , Capturing[playerid] , 0 );
   
    PlayerDelieverValue[ playerid ] = 0;
    SetPlayerCheckpoint( playerid, 2566, 256, 12, 20.0 );//just example
    return true;
}
public OnPlayerEnterCheckpoint(playerid)
{
    PlayerTimer[ playerid ] = SetTimerEx("deliverupdate", 1000, true, "i", playerid );
    PlayerDelieverValue[ playerid ] = 0;
    return true;
}
forward deliverupdate( playerid );
public deliverupdate( playerid )
{
    if( !IsPlayerInRangeOfPoint( playerid, 20.0,  2566, 256, 12 ))
    {
        //left the checkpoint
        KillTimer( PlayerTimer[ playerid ] );
        HidePlayerProgressBar( playerid, Progress[ playerid ] );
        PlayerTextDrawHide( playerid, Capturing[ playerid ] );
        return true;
    }
   
    new
        str[ 32 ];
    PlayerDelieverValue[ playerid ] += 5;
    SetPlayerProgressBarValue( playerid, Progress[ playerid ] , PlayerDelieverValue[ playerid ] );
    format( str, sizeof( str ) , "Deliver progress...%d%", PlayerDelieverValue[ playerid ] );
    PlayerTextDrawSetString( playerid, Capturing[playerid], str );

    ShowPlayerProgressBar( playerid, Progress[ playerid ] );
    PlayerTextDrawShow( playerid, Capturing[ playerid ] );
   
    if( PlayerDelieverValue[ playerid ] >= 100 )
    {
        KillTimer( PlayerTimer[ playerid ] );
        HidePlayerProgressBar( playerid, Progress[ playerid ] );
        PlayerTextDrawHide( playerid, Capturing[ playerid ] );
        //delivered.
    }
    return true;
}
EDIT: Sorry forgot to say, you need to check if the player inside the vehicle, if not destroy the timer, hope you got the idea of it.
Reply
#5

Textdraw and progressbar ain't appearing.
Reply
#6

Make sure you change the x, y, z location for all the code. Specially the timer one ( isplayerinrangeof.. )

I tested it and its working fine.
Reply
#7

I know, Thats why i already change the co-ordinates but that textdraw ain't appear.

I have changed the xyz of
Код:
CreatePlayerTextDraw( playerid , 253.000000, 381.000000 , "Deliver progress...0%" );
and
Код:
CreatePlayerProgressBar( playerid , 253.000000, 381.000000, 121.000000, 5.000000, 11206655, 100.000000 , BAR_DIRECTION_RIGHT );
Reply
#8

No, i mean the SetPlayerCheckpoint and IsPlayerInRangeOfPoint co-ordinates!
Reply
#9

i just removed the line SetPlayerCheckpoint cause i have one under OnPlayerEnterVehicle
and about IsPlayerInRangeOfPoint i have added xyz coordinates of Checkpoint
Reply
#10

May i see your code?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)