OnPlayerKeyStateChange - buggy object
#3

Quote:
Originally Posted by Virtual1ty
View Post
Be very careful with that code, specifically this part:
Code:
format(string, sizeof(string), "SUBMARINE: Torpedo away! Remaining torpedos: %d/4", Submarine[SubID[playerid]][Torpedos]);
CanShoot[playerid] = 0;
foreach(Player, i)
{
	if(IsPlayerInRangeOfPoint(i, 20, X, Y, Z))
	{
		SendClientMessage(i, -1, string), string = "\0";
	}
}
The way I see it, you send the first player found in range a message, and then you "NULL terminate" the string, perhaps you wanted to "end it" after the foreach loop?

Also I suggest detecting stuff like that under OnPlayerUpdate with static variables, simply because it gets called more frequently.
Too many things, doing a loop each second ( or even less! ) would cause the server to crash imo.
It's the same as running a 1 second ( or 500 ms ) timer which repeats itself..

Still need help though.
Reply


Messages In This Thread
OnPlayerKeyStateChange - buggy object - by Kyance - 13.08.2014, 14:00
Re: OnPlayerKeyStateChange - buggy object - by Virtual1ty - 13.08.2014, 14:16
Re: OnPlayerKeyStateChange - buggy object - by Kyance - 13.08.2014, 14:57
Re: OnPlayerKeyStateChange - buggy object - by Virtual1ty - 13.08.2014, 14:59
Re: OnPlayerKeyStateChange - buggy object - by Kyance - 13.08.2014, 15:09
Re: OnPlayerKeyStateChange - buggy object - by Virtual1ty - 13.08.2014, 15:18
Re: OnPlayerKeyStateChange - buggy object - by Kyance - 13.08.2014, 15:22

Forum Jump:


Users browsing this thread: 1 Guest(s)