SA-MP Forums Archive
A weird bug with my aleave command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: A weird bug with my aleave command (/showthread.php?tid=648682)



A weird bug with my aleave command - ivndosos - 26.01.2018

Код:
CMD:aleave(playerid, params[])
{
   if(InArena1[playerid] == 1)
   {
    SetPlayerInterior(playerid, 0);
    SetPlayerVirtualWorld(playerid, 0);
    SendClientMessage(playerid, -1, "{EFB509}(INFO) You have left arena1!");
    SpawnPlayer(playerid);
   }
   else
   {
	  SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You're not in the arena!");
   }
   return 1;
}
.

When I use that command, Instead of spawning, It spawns me at the sky somewhere far, Why so?


Re: A weird bug with my aleave command - RowdyrideR - 26.01.2018

Show us the code where the player enters the arena


Re: A weird bug with my aleave command - ivndosos - 26.01.2018

Код:
CMD:arena1(playerid, params[])
{
   new Float:health, name[MAX_PLAYER_NAME], str[128];
   GetPlayerHealth(playerid, health);
   AFKTime[playerid] = SetTimer("AFKCheck",1000,1);
   new arenainterior = GetPlayerInterior(playerid);
   if(health < 90) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You must have atleast 90 HP in order to go to the arena");
   if(arenainterior == 18) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) You're already inside arena1, Use /aleave to leave");
   else
   {
      InArena1[playerid] = 1;
	  SetPlayerVirtualWorld(playerid, 2);
	  SetPlayerInterior(playerid, 18);
	  new randomarena1 = random(sizeof(RandomArena1Spawns));
	  SetPlayerPos(playerid, RandomArena1Spawns[randomarena1][0],RandomArena1Spawns[randomarena1][1],RandomArena1Spawns[randomarena1][2]);
	  SetPlayerFacingAngle(playerid, RandomArena1Spawns[randomarena1][3]);
	  GetPlayerName(playerid, name, sizeof(name));
	  format(str, sizeof(str), "{4286f4}(INFO) %s has teleported to Arena 1, To go there type /arena1.", name);
	  SendClientMessageToAll(-1, str);
	  GivePlayerWeapon(playerid, 24, 999);
	  GivePlayerWeapon(playerid, 25, 999);
   }
   return 1;
}



Re: A weird bug with my aleave command - rfr - 26.01.2018

is RandomArena1Spawns[randomarena1] a float?


Re: A weird bug with my aleave command - ivndosos - 26.01.2018

I've fixed it, Had to add InArena1[playerid] = 0;

Haven't realized it, till my mate told me, lol.