Why don't get back in DM zone after death?
#1

Код:
public OnPlayerSpawn(playerid)
{ 
      if(DM[playerid] == true)
      {
      new rand = random(sizeof(RandomSpawnDM));
      SetPlayerPos(playerid, RandomSpawnDM[rand][0], RandomSpawnDM[rand][1],RandomSpawnDM[rand][2]);
      ResetPlayerWeapons(playerid);
      GivePlayerWeapon(playerid, 24, 20000);
      GivePlayerWeapon(playerid, 25, 20000);
      GivePlayerWeapon(playerid, 29, 20000);
      SetPlayerVirtualWorld(playerid, 2);
      SetPlayerHealth(playerid, 100);
      SetPlayerArmour(playerid, 100);
      }
      if(DM1[playerid] == true)
      {
      new rando = random(sizeof(RandomSpawnDM1));
      SetPlayerPos(playerid, RandomSpawnDM1[rando][0], RandomSpawnDM1[rando][1],RandomSpawnDM1[rando][2]);
      ResetPlayerWeapons(playerid);
      GivePlayerWeapon(playerid, 24, 20000);
      GivePlayerWeapon(playerid, 25, 20000);
      GivePlayerWeapon(playerid, 29, 20000);
      SetPlayerVirtualWorld(playerid, 2);
      SetPlayerHealth(playerid, 100);
      SetPlayerArmour(playerid, 100);
      }
    return 1;
}
formerly was all okey but now, after death i spawn into spawn zone, not in DM zone.

Код:
new Float:RandomSpawnDM1[][4] =
{
    {3141.1995,-1470.5856,5.1300,231.2364},
    {3145.8940,-1505.7411,5.1300,282.6237},
    {3173.8682,-1507.9838,5.1300,97.4653}
};

new Float:RandomSpawnDM[][4] =
{
    {-1303.1121,2542.2937,93.3047,174.8515},
    {-1318.7681,2540.9197,87.6752,172.9792},
    {-1311.6586,2519.6934,87.2836,152.9255}
};
Reply
#2

Are you sure that DM or DM1 are true?
Reply
#3

Yes, here /dm and /dm1 cmd.

Код:
      COMMAND:dm1( playerid, params[ ] )
{
      if(IsPlayerInAnyVehicle(playerid)) { return SendClientMessage(playerid, 0x33CCFFAA, "Pirmiausiai iљlipkite iљ maљinos!"); }
      if(DM[playerid]) return SendClientMessage(playerid, 0xDEEE20FF, "Jūs jau esate DM zonoje.");
      if(DM1[playerid]) return SendClientMessage(playerid, 0xDEEE20FF, "Jūs jau esate DM zonoje.");
      SetPlayerVirtualWorld(playerid, 2);
      DM1[playerid] = true;
      SetPlayerHealth(playerid, 100);
      SetPlayerArmour(playerid, 100);
      GivePlayerWeapon(playerid, 9, 20000);
      GivePlayerWeapon(playerid, 16, 20000);
      GivePlayerWeapon(playerid, 30, 20000);
      new rando = random(sizeof(RandomSpawnDM1));
      SetPlayerPos(playerid, RandomSpawnDM1[rando][0], RandomSpawnDM1[rando][1],RandomSpawnDM1[rando][2]);
      return 1;
}
      COMMAND:dm( playerid, params[ ] )
{
      if(IsPlayerInAnyVehicle(playerid)) { return SendClientMessage(playerid, 0x33CCFFAA, "Pirmiausiai iљlipkite iљ maљinos!"); }
      if(DM1[playerid]) return SendClientMessage(playerid, 0xDEEE20FF, "Jūs jau esate DM zonoje.");
      if(DM[playerid]) return SendClientMessage(playerid, 0xDEEE20FF, "Jūs jau esate DM zonoje.");
      SetPlayerVirtualWorld(playerid, 2);
      DM[playerid] = true;
      SetPlayerHealth(playerid, 100);
      SetPlayerArmour(playerid, 100);
      GivePlayerWeapon(playerid, 24, 20000);
      GivePlayerWeapon(playerid, 25, 20000);
      GivePlayerWeapon(playerid, 29, 20000);
      new rand = random(sizeof(RandomSpawnDM));
      SetPlayerPos(playerid, RandomSpawnDM[rand][0], RandomSpawnDM[rand][1],RandomSpawnDM[rand][2]);
      return 1;
}
Reply
#4

Where are the variables defined originally, and are you sure you don't set it to false somewhere in e.g. OnPlayerDeath?
Reply
#5

Quote:
Originally Posted by LarzI
Посмотреть сообщение
Where are the variables defined originally, and are you sure you don't set it to false somewhere in e.g. OnPlayerDeath?
You mean this?
Код:
new bool:DM[MAX_PLAYERS];
new bool:DM1[MAX_PLAYERS];
I checked, i don't set it to false :/ Formerly was all okey, but now it doesn't works, i don't understand why.
Reply
#6

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
SetPlayerPos and OnPlayerSpawn don't get along well, I've come across this problem a lot!

Simply set a 100ms timer that fixes the problem, the player will suddenly see the default spawn for 100ms but shouldn't be a massive problem.

Also, you could actually use SetSpawnInfo on OnPlayerDeath to prepare for OnPlayerSpawn, I haven't tried that but it should work!
In fact, I do recall this problem happening to me a couple of years ago.
Reply
#7

FIXED.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)