AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Infiniti ammo (https://forums.alliedmods.net/showthread.php?t=213948)

layka_LUBII 04-21-2013 07:54

Infiniti ammo
 
Hi,, plugin work to infinity ammo but me it all round..
I need to plugin to 15 sec
set_task (15.0,"event_CurWeapon",_,_,_,"b");

PLease help

Code:

public event_CurWeapon(id)
{
        if(ammo[id] == 0)
                return PLUGIN_CONTINUE;

        static wpnid, clip;
        wpnid = read_data(2);
        clip = read_data(3);
        give_ammo(id , wpnid , clip);

        return PLUGIN_CONTINUE;
}

public give_ammo(id , wpnid , clip)
{
        if(ammo[id] == 0)
                return;
        if(wpnid==CSW_C4 || wpnid==CSW_KNIFE || wpnid==CSW_HEGRENADE || wpnid==CSW_SMOKEGRENADE || wpnid==CSW_FLASHBANG)
                        return;

        if(!clip)
        {
                static weapname[33];
                get_weaponname(wpnid , weapname , 32);

                static wpn
                wpn = -1;
                while((wpn = find_ent_by_class(wpn , weapname)) != 0)
                {
                        if(id == entity_get_edict(wpn , EV_ENT_owner))
                        {
                                cs_set_weapon_ammo(wpn , maxclip(wpnid))
                                break;
                        }
                }
        }
}

stock maxclip(wpnid)
{
        static ca;
        ca = 0;

        switch (wpnid)
        {
                case CSW_P228 : ca = 13;
                case CSW_SCOUT : ca = 10;
                case CSW_HEGRENADE : ca = 0;
                case CSW_XM1014 : ca = 7;
                case CSW_C4 : ca = 0;
                case CSW_MAC10 : ca = 30;
                case CSW_AUG : ca = 30;
                case CSW_SMOKEGRENADE : ca = 0;
                case CSW_ELITE : ca = 15;
                case CSW_FIVESEVEN : ca = 20;
                case CSW_UMP45 : ca = 25;
                case CSW_SG550 : ca = 30;
                case CSW_GALI : ca = 35;
                case CSW_FAMAS : ca = 25;
                case CSW_USP : ca = 12;
                case CSW_GLOCK18 : ca = 20;
                case CSW_AWP : ca = 10;
                case CSW_MP5NAVY : ca = 30;
                case CSW_M249 : ca = 100;
                case CSW_M3 : ca = 8;
                case CSW_M4A1 : ca = 30;
                case CSW_TMP : ca = 30;
                case CSW_G3SG1 : ca = 20;
                case CSW_FLASHBANG : ca = 0;
                case CSW_DEAGLE : ca = 7;
                case CSW_SG552 : ca = 30;
                case CSW_AK47 : ca = 30;
                case CSW_P90 : ca = 50;
        }
        return ca;
}


fl0werD 04-21-2013 08:03

Re: Infiniti ammo
 
new MAXCLIP[] = { -1, 13, -1, 10, -1, 7, -1, 30, 30, -1, 30, 20, 25, 30, 35, 25, 12, 20, 10, 30, 100, 8, 30, 30, 20, -1, 7, 30, 30, -1, 50 }

layka_LUBII 04-21-2013 08:10

Re: Infiniti ammo
 
what ?

layka_LUBII 04-21-2013 08:32

Re: Infiniti ammo
 
please help me and do not write crap

Podarok 04-21-2013 08:36

Re: Infiniti ammo
 
[SLO] Layka_LUBII, sosi huj, tupaja psina, mudila i pidrila?
[ENG] I really cant get the idea what you want, could you give more description?

layka_LUBII 04-21-2013 08:58

Re: Infiniti ammo
 
I have a shop :D
In the shop have Infiniti Ammo
Infiniti Ammo cost 10 000
But Infiniti Ammo is on 1 round
I need to Infiniti Ammo to 15 sec to 1 round
Thank you

CAse SHOPu

Code:

case 6:
                {
                        if(get_user_flags(id) & ADMIN_LEVEL_H)
                        if(money >= costunlimitedammo)
                        {
                                ammo[id] = 1
                                cs_set_user_money(id, money - costunlimitedammo)
                                ChatColor(id, "!team[ Furien ] !yKupil si Nekonecnu municiu")
                                } else {
                                client_print(id, print_center, "Nemas dostatek penez")
                                client_cmd(0, "speak %s", Sound)
                                }
                                else
                                {
                                ChatColor(id, "!team[ Furien ] !yTato polozka je urcena vip hracom.")
                                }
                }

-----------------------------------
This is infiniti ammo

Code:

public event_CurWeapon(id)
{
        if(ammo[id] == 0)
                return PLUGIN_CONTINUE;

        static wpnid, clip;
        wpnid = read_data(2);
        clip = read_data(3);
        give_ammo(id , wpnid , clip);

        return PLUGIN_CONTINUE;
}

public give_ammo(id , wpnid , clip)
{
        if(ammo[id] == 0)
                return;
        if(wpnid==CSW_C4 || wpnid==CSW_KNIFE || wpnid==CSW_HEGRENADE || wpnid==CSW_SMOKEGRENADE || wpnid==CSW_FLASHBANG)
                        return;

        if(!clip)
        {
                static weapname[33];
                get_weaponname(wpnid , weapname , 32);

                static wpn
                wpn = -1;
                while((wpn = find_ent_by_class(wpn , weapname)) != 0)
                {
                        if(id == entity_get_edict(wpn , EV_ENT_owner))
                        {
                                cs_set_weapon_ammo(wpn , maxclip(wpnid))
                                break;
                        }
                }
        }
}

stock maxclip(wpnid)
{
        static ca;
        ca = 0;

        switch (wpnid)
        {
                case CSW_P228 : ca = 13;
                case CSW_SCOUT : ca = 10;
                case CSW_HEGRENADE : ca = 0;
                case CSW_XM1014 : ca = 7;
                case CSW_C4 : ca = 0;
                case CSW_MAC10 : ca = 30;
                case CSW_AUG : ca = 30;
                case CSW_SMOKEGRENADE : ca = 0;
                case CSW_ELITE : ca = 15;
                case CSW_FIVESEVEN : ca = 20;
                case CSW_UMP45 : ca = 25;
                case CSW_SG550 : ca = 30;
                case CSW_GALI : ca = 35;
                case CSW_FAMAS : ca = 25;
                case CSW_USP : ca = 12;
                case CSW_GLOCK18 : ca = 20;
                case CSW_AWP : ca = 10;
                case CSW_MP5NAVY : ca = 30;
                case CSW_M249 : ca = 100;
                case CSW_M3 : ca = 8;
                case CSW_M4A1 : ca = 30;
                case CSW_TMP : ca = 30;
                case CSW_G3SG1 : ca = 20;
                case CSW_FLASHBANG : ca = 0;
                case CSW_DEAGLE : ca = 7;
                case CSW_SG552 : ca = 30;
                case CSW_AK47 : ca = 30;
                case CSW_P90 : ca = 50;
        }
        return ca;
}


ConnorMcLeod 04-21-2013 10:14

Re: Infiniti ammo
 
Code:
/*  Formatright © 2009, ConnorMcLeod     Infinite BpAmmo is free software;     you can redistribute it and/or modify it under the terms of the     GNU General Public License as published by the Free Software Foundation.     This program is distributed in the hope that it will be useful,     but WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     GNU General Public License for more details.     You should have received a copy of the GNU General Public License     along with Infinite BpAmmo; if not, write to the     Free Software Foundation, Inc., 59 Temple Place - Suite 330,     Boston, MA 02111-1307, USA. */ #include <amxmodx> #include <fakemeta> #include <hamsandwich> #define VERSION "0.0.1" enum {     CurWeapon_IsActive = 1, // byte     CurWeapon_WeaponID, // byte     CurWeapon_ClipAmmo // byte } const XO_CBASEPLAYERWEAPON = 4 const m_iClip = 51 const m_iClientClip = 52 const m_pActiveItem = 373 new Float:g_flPlayerInfinitAmmoEndTime[33] new const g_iMaxClip[CSW_P90+1] = {     -1,  13, -1, 10,  1,  7,    1, 30, 30,  1,  30,         20, 25, 30, 35, 25,   12, 20, 10, 30, 100,         8 , 30, 30, 20,  2,    7, 30, 30, -1,  50 } public plugin_init() {     register_plugin("Infinite Ammo", VERSION, "ConnorMcLeod")     register_message(get_user_msgid("CurWeapon"), "Message_CurWeapon") } public Message_CurWeapon(iMsgId, iMsgDest, id) {     if( get_msg_arg_int(CurWeapon_IsActive) && g_flPlayerInfinitAmmoEndTime[id] >= get_gametime() )     {         new iMaxClip = g_iMaxClip[  get_msg_arg_int( CurWeapon_WeaponID )  ]         if( iMaxClip > 2 && get_msg_arg_int(CurWeapon_ClipAmmo) < iMaxClip )         {             new iWeapon = get_pdata_cbase(id, m_pActiveItem)             if( iWeapon > 0 )             {                 set_pdata_int(iWeapon, m_iClip, iMaxClip, XO_CBASEPLAYERWEAPON)                 set_pdata_int(iWeapon, m_iClientClip, iMaxClip, XO_CBASEPLAYERWEAPON)                 set_msg_arg_int(CurWeapon_ClipAmmo, ARG_BYTE, iMaxClip)             }         }     } } // add in menu selection : {     // just selected infinit ammo :     g_flPlayerInfinitAmmoEndTime[id] = get_gametime() + 15.0 }

layka_LUBII 04-21-2013 13:03

Re: Infiniti ammo
 
doesn´t work

Code:

enum
{
    CurWeapon_IsActive = 1, // byte
    CurWeapon_WeaponID, // byte
    CurWeapon_ClipAmmo // byte
}

const XO_CBASEPLAYERWEAPON = 4
const m_iClip = 51
const m_iClientClip = 52

const m_pActiveItem = 373

new Float:g_flPlayerInfinitAmmoEndTime[33]

new const g_iMaxClip[CSW_P90+1] = {
    -1,  13, -1, 10,  1,  7,    1, 30, 30,  1,  30,
        20, 25, 30, 35, 25,  12, 20, 10, 30, 100,
        8 , 30, 30, 20,  2,    7, 30, 30, -1,  50
}

Code:

register_message(get_user_msgid("CurWeapon"), "Message_CurWeapon")
Code:

public Message_CurWeapon(iMsgId, iMsgDest, id)
{
    if( get_msg_arg_int(CurWeapon_IsActive) && g_flPlayerInfinitAmmoEndTime[id] >= get_gametime())
    {
        new iMaxClip = g_iMaxClip[  get_msg_arg_int( CurWeapon_WeaponID )  ]
        if( iMaxClip > 2 && get_msg_arg_int(CurWeapon_ClipAmmo) < iMaxClip )
        {
            new iWeapon = get_pdata_cbase(id, m_pActiveItem)
            if( iWeapon > 0 )
            {
                set_pdata_int(iWeapon, m_iClip, iMaxClip, XO_CBASEPLAYERWEAPON)
                set_pdata_int(iWeapon, m_iClientClip, iMaxClip, XO_CBASEPLAYERWEAPON)

                set_msg_arg_int(CurWeapon_ClipAmmo, ARG_BYTE, iMaxClip)
            }
        }
    }
}

Code:

case 6:
                {
                        if(get_user_flags(id) & ADMIN_LEVEL_H)
                        if(money >= costunlimitedammo)
                        {                       
                                cs_set_user_money(id, money - costunlimitedammo)
                                g_flPlayerInfinitAmmoEndTime[id] = get_gametime() + 15.0
                                ChatColor(id, "!team[ Furien ] !yKupil si Nekonecnu municiu")
                                } else {
                                client_print(id, print_center, "Nemas dostatek penez")
                                client_cmd(0, "speak %s", Sound)
                                }
                                else
                                {
                                ChatColor(id, "!team[ Furien ] !yTato polozka je urcena vip hracom.")
                                }
                }

so it have and doesn´t work

Blizzard_87 04-21-2013 20:22

Re: Infiniti ammo
 
show your entire code so we can see where you have put this code.?
EDIT: conner knows his stuff so it should work..

Leon M. 04-22-2013 00:28

Re: Infiniti ammo
 
it works just fine but below part of your code looks shitty
PHP Code:

case 6:         {             if(get_user_flags(id) & ADMIN_LEVEL_H)             if(money >= costunlimitedammo)             {                                          cs_set_user_money(idmoney costunlimitedammo)                 g_flPlayerInfinitAmmoEndTime[id] = get_gametime() + 15.0                 ChatColor(id"!team[ Furien ] !yKupil si Nekonecnu municiu")                 } else {                 client_print(idprint_center"Nemas dostatek penez")                 client_cmd(0"speak %s"Sound)                      }                       else                       {                 ChatColor(id"!team[ Furien ] !yTato polozka je urcena vip hracom.")                      }         } 


EDIT: I'm too lazy to format your CODE, not too hard too use PHP.


All times are GMT -4. The time now is 10:53.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.