Ramp spawning theortetical stuff :/
#1

Hi!

So I have this little ramp function. It checks whether player ramp is used or not, then spawns deciding on the ramp slot status.
pawn Код:
if(togRamp[playerid] == true)
{
  if(IsPlayerInAnyVehicle(playerid))
  {
    if(newkeys & rampKey[playerid])
    {
      if(playerRampUsed[playerid][0] == 0)
      {
        CreatePlayerRamp(playerid, 0);
      }
      else
      {
        if(playerRampUsed[playerid][1] == 0)
        {
          CreatePlayerRamp(playerid, 1);
        }
        else
        {
          if(playerRampUsed[playerid][2] == 0)
          {
            CreatePlayerRamp(playerid, 2);
          }
          else
          {
            CreatePlayerRamp(playerid, 0);
          }
        }
      }
    }
  }
}
But what happens is that:
Player presses their ramp key, ramp spawns (player ramp slot 0)...
Player presses their ramp key, ramp spawns (player ramp slot 1)...
Player presses their ramp key, ramp spawns (player ramp slot 2)...
Player presses their ramp key, ramp spawns (player ramp slot 2 overriding 2)...
What I want it to do while ramp slots 0, 1 and 2 are full is to override ramp slot 0!
I don't know what I've done wrong, but look at my CreatePlayerRamp function:
pawn Код:
CreatePlayerRamp(playerid, rampslot)
{
  if(playerRampUsed[playerid][rampslot] == rampslot) destroyPlayerRamp(playerid, rampslot);
         
  GetPlayerPos(playerid, POS[0], POS[1], POS[2]);
  playerRamp[playerid][rampslot] = CreatePlayerObject(playerid, 1632, POS[0], POS[1], POS[2] - 0.4, 0.0, 0.0, GetPosInFrontOfPlayer(playerid, POS[0], POS[1], GetRampDistance(playerid)));
  playerRampUsed[playerid][rampslot] = 1;
  KillTimer(playerRampDestroy[playerid][rampslot]);
  playerRampDestroy[playerid][rampslot] = SetTimerEx("destroyPlayerRamp", 1500, false, "id", playerid, rampslot);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)