[Include] L_S-A-M : Lordz's Surface to Air Missile system!
#24

Quote:
Originally Posted by Natric
Посмотреть сообщение
Dude, I'm not a newbie I even made using your include a dynamic system please read the post and test the code the server crashed when the missile exploded and I have the latest version already..
I hope you will give me your attention..
Thanks
Well, I've spent some times in checking the edits you've done. I don't know whether you've changed the type of the variables declared, especially in boolean cases. However, I faced some tag mismatch warns while compiling the one you gave, however it's fixed.
pawn Код:
#define SAMInfo L_SAMData

public LordzSAMTimer()
{
    for(new i; i < MAX_LSAMS; i++)
    {
        if(L_SAMData[i][L_SAMCreated])
        {
            for(new a; a < MAX_PLAYERS; a++)
            {
                if(!IsPlayerConnected(a)) continue;
                if(!IsPlayerInRangeOfPoint(a, SAMInfo[i][L_SAMRange], SAMInfo[i][L_SAMX], SAMInfo[i][L_SAMY], SAMInfo[i][L_SAMZ])) continue;
                if(L_SAM_ExceptionalPlayer[a][i]) continue;
                if(MissileInProgress[a]) continue;
                GetPlayerPos(a, L_SAMPlayerPos[a][0], L_SAMPlayerPos[a][1], L_SAMPlayerPos[a][2]);
                new p_missileobj = CreateObject(345, SAMInfo[i][L_SAMX], SAMInfo[i][L_SAMY], SAMInfo[i][L_SAMZ], 0.0, 0.0, 0.0, 300.0);
                PlayerMissile[a] = p_missileobj;
                L_SAMMissileObject[p_missileobj] = 1;
                L_SAMMissilePower[p_missileobj] = SAMInfo[i][L_SAMPower];
                L_SAMMissileProgress[p_missileobj] = a;
                MoveObject(p_missileobj, L_SAMPlayerPos[a][0], L_SAMPlayerPos[a][1], L_SAMPlayerPos[a][2], SAMInfo[i][L_SAMSpeed]);
                MissileInProgress[a] = true;
                SetPlayerMapIcon(a, 99, SAMInfo[i][L_SAMX], SAMInfo[i][L_SAMY], SAMInfo[i][L_SAMZ], 0, 0x660000FF);
                L_SAMMissileMarker[a] = SetTimerEx("L_SAMUpdateMapIcon", 250, true, "ii", a, i);
            }
        }
    }
    return 1;
}


forward L_SAMUpdateMapIcon(playerid, samid);
public L_SAMUpdateMapIcon(playerid, samid)
{
    if(!MissileInProgress[playerid]) return KillTimer(L_SAMMissileMarker[playerid]);
    new Float:X, Float:Y, Float:Z, Float:oX, Float:oY, Float:oZ;
    if(SAMInfo[samid][L_SAMFollow] == true)
    {
        GetPlayerPos(playerid, X, Y, Z);
        GetObjectPos(PlayerMissile[playerid], oX, oY, oZ);
        if(IsPlayerInRangeOfPoint(playerid, 10.0, oX, oY, oZ))
        {
            L_SAMMissileStopped[PlayerMissile[playerid]] = false;
            return CallLocalFunction("OnObjectMoved", "i", PlayerMissile[playerid]);
        }
        else
        {
            L_SAMMissileStopped[PlayerMissile[playerid]] = true;
            L_SAMAssignedSpeed[PlayerMissile[playerid]] = SAMInfo[samid][L_SAMSpeed]+randomEx(2,20); //Increasing the speed!
            StopObject(PlayerMissile[playerid]);
            MoveObject(PlayerMissile[playerid], X, Y, Z, L_SAMAssignedSpeed[PlayerMissile[playerid]]);
        }
    }
    GetObjectPos(PlayerMissile[playerid], X, Y, Z);
    SetPlayerMapIcon(playerid, 99, X, Y, Z, 0, 0x660000FF);
    return 1;
}

