23.12.2018, 06:53
(
Last edited by GameOvr; 24/12/2018 at 12:44 PM.
)
I made a rob system,
When player aims on a shop keeper(actor) It is showing a progress bar and after progress bar filled it creates a pickup infront of player (pickup for robbed cash)
Problem is progress bar not showing please help me
My code __
timer calling each second
When player aims on a shop keeper(actor) It is showing a progress bar and after progress bar filled it creates a pickup infront of player (pickup for robbed cash)
Problem is progress bar not showing please help me
My code __
pawn Code:
new PlayerBar:rbar[MAX_PLAYERS];
//under player connect
rbar[playerid] = CreatePlayerProgressBar(playerid, 493.000000, 369.000000, 101.000000, 3.200000, 16711935, 18.0000, 0);
pawn Code:
forward RobTimer();
public RobTimer()
{
for(new i = 0; i < MAX_ACTORS; i++)
{
if(i != INVALID_ACTOR_ID)
{
if(JustRobbed[i] == false)
{
if(robber[i] != -1) // shop is under rob
{
if(GetPlayerTargetActor(robber[i]) == i)
{
robtime[i] ++;
SetPlayerProgressBarValue(robber[i], rbar[robber[i]], robtime[i]);
if(robtime[i] == ROB_SUCCESS_TIME) // successfully robbed
{
ClearActorAnimations(i);
HidePlayerProgressBar(robber[i], rbar[robber[i]]);
JustRobbed[i] = true;
SetTimerEx("EndJustRobbed", SHOP_ROB_REST * 1000, false, "i", i);
USERINFO[robber[i]][robbs] ++;
robtime[i] = -1;
new Float:x, Float:y, Float:z;
GetPlayerPos(robber[i], x, y, z);
robpick[i] = CreatePickup(1272, 8, x + 2, y, z, 0);
}
}
else //failed to rob
{
ClearActorAnimations(i);
HidePlayerProgressBar(robber[i], rbar[robber[i]]);
}
}
else // checking if somebody is robbing
{
foreach(new j : Player)
{
if(GetPlayerTargetActor(j) == i)
{
robber[i] = j;
robtime[i] = 0;
ShowPlayerProgressBar(j, rbar[j]);
ApplyActorAnimation(i, "ped", "handsup", 0, 0, 0, 0, 0, 1);
}
}
}
}
else
{
foreach(new j : Player)
{
if(GetPlayerTargetActor(j) == i) return SendClientMessage(j, COLOR_ERROR, "Sorry, The shop has been robbed before few minutes");
}
}
}
}
return 1;
}