All pastes #865138 Raw Copy code Copy link Edit

Something

public unlisted text v1 · immutable
#865138 ·published 2008-01-19 22:41 UTC
rendered paste body
/* This script was made by WeeDarr thanks to the ideas of this thread:
http://forum.sa-mp.com/index.php?topic=37951.0
You are not permitted to change anything other that the four defines below
if you use this you must also add me in to your credits list. If you are found
taking credit for it I will simply delete the files so nobody can download, so
you ruin it for others...
Anyway i hope you have fun with the script, if you find any errors or bugs please
report them at the official topic on the sa-mp forums.  WeeDarr & thanks to denver?
for the PlayerToPoint function.
 
Last note, if you have teleport commands and you do not what the person to get
the minigun out of the minigun zone please remember to remove the minigun from the
player, i may add this in future versions, wait and see. I may also add support for multiple miniguns
*/
 
#include <a_samp>
new minigun1,minigun2,minigun3,minigun4,minigun5;
new timer;
new weapons[13][2];
new gunid[MAX_PLAYERS];
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
forward mini(playerid);
 
/* A Tip:
If saving minigun positions on foot set the Z cordinate 1 lower, e.g i got the cord 9.2578 change it
to 8.2578 and the minigun should be on the floor.
*/
 
// Minigun 1
#define GUN1         true
#define X1,Y1,Z1                1962.9644,1358.7168,8.2578
#define RX1,RY1,RZ1          0.0,0.0,359.1342
// Minigun 2
#define GUN2         true
#define X2,Y2,Z2                1962.8313,1330.7249,8.2501
#define RX2,RY2,RZ2          0.0,0.0,183.3760
// Minigun 3
#define GUN3            false
#define X3,Y3,Z3                0.0,0.0,0.0
#define RX3,RY3,RZ3          0.0,0.0,0.0
// Minigun 4
#define GUN4            false
#define X4,Y4,Z4                0.0,0.0,0.0
#define RX4,RY4,RZ4          0.0,0.0,0.0
// Minigun 5
#define GUN5         false
#define X5,Y5,Z5                0.0,0.0,0.0
#define RX5,RY5,RZ5          0.0,0.0,0.0
// Other defines
#define DISTANCE 3.0 // the distance for playertopoint
#define AMMO 500 // the amount of ammo for the minigun
 
// Do NOT change anything except the things marked with this: // you can change this line
 
#define FILTERSCRIPT
#if defined FILTERSCRIPT
 
public OnFilterScriptInit()
{
        print("\n--------------------------------------");
        print(" Minigun FS by WeeDarr [2008] LOADED");
        print("--------------------------------------\n");
        return 1;
}
 
public OnFilterScriptExit()
{
    print("\n--------------------------------------");
        print(" Minigun FS by WeeDarr [2008] UNLOADED");
        print("--------------------------------------\n");
        return 1;
}
 
#else
 
#endif
 
public OnGameModeInit()
{
        // Don't use these lines if it's a filterscript
        SetGameModeText("Blank Script");
    #if GUN1 == true
        minigun1 = CreateObject(2985,X1,Y1,Z1,RX1,RY1,RZ1);
        #endif
        #if GUN2 == true
        minigun2 = CreateObject(2985,X2,Y2,Z2,RX2,RY2,RZ2);
        #endif
        #if GUN3 == true
        minigun3 = CreateObject(2985,X3,Y3,Z3,RX3,RY3,RZ3);
        #endif
        #if GUN4 == true
        minigun4 = CreateObject(2985,X4,Y4,Z4,RX4,RY4,RZ4);
        #endif
        #if GUN5 == true
        minigun5 = CreateObject(2985,X5,Y5,Z5,RX5,RY5,RZ5);
        #endif
        return 1;
}
 
