Zone capture textdraw timer help
#1

Hello i am trying to make a progressbar for my zone capture this what i did so far but its not working :

PHP код:
forward ProgressbarTimer(playerid);
new 
ProgBarTimer;
//Textdraws
       
zProgBackGround[playerid] = CreatePlayerTextDraw(playerid373.974548274.499786"usebox");
    
PlayerTextDrawLetterSize(playeridzProgBackGround[playerid], 0.0000001.637776);
    
PlayerTextDrawTextSize(playeridzProgBackGround[playerid], 256.9000240.000000);
    
PlayerTextDrawAlignment(playeridzProgBackGround[playerid], 1);
    
PlayerTextDrawColor(playeridzProgBackGround[playerid], 0);
    
PlayerTextDrawUseBox(playeridzProgBackGround[playerid], true);
    
PlayerTextDrawBoxColor(playeridzProgBackGround[playerid], 102);
    
PlayerTextDrawSetShadow(playeridzProgBackGround[playerid], 0);
    
PlayerTextDrawSetOutline(playeridzProgBackGround[playerid], 0);
    
PlayerTextDrawFont(playeridzProgBackGround[playerid], 0);
    
zProgBar[playerid] = CreatePlayerTextDraw(playerid267.099945272.089782" ");
    
PlayerTextDrawLetterSize(playeridzProgBar[playerid], 0.6578491.917566);
    
PlayerTextDrawAlignment(playeridzProgBar[playerid], 1);
    
PlayerTextDrawColor(playeridzProgBar[playerid], -5963521);
    
PlayerTextDrawSetShadow(playeridzProgBar[playerid], 0);
    
PlayerTextDrawSetOutline(playeridzProgBar[playerid], 1);
    
PlayerTextDrawBackgroundColor(playeridzProgBar[playerid], 51);
    
PlayerTextDrawFont(playeridzProgBar[playerid], 1);
    
PlayerTextDrawSetProportional(playeridzProgBar[playerid], 1);
public 
OnPlayerEnterDynamicCP(playeridcheckpointid)
{
    if(
checkpointid == ZoneCP[TownHall])
    {
        if(
aDuty[playerid] == 1) return SendClientMessage(playerid, -1,"{0080FF}[ Zone ]: {FFFFFF}You cant capture a zone while onduty");
        if(
TeamCheck[TownHall] == gTeam[playerid]) return SendClientMessage(playerid, -1,"{0080FF}[ Zone ]: {FFFFFF}This zone is already captured by your team");
          if(
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1,"ERROR: You cannot capture while in vehicle!");
        if(
zUnderAttack[TownHall] == 0)
          {
            
zUnderAttack[TownHall] = 1;
            
IsPlayerCapturing[playerid] = 1;
            
ZoneTimer[playerid][TownHall] = SetTimerEx("SetZone",25000,false,"i"playerid);
            
ProgBarTimer SetTimerEx("ProgressbarTimer",15000,false,"i"playerid);
            
GangZoneFlashForAll(GangZone[TownHall],GetPlayerColor(playerid));
            
SendClientMessageToAll(-1"{0080FF}[ Zone ]: {FFFFFF}Zone TownHall is being taken over");
            
ZoneDefine[playerid] = TownHall;
         }
        else return 
SendClientMessage(playerid, -1,"{0080FF}[ Zone ]: {FFFFFF}This zone is already being taken over!");
    }
    return 
1;
}
public 
ProgressbarTimer(playerid)
{
    if 
ProgBarTimer == 1000)
    (
        
TextDrawSetString(zProgBarl);
    }
    else if 
ProgBarTimer == 2000)
    (
        
TextDrawSetString(zProgBarll);
    )
    else if 
ProgBarTimer == 3000)
    (
        
TextDrawSetString(zProgBarlll);
    )
    else if 
ProgBarTimer == 4000)
    (
        
TextDrawSetString(zProgBarllll);
    )
    else if 
ProgBarTimer == 5000)
    (
        
TextDrawSetString(zProgBarlllll);
    )
    else if 
ProgBarTimer == 6000)
    (
        
TextDrawSetString(zProgBarllllll);
    )
    else if 
