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

Hello there,

I appreciate that you've released this, but I've some issues:

Alright, first I converted the missile system to dynamicobject, after I did, it didn't work ingame ( I noticed the reply of [uL]Pottus and it was right) ---> thats doesnt matter for me since I knew the reason why it doesnt work

Secondly, I converted it back to normal objects (createobject) with the whole functions of it and logged ingame to test it, it worked as charm but unfortunately after the missile exploded the server crashed (the speed was 3 and range 30 and power 1 and follow 0)

HINT: I did changes to the CODE

the code:

pawn Код:
public LordzSAMTimer()
{
    for(new i; i < MAX_LSAMS; i++)
    {
        if(SAMInfo[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] = 1;
                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] == 1)
    {
        GetPlayerPos(playerid, X, Y, Z);
        GetObjectPos(PlayerMissile[playerid], oX, oY, oZ);
        if(IsPlayerInRangeOfPoint(playerid, 10.0, oX, oY, oZ))
        {
            L_SAMMissileStopped[PlayerMissile[playerid]] = 0;
            return CallLocalFunction("OnObjectMoved", "i", PlayerMissile[playerid]);
        }
        else
        {
            L_SAMMissileStopped[PlayerMissile[playerid]] = 1;
            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]] = 0;
  L_SAMMissileProgress[objectid] = -1;
  }
 }
 CallLocalFunction("OnObjectMoved", "i", objectid);
 return 1;
}
Please help me to fix this.
Thanks in advance,
Natric Fenix.
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: 4 Guest(s)