public OnPlayerCommandText(playerid, cmdtext[])
{
        if (strcmp("/usegun", cmdtext, true, 7) == 0) // you can change this line
        {
        if(PlayerToPoint(DISTANCE,playerid,X1,Y1,Z1))
                {
                DestroyObject(minigun1);
                timer = SetTimerEx("mini",500,1,"i",playerid);
                for (new i = 0; i < 13; i++)
                        {
                        GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
                        }
                ResetPlayerWeapons(playerid);
        GivePlayerWeapon(playerid,38,AMMO);
        gunid[playerid]=1;
                }
                
                else if(PlayerToPoint(DISTANCE,playerid,X2,Y2,Z2))
                {
                DestroyObject(minigun2);
                timer = SetTimerEx("mini",500,1,"i",playerid);
                for (new i = 0; i < 13; i++)
                        {
                        GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
                        }
                ResetPlayerWeapons(playerid);
        GivePlayerWeapon(playerid,38,AMMO);
        gunid[playerid]=2;
                }
                
                else if(PlayerToPoint(DISTANCE,playerid,X3,Y3,Z3))
                {
        DestroyObject(minigun3);
                timer = SetTimerEx("mini",500,1,"i",playerid);
                for (new i = 0; i < 13; i++)
                        {
                        GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
                        }
                ResetPlayerWeapons(playerid);
        GivePlayerWeapon(playerid,38,AMMO);
        gunid[playerid]=3;
                }
                
                else if(PlayerToPoint(DISTANCE,playerid,X4,Y4,Z4))
                {
        DestroyObject(minigun4);
                timer = SetTimerEx("mini",500,1,"i",playerid);
                for (new i = 0; i < 13; i++)
                        {
                        GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
                        }
                ResetPlayerWeapons(playerid);
        GivePlayerWeapon(playerid,38,AMMO);
        gunid[playerid]=4;
              }
                
                else if(PlayerToPoint(DISTANCE,playerid,X5,Y5,Z5))
                {
        DestroyObject(minigun5);
                timer = SetTimerEx("mini",500,1,"i",playerid);
                for (new i = 0; i < 13; i++)
                        {
                        GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
                        }
                ResetPlayerWeapons(playerid);
        GivePlayerWeapon(playerid,38,AMMO);
        gunid[playerid]=5;
                }
                return 1;
        }
        
        if (strcmp("/exitgun", cmdtext, true, 5) == 0) // you can change this line
        {
                if(gunid[playerid] == 0)
                {
                SendClientMessage(playerid,0xFFFFFFFF,"what gun?"); // you can change this message or delete it
                }
 
                else if(gunid[playerid] == 1)
                {
                KillTimer(timer);
                minigun1 = CreateObject(2985,X1,Y1,Z1,RX1,RY1,RZ1);
                ResetPlayerWeapons(playerid);
                gunid[playerid]=0;
        for (new i = 0; i < 13; i++)
                        {
            GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
                        }
                }
 
                else if(gunid[playerid] == 2)
                {
        KillTimer(timer);
                minigun2 = CreateObject(2985,X2,Y2,Z2,RX2,RY2,RZ2);
                ResetPlayerWeapons(playerid);
                gunid[playerid]=0;
        for (new i = 0; i < 13; i++)
                        {
            GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
                        }
                }
 
                else if(gunid[playerid] == 3)
                {
        KillTimer(timer);
                minigun3 = CreateObject(2985,X3,Y3,Z3,RX3,RY3,RZ3);
                ResetPlayerWeapons(playerid);
                gunid[playerid]=0;
        for (new i = 0; i < 13; i++)
                        {
            GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
                        }
                }
 
                else if(gunid[playerid] == 4)
                {
        KillTimer(timer);
                minigun4 = CreateObject(2985,X4,Y4,Z4,RX4,RY4,RZ4);
                ResetPlayerWeapons(playerid);
                gunid[playerid]=0;
        for (new i = 0; i < 13; i++)
                        {
            GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
                        }
                }
                
                else if(gunid[playerid] == 5)
                {
        KillTimer(timer);
                minigun5 = CreateObject(2985,X5,Y5,Z5,RX5,RY5,RZ5);
                ResetPlayerWeapons(playerid);
                gunid[playerid]=0;
        for (new i = 0; i < 13; i++)
                        {
            GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
                        }
                }
                return 1;
        }
        return 0;
}
        
public mini(playerid)
{
    if(gunid[playerid] == 1 && PlayerToPoint(DISTANCE,playerid,X1,Y1,Z1) == 0)
    {
    KillTimer(timer);
        minigun1 = CreateObject(2985,X1,Y1,Z1,RX1,RY1,RZ1);
        ResetPlayerWeapons(playerid);
        gunid[playerid]=0;
        for (new i = 0; i < 13; i++)
                {
                GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
                }
    }
    
    if(gunid[playerid] == 2 && PlayerToPoint(DISTANCE,playerid,X2,Y2,Z2) == 0)
    {
    KillTimer(timer);
        minigun2 = CreateObject(2985,X1,Y1,Z1,RX1,RY1,RZ1);
        ResetPlayerWeapons(playerid);
        gunid[playerid]=0;
        for (new i = 0; i < 13; i++)
                {
                GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
                }
    }
    
    else if(gunid[playerid] == 3 && PlayerToPoint(DISTANCE,playerid,X3,Y3,Z3) == 0)
    {
    KillTimer(timer);
        minigun3 = CreateObject(2985,X1,Y1,Z1,RX1,RY1,RZ1);
        ResetPlayerWeapons(playerid);
        gunid[playerid]=0;
        for (new i = 0; i < 13; i++)
                {
                GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
                }
    }
    
    else if(gunid[playerid] == 4 && PlayerToPoint(DISTANCE,playerid,X4,Y4,Z4) == 0)
    {
    KillTimer(timer);
        minigun4 = CreateObject(2985,X1,Y1,Z1,RX1,RY1,RZ1);
        ResetPlayerWeapons(playerid);
        gunid[playerid]=0;
        for (new i = 0; i < 13; i++)
                {
                GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
                }
    }
    
    else if(gunid[playerid] == 5 && PlayerToPoint(DISTANCE,playerid,X5,Y5,Z5) == 0)
    {
    KillTimer(timer);
        minigun5 = CreateObject(2985,X1,Y1,Z1,RX1,RY1,RZ1);
        ResetPlayerWeapons(playerid);
        gunid[playerid]=0;
        for (new i = 0; i < 13; i++)
                {
                GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
                }
    }
}
 
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
        {
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        tempposx = (oldposx -x);
        tempposy = (oldposy -y);
        tempposz = (oldposz -z);
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
                return 1;
        }
        return 0;
}