27.06.2012, 08:54
(
Последний раз редактировалось TyThaBomb; 28.06.2012 в 02:01.
)
Err, so I may have posted something similar to this earlier, but I've got a new bug.
I do /countdown, it counts down fine, but if someone else is near, it bugs the timer, affecting the countdown.
(Yes, I'm trying to get it to where if a player is near it counts down for them too.)
Here's the code, thanks in advance.
LadyNyuuu's post was correct, I made a noob error.
I do /countdown, it counts down fine, but if someone else is near, it bugs the timer, affecting the countdown.
(Yes, I'm trying to get it to where if a player is near it counts down for them too.)
Here's the code, thanks in advance.
pawn Код:
command(countdown,playerid,params[])
{
CountDown(playerid, 3);
return 1;
}
forward CountDown(playerid, seconds);
public CountDown(playerid, seconds)
{
new string[50];
if(seconds > 0)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
for(new i=0;i<MAX_PLAYERS;i++) {
if(IsPlayerInRangeOfPoint(i, 40, X, Y, Z)) {
PlayerPlaySound(i, 1056, X, Y, Z);
format(string, sizeof(string), "~b~%d", seconds);
GameTextForPlayer(i, string, 1000, 3);
seconds = seconds -1;
SetTimerEx("CountDown", 1000, 0, "ii", playerid, seconds);
}
}
return 1;
}
if(seconds == 0)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
for(new i=0;i<MAX_PLAYERS;i++) {
if(IsPlayerInRangeOfPoint(i, 40, X, Y, Z)) {
PlayerPlaySound(playerid, 1057, X, Y, Z);
GameTextForPlayer(playerid, "~G~Go!", 1000, 3);
}
}
return 1;
}
return 1;
}