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.
|