problem with the code
#1

Good day, when this public is called, will teleport only one person, and in fact should teleport all.
Player[playerid][lobby_gamer] - works fine I checked.
The problem is somewhere in the public

Код:
public game(playerid)
{
	SetTimer("bot_stop", 120000, false);

	Player[playerid][LastKills] = 0;
	lobby_start = 0;
	print("Match started");
	SendClientMessageToAll(0x00FF40FF,"game starting");
	game_start = 1;
	spawn_loot();
	SetTimer("inplane", 120000, false);
	foreach(new i:Player)
	{
		if(IsPlayerNPC(i)) return true;
		if(Player[i][lobby_gamer] == 1)
		{
			TogglePlayerSpectating(i, 1);
			PlayerSpectateVehicle(i, AirplaneNPC);
			SendClientMessage(i, 0x00FFFFFF, "{FF8000}la la la la: {00FF00}F");
			Player[i][InPlane] = 1;
			max_gamers++;
			max_top++;
			printf("All survivals: %d", max_gamers);
			SetPlayerPos(i, 0, 0, 2);
			return 1;
		}
 	}
	return 1;
}
Reply
#2

you have `return 1;` which stops the callback.
Reply
#3

Its supposed to teleport only 1 player.
Reply
#4

Replace the first return with continue. Remove the second return.

Returning a value in a loop, breaks the loop and exists the function.
Reply
#5

Quote:
Originally Posted by Kaperstone
Посмотреть сообщение
you have `return 1;` which stops the callback.
what should I do? I do not understand
Reply
#6

Quote:
Originally Posted by kronka
Посмотреть сообщение
what should I do? I do not understand
Above your post!
Reply
#7

warning 209: function "game" should return a value
Reply
#8

Quote:
Originally Posted by Paulice
Посмотреть сообщение
Above your post!
warning 209: function "game" should return a value
Reply
#9

Quote:
Originally Posted by kronka
Посмотреть сообщение
warning 209: function "game" should return a value
Leave the last return there. You have 3 returns fyi.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)