[FilterScript] Predator
#1

This is my first predator missle release
its still buggy but it will be fixed in 1.0 and then it also will use mapandreas

controls:
/predator = gives you control over the missle placing
key left = let the missle go left
key right = let the missle go right
key up = let the missle go up
key down = let the missle go down
key fire = launch the missle

download is as attachment

edit: v1 is now live and uses map andreas
edit2: this code is the fixed version but will not be uploaded before it is tested
pawn Код:
//------------------------------
//Predator missle V1.0.01 by sansko
//------------------------------
#include <a_samp>
#include <mapandreas>
//------------------------------
new missle;
#define speed 15

forward movemissle(playerid);

public OnFilterScriptInit()
{
    MapAndreas_Init(MAP_ANDREAS_MODE_FULL);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/predator", cmdtext, true, 10) == 0)
    {
        new Float:a, Float:b, Float:c ;
        new Float:f ;
        GetPlayerPos(playerid, a, b, c);
        MapAndreas_FindZ_For2DCoord(a,b,f);
        missle = CreateObject(3786, a, b, f+50, 0, 270, 0, 100);
        SetPlayerCameraPos(playerid, a, b, f+60);
        SetPlayerCameraLookAt(playerid, a, b, f);
        SetPVarInt(playerid, "mc", 1);
        SetTimer("movemissle", 100, true);
        TogglePlayerControllable(playerid, 0);
        return 1;
    }
    if (strcmp("/camreset", cmdtext, true, 10) == 0)
    {
        SetCameraBehindPlayer(playerid);
        SetPVarInt(playerid, "mc", 0);
        TogglePlayerControllable(playerid, 1);
                KillTimer("movemissle");
        return 1;
    }
    return 0;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE)
    {
        if(GetPVarInt(playerid, "mc") == 1)
        {
        new Float:j, Float:k, Float:l;
        new Float:m, Float:n, Float:o;
                new Float:p;
        GetPlayerPos(playerid, j, k, l);
        GetObjectPos(missle, m, n, o);
        MapAndreas_FindZ_For2DCoord(m,n,p);
        MoveObject(missle, m, n, p, speed);
        SetCameraBehindPlayer(playerid);
        SetPVarInt(playerid, "mc", 0);
        TogglePlayerControllable(playerid, 1);
                KillTimer("movemissle");
        return 1;
        }
    }
    return 0;
}

public OnObjectMoved(objectid)
{
    if(objectid == missle)
    {
        new Float:p, Float:q, Float:r, Float:s;
        GetObjectPos(missle, p, q, r);
        MapAndreas_FindZ_For2DCoord(p,q,s);
        DestroyObject(missle);
        CreateExplosion(p, q, s, 7, 6.0);
        CreateExplosion(p, q, s, 7, 6.0);
        return 1;
    }
    return 0;
}

public movemissle(playerid)
{
    if(GetPVarInt(playerid, "mc") == 1)
    {
        new Float:g, Float:h, Float:i, Float:j;
        new keys, ud, lr;
        GetPlayerKeys(playerid, keys, ud, lr);
        GetObjectPos(missle, g, h, i);
        if(ud < 0)
        {
            MapAndreas_FindZ_For2DCoord(g, h, j);
            SetObjectPos(missle, g+1, h, j+50);
            SetPlayerCameraPos(playerid, g+1, h, j+60);
            SetPlayerCameraLookAt(playerid, g+1, h, j);
        }
        if(ud > 0)
        {
            MapAndreas_FindZ_For2DCoord(g, h, j);
            SetObjectPos(missle, g-1, h, j+50);
            SetPlayerCameraPos(playerid, g-1, h, j+60);
            SetPlayerCameraLookAt(playerid, g-1, h, j);
        }
        if(lr < 0)
        {
            MapAndreas_FindZ_For2DCoord(g, h, j);
            SetObjectPos(missle, g, h+1, j+50);
            SetPlayerCameraPos(playerid, g, h+1, j+60);
            SetPlayerCameraLookAt(playerid, g, h+1, j);
        }
        if(lr > 0)
        {
            MapAndreas_FindZ_For2DCoord(g, h, j);
            SetObjectPos(missle, g, h-1, j+50);
            SetPlayerCameraPos(playerid, g, h-1, j+60);
            SetPlayerCameraLookAt(playerid, g, h-1, j);
        }
    }
}
Reply


Messages In This Thread
Predator - by sansko - 25.12.2010, 16:08
Re: Predator - by sansko - 25.12.2010, 16:38
Re: Predator - by Matanel - 25.12.2010, 16:39
Re: Predator - by sansko - 25.12.2010, 16:47
Re: Predator - by Matanel - 25.12.2010, 16:57
Re: Predator - by Meinstad - 25.12.2010, 17:07
Re: Predator - by HyperZ - 25.12.2010, 17:27
Re: Predator - by sansko - 25.12.2010, 17:35
Re: Predator - by Meinstad - 25.12.2010, 17:36
Re: Predator - by sansko - 25.12.2010, 17:43
Re: Predator - by Meinstad - 25.12.2010, 19:44
Re: Predator - by sansko - 25.12.2010, 19:53
Re: Predator - by sansko - 26.12.2010, 18:35
Re: Predator - by sansko - 27.12.2010, 11:54
Re: Predator - by [BG]PREDATOR - 27.12.2010, 12:31
Re: Predator - by justsomeguy - 27.12.2010, 22:42
Re: Predator - by WillyP - 27.12.2010, 22:44
Re: Predator - by justsomeguy - 27.12.2010, 23:17
Re: Predator - by WillyP - 27.12.2010, 23:18
Re: Predator - by justsomeguy - 27.12.2010, 23:26
Re: Predator - by WillyP - 27.12.2010, 23:32
Re: Predator - by bomm89 - 28.12.2010, 03:17
Re: Predator - by bomm89 - 28.12.2010, 05:16
Re: Predator - by Larsey123IsMe - 28.12.2010, 06:28
Re: Predator - by sansko - 28.12.2010, 15:19
Re: Predator - by Lorenc_ - 28.12.2010, 21:27
Re: Predator - by sansko - 29.12.2010, 23:14
Re: Predator - by Mariooo - 30.12.2010, 09:43
Re: Predator - by sansko - 30.12.2010, 10:54
Re: Predator - by =PREDATOR= - 20.01.2011, 10:47
Re: Predator - by MicroD - 20.01.2011, 15:01
Re: Predator - by schillow - 20.01.2011, 18:12

Forum Jump:


Users browsing this thread: 1 Guest(s)