[FilterScript] Simple dynamite
#1

Hi.
In this script we can make dynamite exploding in 15 next seconds by one command - very simple.

Usage:
Type /dynamite and get outta there!

Include fixes is optional (needed to correctly animation at the first time)


Changelog:
  • Dynamite will explode after shot
  • Much bigger range of explosion
  • Code has been optimized
Version 2 (New)
pawn Код:
#include <a_samp>
#include <fixes>
#include <zcmd>

#define FILTERSCRIPT

new dynamite_Timer;

new dynamiteobject;
new Float:dx, Float:dy, Float:dz;

public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(hittype == BULLET_HIT_TYPE_OBJECT)
        if(hitid == dynamiteobject){
            KillTimer(dynamite_Timer);
            CreateExplosion(dx, dy, dz, 0, 15.0);
            CreateExplosion(dx, dy, dz, 1, 15.0);
            CreateExplosion(dx+3.5, dy+3.5, dz+3.5, 1, 15.0);
            CreateExplosion(dx-3.5, dy-3.5, dz, 1, 15.0);
            CreateExplosion(dx+3.5, dy-3.5, dz, 1, 15.0);
            CreateExplosion(dx-3.5, dy+3.5, dz, 1, 15.0);
            DestroyObject(dynamiteobject);
        }
    return 1;
}

CMD:dynamite(playerid, params[]){
    GetPointInAngleOfPlayer(playerid, Float:dx, Float:dy, Float:dz, 0.7, 0.0);
    dynamiteobject = CreateObject(1654, Float:dx, Float:dy, Float:dz-0.9414, 338.00000, -91.00000, -127.00000);
    dynamite_Timer = SetTimer("DynamiteTime", 15000, false);
    SendClientMessage(playerid, -1, "Dynamite will explode in 15 seconds!");
    ApplyAnimation(playerid,"BOMBER","BOM_Plant_2Idle",4.1,0,0,0,0,0,1);
    return 1;
}

forward DynamiteTime();
public DynamiteTime(){
    CreateExplosion(Float:dx, Float:dy, Float:dz, 0, 15.0);
    CreateExplosion(Float:dx, Float:dy, Float:dz, 1, 15.0);
    CreateExplosion(Float:dx+3.5, Float:dy+3.5, Float:dz+3.5, 1, 15.0);
    CreateExplosion(Float:dx-3.5, Float:dy-3.5, Float:dz, 1, 15.0);
    CreateExplosion(Float:dx+3.5, Float:dy-3.5, Float:dz, 1, 15.0);
    CreateExplosion(Float:dx-3.5, Float:dy+3.5, Float:dz, 1, 15.0);
    DestroyObject(dynamiteobject);
}

stock GetPointInAngleOfPlayer(playerid, &Float:x, &Float:y, &Float:z, Float:distance, Float:angle){
    new Float:current_angle;
    GetPlayerPos(playerid, x, y, z);

    GetPlayerFacingAngle(playerid, current_angle);

    if(IsPlayerInAnyVehicle(playerid))
    {
            GetVehicleZAngle(GetPlayerVehicleID(playerid), current_angle);
    }

    new Float:a = current_angle + angle;

    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}
Version 1
pawn Код:
#include <a_samp>
#include <fixes>
#include <zcmd>

CMD:dynamite(playerid, params[])
{
    new dynamite, Float:x, Float:y, Float:z;
    GetPointInAngleOfPlayer(playerid, x, y, z, 0.7, 0.0);
    dynamite = CreateObject(1654, x, y, z-0.9414, 338.00000, -91.00000, -127.00000);
    SetTimerEx("DynamiteTime", 15000, false, "ifff", dynamite, Float:x, Float:y, Float:z);
    SendClientMessage(playerid, -1, "Dynamite will explode in 15 seconds!");
    ApplyAnimation(playerid,"BOMBER","BOM_Plant_2Idle",4.1,0,0,0,0,0,1);
    return 1;
}

forward DynamiteTime(dynamite, Float:x, Float:y, Float:z);
public DynamiteTime(dynamite, Float:x, Float:y, Float:z)
{
    CreateExplosion(x, y, z, 0, 15.0);
    CreateExplosion(x, y, z, 1, 15.0);
    DestroyObject(dynamite);
}

stock GetPointInAngleOfPlayer(playerid, &Float:x, &Float:y, &Float:z, Float:distance, Float:angle)
{
    new Float:current_angle;
    GetPlayerPos(playerid, x, y, z);

    GetPlayerFacingAngle(playerid, current_angle);

    if( IsPlayerInAnyVehicle(playerid) )
    {
            GetVehicleZAngle(GetPlayerVehicleID(playerid), current_angle);
        }

    new Float:a = current_angle + angle;

    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}
Reply
#2

Good job.
Reply
#3

nice
Reply
#4

Added new version!
Check first post.
Reply
#5

Good Fs,+rep
Rep me back if you want
Reply
#6

Quote:
Originally Posted by Skully82
Посмотреть сообщение
Good Fs,+rep
Rep me back if you want
Wtf?! Why should he give you rep for this filterscript? What did you contribute?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)