Timer problem
#8

Oh I used playerid because I am used to playerid not Target xD ... My bad.

The reason I say yours isn't going to work is because, say if three people get shot at the same exact time, all three players will get the third player's health loss and not their own.

Thats why this...

Код:
new
timer1[MAX_PLAYERS];
forward mytimer(playerid); public OnGameModeInit() {
dtxtdraw[MAX_PLAYERS] = TextDrawCreate(400.0,280.0, "~r~ -, health"); dtxtdraz[MAX_PLAYERS] = TextDrawCreate(450.0,280.0, "~b~ -, armour"); return 1;
} public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost) {
new
msg[128], msg2[128];
format(msg, sizeof(msg), "~r~ -%f, health", HealthLost); format(msg2, sizeof(msg2), "~b~ -%f, armour", ArmourLost); TextDrawSetString(dtxtdraw[Target], msg); TextDrawSetString(dtxtdraz[Target], msg2); TextDrawShowForPlayer(Target, dtxtdraw[Target]); TextDrawShowForPlayer(Target, dtxtdraz[Target]); timer1[Target] = SetTimerEx("mytimer", 1000, false, "d", Target); return 1;
} public mytimer(playerid) {
TextDrawHideForPlayer(playerid, dtxtdraw[playerid]); TextDrawHideForPlayer(playerid, dtxtdraw[playerid]); KillTimer(timer1[playerid]); return 1;
}
... is better.

You had the right idea, but it would've cause bugs.
Reply


Messages In This Thread
Timer problem - by random123 - 06.10.2011, 08:24
Re: Timer problem - by TheLazySloth - 06.10.2011, 08:46
Re: Timer problem - by System64 - 06.10.2011, 08:47
Re: Timer problem - by TheLazySloth - 06.10.2011, 08:50
Re: Timer problem - by random123 - 06.10.2011, 08:51
Re: Timer problem - by TheLazySloth - 06.10.2011, 08:53
Re: Timer problem - by System64 - 06.10.2011, 09:41
Re: Timer problem - by TheLazySloth - 06.10.2011, 09:49
Re: Timer problem - by random123 - 07.10.2011, 00:12
Re: Timer problem - by random123 - 08.10.2011, 05:36

Forum Jump:


Users browsing this thread: 1 Guest(s)