ProgBarTimer == 7000)
    (
        
TextDrawSetString(zProgBarlllllll);
    )
    else if 
ProgBarTimer == 8000)
    (
        
TextDrawSetString(zProgBarllllllll);
    )
    else if 
ProgBarTimer == 9000)
    (
        
TextDrawSetString(zProgBarllllllllll);
    )
    else if 
ProgBarTimer == 10000)
    (
        
TextDrawSetString(zProgBarlllllllllll);
    )
    else if 
ProgBarTimer == 11000)
    (
        
TextDrawSetString(zProgBarlllllllllll);
    )
    else if 
ProgBarTimer == 12000)
    (
        
TextDrawSetString(zProgBarllllllllllll);
    )
    else if 
ProgBarTimer == 13000)
    (
        
TextDrawSetString(zProgBarlllllllllllll);
    )
    else if 
ProgBarTimer == 14000)
    (
        
TextDrawSetString(zProgBarllllllllllllll);
    )
    else if 
ProgBarTimer == 15000)
    (
        
TextDrawSetString(zProgBarllllllllllllll);
    )
    return 
1;


Please help me
Reply
#2

Atleast explain what is the bug exactly.. I won't go through the whole code and pickup all the bugs.
Reply
#3

Quote:
Originally Posted by Ahmad45123
Посмотреть сообщение
Atleast explain what is the bug exactly.. I won't go through the whole code and pickup all the bugs.
the code itself not working and i forgot to mention i have no experince with textdraw progressbars if you just can show me a simple code as an example i would be thankful

thanks in advance
Reply
#4

Ok, You are using it wrong.


1) First create a variable call it lets say: captureTime.

2) Create a 1-second timer and add that same code you have in the ProgressbarTimer timer.

3) Add in the end
pawn Код:
captureTime++;
So It'd be:
pawn Код:
new captureTime= 0;
public ProgressbarTimer(playerid)
{
    captureTime++;
    if(captureTime== 1000)
    {
        TextDrawSetString(zProgBar, l);
    }
    else if(captureTime== 2000)
    {
        TextDrawSetString(zProgBar, ll);
    }
    else if(captureTime== 3000)
    {
        TextDrawSetString(zProgBar, lll);
    }
    else if(captureTime== 4000)
    {
        TextDrawSetString(zProgBar, llll);
    }
    else if(captureTime == 5000)
    {
        TextDrawSetString(zProgBar, lllll);
    }
    else if(captureTime== 6000)
    {
        TextDrawSetString(zProgBar, llllll);
    }
    else if(captureTime== 7000)
    {
        TextDrawSetString(zProgBar, lllllll);
    }
    else if(captureTime== 8000)
    {
        TextDrawSetString(zProgBar, llllllll);
    }
    else if(captureTime== 9000)
    {
        TextDrawSetString(zProgBar, llllllllll);
    }
    else if(captureTime== 10000)
    {
        TextDrawSetString(zProgBar, lllllllllll);
    }
    else if(captureTime== 11000)
    {
        TextDrawSetString(zProgBar, lllllllllll);
    }
    else if(captureTime== 12000)
    {
        TextDrawSetString(zProgBar, llllllllllll);
    }
    else if(captureTime== 13000)
    {
        TextDrawSetString(zProgBar, lllllllllllll);
    }
    else if(captureTime== 14000)
    {
        TextDrawSetString(zProgBar, llllllllllllll);
    }
    else if(captureTime== 15000)
    {
        TextDrawSetString(zProgBar, llllllllllllll);
        //You can delete the other time you have there and just put the code you want to happen here.
    }
    return 1;
}
Then replace these code:
pawn Код:
ProgBarTimer = SetTimerEx("ProgressbarTimer",15000,false,"i", playerid);
to:
pawn Код:
SetTimerEx("ProgressbarTimer",1000,false,"i", playerid);
And you can delete the ProgBar variable btw.

E: And also, You have your brackets wrong... I fixed them... Look at the code I provided.
E2: You can use progress bars include here: https://sampforum.blast.hk/showthread.php?tid=537468
Its better for this type of stuff.
Reply
#5

Quote:
Originally Posted by Ahmad45123
Посмотреть сообщение
Ok, You are using it wrong.


1) First create a variable call it lets say: captureTime.

2) Create a 1-second timer and add that same code you have in the ProgressbarTimer timer.

3) Add in the end
pawn Код:
captureTime++;
So It'd be:
pawn Код:
new progressTime = 0;
public ProgressbarTimer(playerid)
{
    progressTime++;
    if(progressTime == 1000)
    {
        TextDrawSetString(zProgBar, l);
    }
    else if(progressTime== 2000)
    {
        TextDrawSetString(zProgBar, ll);
    }
    else if(progressTime == 3000)
    {
        TextDrawSetString(zProgBar, lll);
    }
    else if(progressTime == 4000)
    {
        TextDrawSetString(zProgBar, llll);
    }
    else if(progressTime == 5000)
    {
        TextDrawSetString(zProgBar, lllll);
    }
    else if(progressTime == 6000)
    {
        TextDrawSetString(zProgBar, llllll);
    }
    else if(progressTime == 7000)
    {
        TextDrawSetString(zProgBar, lllllll);
    }
    else if(progressTime == 8000)
    {
        TextDrawSetString(zProgBar, llllllll);
    }
    else if(progressTime == 9000)
    {
        TextDrawSetString(zProgBar, llllllllll);
    }
    else if(progressTime == 10000)
    {
        TextDrawSetString(zProgBar, lllllllllll);
    }
    else if(progressTime == 11000)
    {
        TextDrawSetString(zProgBar, lllllllllll);
    }
    else if(progressTime == 12000)
    {
        TextDrawSetString(zProgBar, llllllllllll);
    }
    else if(progressTime == 13000)
    {
        TextDrawSetString(zProgBar, lllllllllllll);
    }
    else if(progressTime == 14000)
    {
        TextDrawSetString(zProgBar, llllllllllllll);
    }
    else if(progressTime == 15000)
    {
        TextDrawSetString(zProgBar, llllllllllllll);
        //You can delete the other time you have there and just put the code you want to happen here.
    }
    return 1;
}
Then replace these code:
pawn Код:
ProgBarTimer = SetTimerEx("ProgressbarTimer",15000,false,"i", playerid);
to:
pawn Код:
SetTimerEx("ProgressbarTimer",1000,false,"i", playerid);
And you can delete the ProgBar variable btw.

E: And also, You have your brackets wrong... I fixed them... Look at the code I provided.
Thank you man i will try the code and will let you know if something went wrong
Reply
#6

I am gerring errors

Код:
C:\Documents and Settings\Salman\Desktop\GH\SA-MP Servers\WarServer\gamemodes\GWH.pwn(1920) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Salman\Desktop\GH\SA-MP Servers\WarServer\gamemodes\GWH.pwn(1924) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Salman\Desktop\GH\SA-MP Servers\WarServer\gamemodes\GWH.pwn(1928) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Salman\Desktop\GH\SA-MP Servers\WarServer\gamemodes\GWH.pwn(1932) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Salman\Desktop\GH\SA-MP Servers\WarServer\gamemodes\GWH.pwn(1936) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Salman\Desktop\GH\SA-MP Servers\WarServer\gamemodes\GWH.pwn(1940) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Salman\Desktop\GH\SA-MP Servers\WarServer\gamemodes\GWH.pwn(1944) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Salman\Desktop\GH\SA-MP Servers\WarServer\gamemodes\GWH.pwn(1948) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Salman\Desktop\GH\SA-MP Servers\WarServer\gamemodes\GWH.pwn(1952) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Salman\Desktop\GH\SA-MP Servers\WarServer\gamemodes\GWH.pwn(1956) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Salman\Desktop\GH\SA-MP Servers\WarServer\gamemodes\GWH.pwn(1960) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Salman\Desktop\GH\SA-MP Servers\WarServer\gamemodes\GWH.pwn(1964) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Salman\Desktop\GH\SA-MP Servers\WarServer\gamemodes\GWH.pwn(1968) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Salman\Desktop\GH\SA-MP Servers\WarServer\gamemodes\GWH.pwn(1972) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Salman\Desktop\GH\SA-MP Servers\WarServer\gamemodes\GWH.pwn(1976) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


15 Errors.
For these :

