Posts: 596
Threads: 75
Joined: Nov 2015
Forexample i have a Float Array:
Код:
new Float:Array [][4] =
{x,y,z,a},
{x,y,z,a},
{x,y,z,a}
}
Actually i am making a derby system,I want to check if a player is spawned at one of these cords or not.
Posts: 349
Threads: 38
Joined: Jul 2015
Reputation:
0
I don't get what you actually mean but why not just check it with a variable? When a player joins a derby set a var to true/1 right when you spawn them using one of those coord(s).
Posts: 596
Threads: 75
Joined: Nov 2015
I mean,how will i check if one of these coords are used? I want to avoid 2 players spawning is 1 place
Posts: 11,827
Threads: 33
Joined: Dec 2011
Reputation:
0
Using another array with the same size and set accordingly (to true when the spot is taken or to false when not). To me though, the best way would be an iterator from foreach/y_iterate. When a derby match is starting, add all the free slots to the iterator and when a player joins, pick up a random slot and remove it from the iterator afterwards.
Posts: 596
Threads: 75
Joined: Nov 2015
Can i do like this?:
Код:
new Used[5];
OnPlayerSpawn(playerid)
{
new spawn = random(sizeof(Array));
if(Used[spawn] == 0)
{
SetPlayerPos(playerid, Array[spawn][0].....);
for(new i = 0; i < sizeof(Array); i++)
{
Used[i] == 1;
}
}
return 1;
}
Posts: 1,578
Threads: 15
Joined: Feb 2013
Reputation:
0
Are you actually asking if the spawn is used or if the player is using one of those spawns?
Because if you want to check if the player is using one of those spawns, you need to make a 2d array.
(Used[playerid][spawnid] -- spawnid is the spawns array slot)