Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Releases Libraries [Library] Missile (Missile Launcher)

 
  • 0 Vote(s) - 0 Average
Library Missile (Missile Launcher)
AbyssMorgan
Offline

Burgershot Member
Posts: 63
Threads: 25
Joined: Apr 2021
Reputation: 8
Location: Poland
#1
2021-04-18, 01:03 PM
Hi I would like to present include for Missile Launcher.

Video:
- Sniper Missile
- Vehicle Missile (MapAndreas Version)
- Vehicle Missile (ColAndreas Update)
- Marica Mortar V1
- Heavy Marica Mortar
- Missile Launcher Aim Player
- Congreve Rocket
- Marica Mortar V2
- New Vehicle Missile
- Flares

Functions:
Code:
Missile::Launch(type,Float:detection_range,Float:explode_radius,Float:speed,Float:x,Float:y,Float:z,worldid,interiorid,playerid,Float:streamdistance,missile_object,Float:tx,Float:ty,Float:tz,byplayerid=INVALID_PLAYER_ID,teamid=ANY_TEAM,bool:remote=false,remote_count=MAX_MISSILE_REMOTE_TARGET,remote_height=1.0,Float:arc_roll=0.0,Float:damage=-1.0,Float:vehicle_damage=-1.0);

type - explosion type //https://wiki.sa-mp.com/wiki/Explosion_List
Float:detection_range - detection range player/vehicle
Float:explode_radius - the explosion range (the same as in CreateExplosion)
Float:speed - projectile speed
Float:x, Float:y, Float:z - Starting position
worldid, interiorid, playerid, Float:streamdistance - the same as in CreateDynamicObject
missile_object: MISSILE_OBJECT_NORMAL / MISSILE_OBJECT_BIG / MISSILE_OBJECT_HYDRA / MISSILE_OBJECT_BOMB / MISSILE_OBJECT_BOMB_STATIC / MISSILE_OBJECT_FLARE
Float:tx, Float:ty, Float:tz - Target position
byplayerid - selected player will be immune to detection range
teamid - player team will be immune to detection range
remote - enable remote targeting (for Vehicle Missile Mortar)
remote_count - number of remote targeting 1 - 32
remote_height - arc height
arc_roll - rotation Y axis
Float:damage - player damage on explosion created
Float:vehicle_damage - vehicle damage on explosion created

Rotation: Auto!

Missile::LaunchAimPlayer(targetid,type,Float:detection_range,Float:explode_radius,Float:speed,Float:x,Float:y,Float:z,worldid,interiorid,playerid,Float:streamdistance,missile_object,Float:tx,Float:ty,Float:tz,byplayerid=INVALID_PLAYER_ID,teamid=ANY_TEAM,Float:damage=-1.0,Float:vehicle_damage=-1.0);

Missile::StopAimPlayer(mobid);
Missile::Destroy(mobid,type,playerid);
Missile::RemoteTarget(mobid,Float:tx,Float:ty,Float:tz,Float:speed = 0.0);
Missile::GetExplodeVisibility();
Missile::SetExplodeVisibility(Float:explode_stream);
Missile::DisableAllAim(playerid);

Misile::GetObject(mobid);
Misile::GetArea(mobid);
Misile::GetType(mobid);
Misile::GetExplode(mobid);
Misile::GetPlayer(mobid);
Misile::GetTeamID(mobid);
Misile::GetVehicle(mobid);
Misile::GetRemoteCount(mobid);
Misile::GetRemoteID(mobid);
Misile::GetSpeed(mobid);
Misile::GetTargetID(mobid);
Misile::GetDamage(mobid);
Misile::GetVehicleDamage(mobid);

Callbacks:
Code:
OnMissileDestroy(mobid,Float:x,Float:y,Float:z,type,killerid,byplayerid);

types:
MISSILE_DESTROY_TYPE_TARGET  //When rocket reaches its destination (always killerid=INVALID_PLAYER_ID)
MISSILE_DESTROY_TYPE_DETECT  //When rocket has been destroyed by detection range
MISSILE_DESTROY_TYPE_KILL    //When rocket has been destroyed by player

OnMissileDetectPlayer(playerid,killerid); //called when a player is within range of detection range

OnMissileRequestLaunch(Float:x,Float:y,Float:z,playerid,targetid);