TextDrawSetString(zProgBar, l);
TextDrawSetString(zProgBar, ll);
etc...

any help
Reply
#7

You have:
PHP код:
new zProgBar
While that function needs it to be:
PHP код:
new Text:zProgBar
Reply
#8

Quote:
Originally Posted by Ahmad45123
Посмотреть сообщение
You have:
PHP код:
new zProgBar
While that function needs it to be:
PHP код:
new Text:zProgBar
i have it like this should i change?

new PlayerText:zProgBar[MAX_PLAYERS];

Edit:

changed to what you said getting this:

Quote:

C:\Documents and Settings\Salman\Desktop\GH\SA-MP Servers\WarServer\gamemodes\GWH.pwn(627) : error 028: invalid subscript (not an array or too many subscripts): "zProgBar"
C:\Documents and Settings\Salman\Desktop\GH\SA-MP Servers\WarServer\gamemodes\GWH.pwn(627) : warning 215: expression has no effect
C:\Documents and Settings\Salman\Desktop\GH\SA-MP Servers\WarServer\gamemodes\GWH.pwn(627) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Salman\Desktop\GH\SA-MP Servers\WarServer\gamemodes\GWH.pwn(627) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Salman\Desktop\GH\SA-MP Servers\WarServer\gamemodes\GWH.pwn(627) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

Reply
#9

i think i have to change something from here?

Quote:

zProgBar[playerid] = CreatePlayerTextDraw(playerid, 267.099945, 272.089782, "lllllllllllllll");
PlayerTextDrawLetterSize(playerid, zProgBar[playerid], 0.657849, 1.917566);
PlayerTextDrawAlignment(playerid, zProgBar[playerid], 1);
PlayerTextDrawColor(playerid, zProgBar[playerid], -5963521);
PlayerTextDrawSetShadow(playerid, zProgBar[playerid], 0);
PlayerTextDrawSetOutline(playerid, zProgBar[playerid], 1);
PlayerTextDrawBackgroundColor(playerid, zProgBar[playerid], 51);
PlayerTextDrawFont(playerid, zProgBar[playerid], 1);
PlayerTextDrawSetProportional(playerid, zProgBar[playerid], 1);

Reply
#10

PHP код:
new ProgBarTimer[MAX_PLAYERS];
ProgBarTimer[playerid] = SetTimerEx("ProgressbarTimer",15000,true,"i"playerid);
new 
progressTime 0;
public 
ProgressbarTimer(playerid)
{
    
progressTime++;
    if(
progressTime == 1000)
    {
        
TextDrawSetString(zProgBar"l");
    }
    else if(
progressTime== 2000)
    {
        
TextDrawSetString(zProgBar"ll");
    }
    else if(
progressTime == 3000)
    {
        
TextDrawSetString(zProgBar"lll");
    }
    else if(
progressTime == 4000)
    {
        
TextDrawSetString(zProgBar"llll");
    }
    else if(
progressTime == 5000)
    {
        
TextDrawSetString(zProgBar"lllll");
    }
    else if(
progressTime == 6000)
    {
        
TextDrawSetString(zProgBar"llllll");
    }
    else if(
progressTime == 7000)
    {
        
TextDrawSetString(zProgBar"llllll");
    }
    else if(
progressTime == 8000)
    {
        
TextDrawSetString(zProgBar"llllllll");
    }
    else if(
progressTime == 9000)
    {
        
TextDrawSetString(zProgBar"llllllllll");
    }
    else if(
progressTime == 10000)
    {
        
TextDrawSetString(zProgBar"lllllllllll");
    }
    else if(
progressTime == 11000)
    {
        
TextDrawSetString(zProgBar"lllllllllll");
    }
    else if(
progressTime == 12000)
    {
        
TextDrawSetString(zProgBar"llllllllllll");
    }
    else if(
progressTime == 13000)
    {
        
TextDrawSetString(zProgBar"lllllllllllll");
    }
    else if(
progressTime == 14000)
    {
        
TextDrawSetString(zProgBar"llllllllllllll");
    }
    else if(
progressTime == 15000)
    {
        
TextDrawSetString(zProgBar"llllllllllllll");
        
KillTimerProgBarTimer[playerid] ) ;
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)