Re: L_S-A-M : Lordz's Surface to Air Missile system! -
Natric - 04.01.2014
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.
Re: L_S-A-M : Lordz's Surface to Air Missile system! -
Lordzy - 04.01.2014
Quote:
Originally Posted by Natric
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.
|
I haven't checked to the codes, but try using the include which is kept for download. The speed may not depend actually, I've even tested with speed rate at 1. Well, anyway, give it a try by downloading the latest version.
Note : If it's a filterscript, you must define "#define FILTERSCRIPT" before including this one.
Re: L_S-A-M : Lordz's Surface to Air Missile system! -
Natric - 04.01.2014
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
Re: L_S-A-M : Lordz's Surface to Air Missile system! -
Lordzy - 04.01.2014
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.
Re: L_S-A-M : Lordz's Surface to Air Missile system! -
Natric - 05.01.2014
I appreciate that you have answered quickly here's my comment about your new code:
I have changed some bools and set them to normal and while compiling I didn't face any warning or an error it may be the problem that I changed the bools if so can you explain why you know I'm kinda new to this community.
Gentlefolk, I hope that you will keep releasing such things, I added this to a 1.2 years project and turned it into
dynamic, you should jump into my test server in one day (RP).
I hope that you will answer my question about bools pal and I will test the code when I come back home,
Natric Fenix.
Re: L_S-A-M : Lordz's Surface to Air Missile system! -
iZN - 05.01.2014
Nice work Lordz.
Re: L_S-A-M : Lordz's Surface to Air Missile system! -
donhu789 - 05.01.2014
so about this Include will is still no error ?
Re: L_S-A-M : Lordz's Surface to Air Missile system! -
Voxel - 05.01.2014
This is so cool, good job!!
Re: L_S-A-M : Lordz's Surface to Air Missile system! -
Lordzy - 05.01.2014
Thanks. :- )
Quote:
Originally Posted by donhu789
so about this Include will is still no error ?
|
It got no errors or no bugs reported till the moment. You can read the notes given on the main topic before adding, so as to make sure that you're doing everything right in case if you're using it.
Re: L_S-A-M : Lordz's Surface to Air Missile system! -
donhu789 - 05.01.2014
So Would It Fit In SATDM v9
Re: L_S-A-M : Lordz's Surface to Air Missile system! -
Lordzy - 17.08.2014
Quote:
Originally Posted by Fernado Samuel
Nice, I'm using this but is there a way to set texture on SAM launcher?
|
Yes, it's possible. You can use the function
GetSAMObjectID which would return the object ID and then use that on
SetObjectMaterial
Re: L_S-A-M : Lordz's Surface to Air Missile system! -
Dampyr - 25.08.2014
Awesome include,
it would be nice if the player could destroy these towers
Re: L_S-A-M : Lordz's Surface to Air Missile system! -
Lordzy - 26.08.2014
Quote:
Originally Posted by Dampyr
Awesome include,
it would be nice if the player could destroy these towers
|
It's possible. You can use
GetSAMObjectID to get the SAM launcher's object ID. Then under OnPlayerWeaponShot, check if the hittype is equal to HIT_TYPE_OBJECT and if hitid is equal to the object ID which was obtained from GetSAMObjectID. You can either directly destroy it or use custom health rates.
I wrote a tutorial similar to what you've asked for which can be used for all objects -
https://sampforum.blast.hk/showthread.php?tid=488317
Re: L_S-A-M : Lordz's Surface to Air Missile system! -
Dampyr - 26.08.2014
Thanks for support & help
- sorry for my bad english