Posts: 1,266
Threads: 6
Joined: Oct 2014
PHP код:
#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, 0, "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);
}
Posts: 158
Threads: 14
Joined: Dec 2014
Reputation:
0
not work textdraw just hide "please wait 120,119" and hide
Posts: 1,266
Threads: 6
Joined: Oct 2014
PHP код:
#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;
}
return 1;
}
public test(playerid)
{
count--;
if(count==0)
{
KillTimer(timer);
GameTextForPlayer(playerid,"~r~Go Go Go",2000,5);
}else{
new string[24];
format(string, sizeof(string), "Please wait: %d", count);
return GameTextForPlayer(playerid, string, 100, 5);
}
return 1;
}
Hope it work
Posts: 1,266
Threads: 6
Joined: Oct 2014
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(playerid, cmdtext[])
{
if(strcmp("/startcount", cmdtext, true, 11) == 0)
{
timer = SetTimerEx("test", 1000, 1, "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(string, sizeof(string), "Please wait: %d", count);
GameTextForPlayer(playerid, string, 100, 5);
return 1;
}
return 1;
}
Posts: 158
Threads: 14
Joined: Dec 2014
Reputation:
0
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
Posts: 1,266
Threads: 6
Joined: Oct 2014
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=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;
timer1[playerid] = SetTimerEx("gangzonetimer", 1000, 1, "d", playerid);
GameTextForPlayer(playerid, "~r~Gang Zone War CountDown Started", 1000, 0);
ZoneTakeOverTime[z] = 0;
}
}
}
else
{
if(GetMembersInZone(z, ZoneTakeOverTeam[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=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;
}
}
}
}
public gangzonetimer(playerid)
{
count--;
if(count==0)
{
GameTextForPlayer(playerid, "~b~Gang Zone War Ended.", 1000, 0);
KillTimer(timer1[playerid]);
}else{
new string[120];
format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~%d", count);
GameTextForPlayer(playerid, string, 1000, 3);
return 1;
}
return 1;
}
Posts: 1,266
Threads: 6
Joined: Oct 2014
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