Jump to content

Aruncarea grenadelor din vehicule


ARTIST

Recommended Posts

Descriere: FS-ul respectiv va adauga pe server o particica interesanta din GTA 4 si anume posibilitatea de a arunca grenade din vehicule.

[pawn]#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

new grenade,trangr[MAX_PLAYERS],Float:ox, Float:oy, Float:oz,timer1;

forward boom();

#endif

public OnFilterScriptExit() return KillTimer(timer1);

public OnPlayerConnect(playerid) return trangr[playerid] = 0;

public OnPlayerDisconnect(playerid, reason) return trangr[playerid] = 0;

public OnPlayerCommandText(playerid, cmdtext[])

{

    if (strcmp("/gr", cmdtext, true, 10) == 0)

    {

        if(trangr[playerid] == 0)

        {

            trangr[playerid] = 1;

            SendClientMessage(playerid, 0x00FF00FF, "Regimul grenadelor a fost activat!");

            ShowPlayerDialog(playerid, 2756, DIALOG_STYLE_MSGBOX, "Folosire", "{ff0000}Daca aveti o grenada, tastati Y (doar sa nu fie apasate alte taste)", "Inchide", "");

            return 1;

        }

        else if(trangr[playerid] == 1) return trangr[playerid] = 0,SendClientMessage(playerid, 0xFF0000FF, "Regimul grenadelor a fost dezactivat!");

    }

    return 0;

}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)

{

    if(newkeys == KEY_YES)

    {

        if(IsPlayerInAnyVehicle(playerid))

        {

            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)

            {

                if(trangr[playerid] == 1)

                {

                    new weapon,ammo;

                    GetPlayerWeaponData(playerid, 8, weapon, ammo);

                    if(weapon == 16)

                    {

                        if(ammo >= 1)

                        {

                            new Float:A, Float:x, Float:y, Float:z, veh = GetPlayerVehicleID(playerid);

                            GetVehicleZAngle(veh, A);

                            if(A>=0 && A<45)

                            {

                                GetPlayerPos(playerid, x, y, z);

                                grenade = CreateObject(342, x-1.4, y, z+0.8, 0, 90, 0, 0);

                                MoveObject(grenade, x-5.0, y, z-1.2, 7, 0, 0, 0);

                                SetPlayerAmmo(playerid, 16, ammo-1);

                            }

                            if(A>=45 && A<90)

                            {

                                GetPlayerPos(playerid, x, y, z);

                                grenade = CreateObject(342, x-1.4, y-1.4, z+0.8, 0, 90, 0, 0);

                                MoveObject(grenade, x-5.0, y-5.0, z-1.2, 7, 0, 0, 0);

                                SetPlayerAmmo(playerid, 16, ammo-1);

                            }

                            if(A>=90 && A<135)

                            {

                                GetPlayerPos(playerid, x, y, z);

                                grenade = CreateObject(342, x, y-1.4, z+0.8, 0, 90, 0, 0);

                                MoveObject(grenade, x, y-5.0, z-1.2, 7, 0, 0, 0);

                                SetPlayerAmmo(playerid, 16, ammo-1);

                            }

                            if(A>=135 && A<180)

                            {

                                GetPlayerPos(playerid, x, y, z);

                                grenade = CreateObject(342, x+1.4, y-1.4, z+0.8, 0, 90, 0, 0);

                                MoveObject(grenade, x+5.0, y-5.0, z-1.2, 7, 0, 0, 0);

                                SetPlayerAmmo(playerid, 16, ammo-1);

                            }

                            if(A>=180 && A<225)

                            {

                                GetPlayerPos(playerid, x, y, z);

                                grenade = CreateObject(342, x+1.4, y, z+0.8, 0, 90, 0, 0);

                                MoveObject(grenade, x+5.0, y, z-1.2, 7, 0, 0, 0);

                                SetPlayerAmmo(playerid, 16, ammo-1);

                            }

                            if(A>=225 && A<270)

                            {

                                GetPlayerPos(playerid, x, y, z);

                                grenade = CreateObject(342, x+1.4, y+1.4, z+0.8, 0, 90, 0, 0);

                                MoveObject(grenade, x+5.0, y+5.0, z-2, 7, 0, 0, 0);

                                SetPlayerAmmo(playerid, 16, ammo-1);

                            }

                            if(A>=270 && A<315)

                            {

                                GetPlayerPos(playerid, x, y, z);

                                grenade = CreateObject(342, x-1.4, y+1.4, z+0.8, 0, 90, 0, 0);

                                MoveObject(grenade, x-5.0, y+5.0, z-1.2, 7, 0, 0, 0);

                                SetPlayerAmmo(playerid, 16, ammo-1);

                            }

                            if(A>=315 && A<360)

                            {

                                GetPlayerPos(playerid, x, y, z);

                                grenade = CreateObject(342, x-1.4, y+1.4, z+0.8, 0, 90, 0, 0);

                                MoveObject(grenade, x-5.0, y+5.0, z-1.2, 7, 0, 0, 0);

                                SetPlayerAmmo(playerid, 16, ammo-1);

                            }

                            timer1 = SetTimer("boom", 4000, false);

                        }

                        if(ammo == 0) SendClientMessage(playerid, 0xFF0000FF, "Nu mai aveti grenade!");

                    }

                    else SendClientMessage(playerid, 0xFF0000FF, "Nu aveti grenade!");

                }

            }

        }

    }

    return 1;

}

public boom()

{

    GetObjectPos(grenade,ox,oy,oz),DestroyObject(grenade),CreateExplosion( ox,oy,oz, 2, 2.0);

    KillTimer(timer1);

} [/pawn]

Cu respect, ARTIST

ep41yhufqpagka5wfoornw1wjfjie.png

HTjr_G.png
12975.png
 
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.