public OnObjectMoved(objectid)
{
 if(L_SAMMissileObject[objectid] == 1)
 {
  if(!L_SAMMissileStopped[objectid])
  {
  new Float:X, Float:Y, Float:Z;
  GetObjectPos(objectid, X, Y, Z);
  switch(L_SAMMissilePower[objectid])
  {
   case 0: CreateExplosion(X+4.0, Y+4.0, Z, 2, 12.0);
   case 1: CreateExplosion(X+4.0, Y+4.0, Z, 7, 12.0);
   case 2:
   {
      CreateExplosion(X+8.0,Y, Z, 7, 10.0);
      CreateExplosion(X-8.0,Y, Z, 7, 10.0);
      CreateExplosion(X, Y+8.0,Z, 7, 10.0);
      CreateExplosion(X, Y-8.0,Z, 7, 10.0);
   }
   case 3:
   {
      new Float:range = 8.0;
      CreateExplosion(X+range,Y, Z, 6, 10.0);
      CreateExplosion(X-range,Y, Z, 6, 10.0);
      CreateExplosion(X, Y+range,Z, 6, 10.0);
      CreateExplosion(X, Y-range,Z, 6, 10.0);
      CreateExplosion(X+range,Y+range,Z, 6, 10.0);
      CreateExplosion(X-range,Y+range,Z, 6, 10.0);
      CreateExplosion(X-range,Y-range,Z, 6, 10.0);
   }
  }
  DestroyObject(objectid);
  RemovePlayerMapIcon(L_SAMMissileProgress[objectid], 99);
  L_SAMMissileObject[objectid] = 0;
  L_SAMMissilePower[objectid] = 0;
  MissileInProgress[L_SAMMissileProgress[objectid]] = false;
  L_SAMMissileProgress[objectid] = -1;
  }
 }
 CallLocalFunction("OnObjectMoved", "i", objectid);
 return 1;
}
I tested this in-game too, it works fine.
Reply


Messages In This Thread
L_S-A-M : Lordz's Surface to Air Missile system! <Version : 1.3 | With Following Missiles!> - by Lordzy - 01.01.2014, 13:43
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by LeGGGeNNdA - 01.01.2014, 13:45
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by gtakillerIV - 01.01.2014, 13:45
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Juniiro3 - 01.01.2014, 14:06
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by [WH]Marcos - 01.01.2014, 23:31
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by JaKe Elite - 02.01.2014, 03:49
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Lordzy - 02.01.2014, 04:44
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by PT - 02.01.2014, 04:58
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Lordzy - 02.01.2014, 05:25
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by iBeast - 02.01.2014, 06:32
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Lordzy - 02.01.2014, 09:50
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Lordzy - 02.01.2014, 13:31
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Pottus - 02.01.2014, 14:27
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Lordzy - 02.01.2014, 14:47
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Pottus - 02.01.2014, 15:02
Respuesta: L_S-A-M : Lordz's Surface to Air Missile system! - by Swedky - 03.01.2014, 05:15
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by GamingJoKeR - 03.01.2014, 05:48
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Sojo12 - 03.01.2014, 08:55
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by HeLLeR - 03.01.2014, 11:32
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Lordzy - 03.01.2014, 16:44
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Natric - 04.01.2014, 16:56
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Lordzy - 04.01.2014, 17:01
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Natric - 04.01.2014, 17:14
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Lordzy - 04.01.2014, 17:28
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Natric - 05.01.2014, 09:05
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by iZN - 05.01.2014, 09:21
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by donhu789 - 05.01.2014, 11:52
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Voxel - 05.01.2014, 12:28
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Lordzy - 05.01.2014, 13:02
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by donhu789 - 05.01.2014, 13:26
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Lordzy - 17.08.2014, 05:09
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Dampyr - 25.08.2014, 11:15
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Lordzy - 26.08.2014, 13:26
Re: L_S-A-M : Lordz's Surface to Air Missile system! - by Dampyr - 26.08.2014, 13:58

Forum Jump:


Users browsing this thread: 3 Guest(s)