new slot = 1;CMD:teleport(playerid,params[]){switch(slot){ case 1: { SetPlayerPos(playerid,4546.3105,-1680.5861,2.5164); case 2: { SetPlayerPos(playerid,4578.4160,-1709.4919,2.4970); case 3: { SetPlayerPos(playerid,4589.8584,-1751.5660,2.5140); case 4: { SetPlayerPos(playerid,4579.4805,-1791.7196,2.5148); case 5: { SetPlayerPos(playerid,4550.1611,-1820.3798,2.4766); case 6: { SetPlayerPos(playerid,4511.6865,-1833.4990,2.4496); case 7: { SetPlayerPos(playerid,4468.5151,-1826.7098,2.5156); case 8: { SetPlayerPos(playerid,4436.7437,-1795.4780,2.4522); case 9: { SetPlayerPos(playerid,4424.8286,-1755.5376,2.4792); case 10: { SetPlayerPos(playerid,4435.2319,-1713.8533,2.5265); case 11: { SetPlayerPos(playerid,4465.7964,-1681.5546,2.5428); case 12: { SetPlayerPos(playerid,4506.1807,-1671.7106,2.5378); case 13: { SetPlayerPos(playerid,4546.3618,-1680.6895,2.4973); case 14: { SetPlayerPos(playerid,4578.5610,-1709.3564,2.5123); case 15: { SetPlayerPos(playerid,4590.5747,-1751.2606,2.4305); case 16: { SetPlayerPos(playerid,4579.5103,-1791.7421,2.5066); case 17: { SendClientMessage(playerid,-1,\"Nincs több hely!\"); slot = 16; }}++slot;return 1;}}
{ SendClientMessage(playerid,-1,\"Nincs több hely!\"); slot = 16; }
2. helyre kéne kerülnie,de azt hogy oldjam meg?[/quote] Nem a 4. helyre? (5-2=3 -> de 3. hely foglalt 3+1=4)
enum spawn_{Float:X,Float:Y,Float:Z,Float:A, //szögbool:Free}; new minigame_spawn[][spawn_] ={{4546.3105,-1680.5861,2.5164,0,true}//ide a többit, most nem írom végig};new minigame_slot_id[MAX_PLAYERS]; CMD:teleport(playerid,params[]){if(minigame_slot_id[playerid] != -1) return SendClientMessage(playerid,-1,\"Minigameban vagy!\");new free_id = -1; //szabad tömbindex azonosítójafor(new i = 0; i < sizeof(minigame_spawn);i++){if(minigame_spawn[Free] == true) //ha van szabad hely (true == igaz){ free_id = i; //most, hogy egyszerûbb legyen ezért külön változóba menjük break; //kilépünk a ciklusból}}if(free_id == -1) //ha nem talál szabad helyet akkor az értéke marad -1{return SendClientMessage(playerid,-1,\"Nincs több hely! \");} SetPlayerPos(playerid,minigame_spawn[free_id][X],minigame_spawn[free_id][Y],minigame_spawn[free_id][Z]);SetPlayerFacingAngle(playerid,minigame_spawn[free_id][A]); //szög állításaminigame_spawn[free_id][Free] = false; //mostmár foglalt ez a hely! minigame_slot_id[playerid] = free_id;return 1;}CMD:kilep(playerid,params[]){if(minigame_slot_id[playerid] == -1) return SendClientMessage(playerid,-1,\"Nem vagy minigaméban!\");minigame_slot_id[playerid] = true; //felszabadítjuk a helyet//többi idereturn 1;}
new slot[MAX_PLAYERS];
new slot = 1;