Example Code:
Code:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ){
if(weaponid == 34){
new Float:x, Float:y, Float:z,
Float:tx, Float:ty, Float:tz,
Float:rx, Float:rz,
vw, int, Float:dist;

GetPlayerPos(playerid,x,y,z);
GetRotationFor2Point3D(x,y,z,fX,fY,fZ,rx,rz);

dist = GetDistanceBetweenPoints3D(x,y,z,fX,fY,fZ);
vw = GetPlayerVirtualWorld(playerid);
int = GetPlayerInterior(playerid);

GetPointInFront3D(x,y,z,rx,rz,4.0,tx,ty,tz);
Missile::Launch(MISSILE_TYPE_EXPLODE_HUGE,4.0,25.0,35.0,tx,ty,tz,vw,int,-1,300.0,MISSILE_OBJECT_HYDRA,fX,fY,fZ,playerid,.damage=100.0,.vehicle_damage=1000.0);

GetPointInFront3D(x,y,z,rx,rz,3.0,tx,ty,tz);
Missile::Launch(MISSILE_TYPE_EXPLODE_HUGE,4.0,25.0,35.0,tx,ty,tz+3.0,vw,int,-1,300.0,MISSILE_OBJECT_HYDRA,fX,fY,fZ+3.0,playerid,.damage=100.0,.vehicle_damage=1000.0);
Missile::Launch(MISSILE_TYPE_EXPLODE_HUGE,4.0,25.0,35.0,tx,ty,tz-3.0,vw,int,-1,300.0,MISSILE_OBJECT_HYDRA,fX,fY,fZ-3.0,playerid,.damage=100.0,.vehicle_damage=1000.0);

GetPointInFront3D(tx,ty,tz,rx,rz+90.0,3.0,x,y,z);
GetPointInFront3D(x,y,z,rx,rz,dist,fX,fY,fZ);
Missile::Launch(MISSILE_TYPE_EXPLODE_HUGE,4.0,25.0,35.0,x,y,z,vw,int,-1,300.0,MISSILE_OBJECT_HYDRA,fX,fY,fZ,playerid,.damage=100.0,.vehicle_damage=1000.0);
GetPointInFront3D(tx,ty,tz,rx,rz-90.0,3.0,x,y,z);
GetPointInFront3D(x,y,z,rx,rz,dist,fX,fY,fZ);
Missile::Launch(MISSILE_TYPE_EXPLODE_HUGE,4.0,25.0,35.0,x,y,z,vw,int,-1,300.0,MISSILE_OBJECT_HYDRA,fX,fY,fZ,playerid,.damage=100.0,.vehicle_damage=1000.0);

}
return 1;
}

Bullet example:
Code:
Missile::Launch(MISSILE_TYPE_EXPLODE_NONE,1.0,1.0,20.0,Float:x,Float:y,Float:z,worldid,interiorid,playerid,Float:streamdistance,MISSILE_OBJECT_BULLET,Float:tx,Float:ty,Float:tz,byplayerid=INVALID_PLAYER_ID,teamid=ANY_TEAM,.damage=5.0,.vehicle_damage=25.0);

How to check is player kill by missile (this is not required if you using custom missile damage):
Code:
enums:
last_missile_shot
last_missile_player

public OnMissileDestroy(mobid,Float:x,Float:y,Float:z,type,killerid,byplayerid){
if(type == MISSILE_DESTROY_TYPE_DETECT && killerid != INVALID_PLAYER_ID){
PlayerInfo[killerid][last_missile_shot] = GetTickCount();
PlayerInfo[killerid][last_missile_player] = byplayerid;
}
return 1;
}

public OnMissileDetectPlayer(playerid,killerid){
if(killerid != INVALID_PLAYER_ID){
PlayerInfo[playerid][last_missile_shot] = GetTickCount();
PlayerInfo[playerid][last_missile_player] = killerid;
}
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason){
if(PlayerInfo[playerid][last_missile_player] != INVALID_PLAYER_ID && reason > 46 && playerid != killerid){
if(GetTickCount()-PlayerInfo[playerid][last_missile_shot] < 2000){
killerid = PlayerInfo[playerid][last_missile_player];
reason = 51;
}
}

//your code
return 1;
}

Download:
Missile.inc
3DTryg.inc
ColAndreas Plugin
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode