19.07.2015, 15:25
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;
}