need help
#1

I made a count system counts down backwards for 120 seconds, and when it comes to zero it again counting -1, -2, -3, -4, -5, and I want to do that when it comes to zero to hide TextDraw as if nothing had happened
Код:
#include <a_samp>

forward test(playerid);

new timer;
new count = 120; 

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/startcount", cmdtext, true, 11) == 0)
    {
        timer = SetTimerEx("test", 1000, 1, "d", playerid);
        return 1;
    }
}
public test(playerid)
{
    count--;
    new string[24];
    format(string, sizeof(string), "Please wait: %d", count); 
    return GameTextForPlayer(playerid, string, 100, 5);
}
Reply
#2

PHP код:
#include <a_samp>

forward test(playerid);

new 
timer;
new 
count 120

public 
OnPlayerCommandText(playeridcmdtext[])
{
    if(
strcmp("/startcount"cmdtexttrue11) == 0)
    {
        
timer SetTimerEx("test"10000"d"playerid);
        return 
1;
    }
}
public 
test(playerid)
{
    
count--;
    new 
string[24];
    
format(stringsizeof(string), "Please wait: %d"count); 
    return 
GameTextForPlayer(playeridstring1005);

Reply
#3

not work textdraw just hide "please wait 120,119" and hide
Reply
#4

PHP код:
#include <a_samp>

forward test(playerid);

new 
timer;
new 
count 120;

public 
OnPlayerCommandText(playeridcmdtext[])
{
    if(
strcmp("/startcount"cmdtexttrue11) == 0)
    {
        
timer SetTimerEx("test"10001"d"playerid);
        return 
1;
        }
    return 
1;
}
public 
test(playerid)
{
    
count--;
    if(
count==0)
    {
        
KillTimer(timer);
        
GameTextForPlayer(playerid,"~r~Go Go Go",2000,5);
        }else{
            new 
string[24];
            
format(stringsizeof(string), "Please wait: %d"count);
            return 
GameTextForPlayer(playeridstring1005);
        }
    return 
1;

Hope it work
Reply
#5

it works i give you +rep but can you help me to add this count to my turf system means when player stay in gang zone it flash and i want
in the same time the textdraw of count shows
this is piece of turf system
Код:
public ZoneUpdate()
{
	for(new z=0; z < MAX_ZONES; z++)
	{
	    if(ZoneTakeOverTeam[z] == -1)
	    {
	        for(new t=0; t < MAX_TEAMS; t++)
	        {
	            if(t == ZoneInfo[z][z_team]) continue;
	            if(GetMembersInZone(z, t) >= 1)
	            {
	                ZoneTakeOverTeam[z] = t;
	                GangZoneFlashForAll(ZoneInfo[z][z_id], GetTeamColor(t));
	                ZoneTakeOverTime[z] = 0;
				}
			}
		}
		else
		{
		    if(GetMembersInZone(z, ZoneTakeOverTeam[z]) > 0)
		    {
		        ZoneTakeOverTime[z]++;
		        if(ZoneTakeOverTime[z] >= 120)
		        {
		            GangZoneStopFlashForAll(ZoneInfo[z][z_id]);
	                GangZoneShowForAll(ZoneInfo[z][z_id], GetTeamColor(ZoneTakeOverTeam[z]));
	                ZoneInfo[z][z_team] = ZoneTakeOverTeam[z];
	                for(new i=0; i<MAX_PLAYERS; i++)
	                {
	                    if(IsPlayerConnected(i))
	                    {
	                        if(GetPlayerZone(i) == z && gTeam[i] == ZoneTakeOverTeam[z])
	                        {
	                            SetPlayerScore(i, GetPlayerScore(i) + 2);
	                            pInfo[i][pKills] += 2;
	                            GameTextForPlayer(i, "~g~Turf ~r~taken over~n~~b~~h~+2 score", 6000, 3);
							}
						}
					}
	                ZoneTakeOverTeam[z] = -1;
	                ZoneTakeOverTime[z] = 0;
				}
			}
			else
			{
                ZoneTakeOverTeam[z] = -1;
                GangZoneStopFlashForAll(ZoneInfo[z][z_id]);
                ZoneTakeOverTime[z] = 0;
			}
		}
	}
}
Reply
#6

Quote:
Originally Posted by lanix
Посмотреть сообщение
it works i give you +rep but can you help me to add this count to my turf system means when player stay in gang zone it flash and i want
in the same time the textdraw of count shows
this is piece of turf system
Код:
public ZoneUpdate()
{
	for(new z=0; z < MAX_ZONES; z++)
	{
	    if(ZoneTakeOverTeam[z] == -1)
	    {
	        for(new t=0; t < MAX_TEAMS; t++)
	        {
	            if(t == ZoneInfo[z][z_team]) continue;
	            if(GetMembersInZone(z, t) >= 1)
	            {
	                ZoneTakeOverTeam[z] = t;
	                GangZoneFlashForAll(ZoneInfo[z][z_id], GetTeamColor(t));
	                ZoneTakeOverTime[z] = 0;
				}
			}
		}
		else
		{
		    if(GetMembersInZone(z, ZoneTakeOverTeam[z]) > 0)
		    {
		        ZoneTakeOverTime[z]++;
		        if(ZoneTakeOverTime[z] >= 120)
		        {
		            GangZoneStopFlashForAll(ZoneInfo[z][z_id]);
	                GangZoneShowForAll(ZoneInfo[z][z_id], GetTeamColor(ZoneTakeOverTeam[z]));
	                ZoneInfo[z][z_team] = ZoneTakeOverTeam[z];
	                for(new i=0; i<MAX_PLAYERS; i++)
	                {
	                    if(IsPlayerConnected(i))
	                    {
	                        if(GetPlayerZone(i) == z && gTeam[i] == ZoneTakeOverTeam[z])
	                        {
	                            SetPlayerScore(i, GetPlayerScore(i) + 2);
	                            pInfo[i][pKills] += 2;
	                            GameTextForPlayer(i, "~g~Turf ~r~taken over~n~~b~~h~+2 score", 6000, 3);
							}
						}
					}
	                ZoneTakeOverTeam[z] = -1;
	                ZoneTakeOverTime[z] = 0;
				}
			}
			else
			{
                ZoneTakeOverTeam[z] = -1;
                GangZoneStopFlashForAll(ZoneInfo[z][z_id]);
                ZoneTakeOverTime[z] = 0;
			}
		}
	}
}
i don't understand can you explant more?

And if you mean by: textdraw not show gametext not show try this hope it work:
PHP код:
#include <a_samp>
forward test(playerid);
new 
timer;
new 
count 120;
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if(
strcmp("/startcount"cmdtexttrue11) == 0)
    {
        
timer SetTimerEx("test"10001"d"playerid);
        return 
1;
        }
    return 
1;
}
public 
test(playerid)
{
    
count--;
    if(
count==0)
    {
        
KillTimer(timer);
        
GameTextForPlayer(playerid,"~r~Go Go Go",2000,5);
        }else{
            new 
string[24];
            
format(stringsizeof(string), "Please wait: %d"count);
            
GameTextForPlayer(playeridstring1005);
            return 
1;
        }
    return 
1;

Reply
#7

it works fine:
but i want to add that time/count system in my turf system,when player stay in gang zone time/count counting 120seconds and team win the territory,i already have when team stay in gang zone it flash now i want upgrade to time textdraw
Reply
#8

i fail to make it textdraw but chek this if you like it tell me o.o:
PHP код:
forward gangzonetimer(playerid);
new 
timer1[MAX_PLAYERS];
new 
count 120;
public 
ZoneUpdate()
{
    for(new 
z=0MAX_ZONESz++)
    {
        if(
ZoneTakeOverTeam[z] == -1)
        {
            for(new 
t=0MAX_TEAMSt++)
            {
                if(
== ZoneInfo[z][z_team]) continue;
                if(
GetMembersInZone(zt) >= 1)
                {
                    
ZoneTakeOverTeam[z] = t;
                    
timer1[playerid] = SetTimerEx("gangzonetimer"10001"d"playerid);
                    
GameTextForPlayer(playerid"~r~Gang Zone War CountDown Started"10000);
                    
ZoneTakeOverTime[z] = 0;
                }
            }
        }
        else
        {
            if(
GetMembersInZone(zZoneTakeOverTeam[z]) > 0)
            {
                
ZoneTakeOverTime[z]++;
                if(
ZoneTakeOverTime[z] >= 120)
                {
                    
GangZoneStopFlashForAll(ZoneInfo[z][z_id]);
                    
KillTimer(timer1[playerid]);
                    
GangZoneShowForAll(ZoneInfo[z][z_id], GetTeamColor(ZoneTakeOverTeam[z]));
                    
ZoneInfo[z][z_team] = ZoneTakeOverTeam[z];
                    for(new 
i=0i<MAX_PLAYERSi++)
                    {
                        if(
IsPlayerConnected(i))
                        {
                            if(
GetPlayerZone(i) == && gTeam[i] == ZoneTakeOverTeam[z])
                            {
                                
SetPlayerScore(iGetPlayerScore(i) + 2);
                                
pInfo[i][pKills] += 2;
                                
GameTextForPlayer(i"~g~Turf ~r~taken over~n~~b~~h~+2 score"60003);
                            }
                        }
                    }
                    
ZoneTakeOverTeam[z] = -1;
                    
ZoneTakeOverTime[z] = 0;
                }
            }
            else
            {
                
ZoneTakeOverTeam[z] = -1;
                
GangZoneStopFlashForAll(ZoneInfo[z][z_id]);
                
ZoneTakeOverTime[z] = 0;
            }
        }
    }
}
public 
gangzonetimer(playerid)
{
    
count--;
    if(
count==0)
    {
        
GameTextForPlayer(playerid"~b~Gang Zone War Ended."10000);
        
KillTimer(timer1[playerid]);
        }else{
            new 
string[120];
            
format(stringsizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~%d"count);
            
GameTextForPlayer(playeridstring10003);
            return 
1;
        }
    return 
1;

Reply
#9

hmm,i got this
Код:
D:\Documents and Settings\Lanix\Desktop\TDM BETA\pawno\include\dutils.inc(309) : warning 219: local variable "count" shadows a variable at a preceding level
D:\Documents and Settings\Lanix\Desktop\TDM BETA\pawno\include\dutils.inc(329) : warning 219: local variable "count" shadows a variable at a preceding level
D:\Documents and Settings\Lanix\Desktop\TDM BETA\pawno\include\dutils.inc(348) : warning 219: local variable "count" shadows a variable at a preceding level
D:\Documents and Settings\Lanix\Desktop\TDM BETA\gamemodes\SFTDM.pwn(1229) : warning 219: local variable "count" shadows a variable at a preceding level
D:\Documents and Settings\Lanix\Desktop\TDM BETA\gamemodes\SFTDM.pwn(1295) : error 017: undefined symbol "playerid"
D:\Documents and Settings\Lanix\Desktop\TDM BETA\gamemodes\SFTDM.pwn(1296) : error 017: undefined symbol "playerid"
D:\Documents and Settings\Lanix\Desktop\TDM BETA\gamemodes\SFTDM.pwn(1309) : error 017: undefined symbol "playerid"
D:\Documents and Settings\Lanix\Desktop\TDM BETA\gamemodes\SFTDM.pwn(3600) : warning 219: local variable "count" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#10

Quote:
Originally Posted by lanix
Посмотреть сообщение
hmm,i got this
Код:
D:\Documents and Settings\Lanix\Desktop\TDM BETA\pawno\include\dutils.inc(309) : warning 219: local variable "count" shadows a variable at a preceding level
D:\Documents and Settings\Lanix\Desktop\TDM BETA\pawno\include\dutils.inc(329) : warning 219: local variable "count" shadows a variable at a preceding level
D:\Documents and Settings\Lanix\Desktop\TDM BETA\pawno\include\dutils.inc(348) : warning 219: local variable "count" shadows a variable at a preceding level
D:\Documents and Settings\Lanix\Desktop\TDM BETA\gamemodes\SFTDM.pwn(1229) : warning 219: local variable "count" shadows a variable at a preceding level
D:\Documents and Settings\Lanix\Desktop\TDM BETA\gamemodes\SFTDM.pwn(1295) : error 017: undefined symbol "playerid"
D:\Documents and Settings\Lanix\Desktop\TDM BETA\gamemodes\SFTDM.pwn(1296) : error 017: undefined symbol "playerid"
D:\Documents and Settings\Lanix\Desktop\TDM BETA\gamemodes\SFTDM.pwn(1309) : error 017: undefined symbol "playerid"
D:\Documents and Settings\Lanix\Desktop\TDM BETA\gamemodes\SFTDM.pwn(3600) : warning 219: local variable "count" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Can send error lines?
EDIT: Befor the line 1295 add: new playerid;

warning 219: local variable "count" shadows a variable at a preceding level
it because you add two new count = 120; remove on of them
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)