Raised This Month: $51 Target: $400
 12% 

Tec-9


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 05-27-2017 , 07:12   Tec-9
Reply With Quote #1

Hello,
i got this errors in console

HTML Code:
L 05/27/2017 - 13:09:32: [AMXX] Displaying debug trace (plugin "csgo_tec9.amxx", version "2.3")

L 05/27/2017 - 13:09:32: [AMXX] Run time error 10: native error (native "get_pcvar_num")

L 05/27/2017 - 13:09:32: [AMXX]    [0] csgo_tec9.sma::Event_New_Round (line 487)
Here is the code :
PHP Code:
/*

    ================================================

    Counter-Strike Weapons System Mod v1.3 [CSWS1]

    ================================================

    2017

    

    This source code falls under the GNU General Public License.

    (https://www.gnu.org/licenses/gpl-3.0.en.html)

    

    Additionally, you are allowed to modify, improve or build

    upon the code but under NO circumstances are you allowed to

    sell, trade, or receive any compensation for the source code

    whatsoever and should freely share said code to anyone,

    modified or otherwise.

    

    Description:

    ============

    The CSWS script is built upon the endeavor

    of adding an extra weapon that behaves like

    a real CS 1.6 weapon in every way while

    providing optimum performance. If you want

    to improve the code feel free to do so and

    share it with everyone.

    

    Credits:

    ========

    Sneaky.amxx    - original weapons code

    dias        - original weapons code

    MeRcyLeZZ    - price mechanic

    Arkshine    - HUD sprites replacement

    HamletEagle    - optimization

    edon1337    - optimization

*/



#include <amxmodx>

#include <cstrike>

#include <engine>

#include <fakemeta>

#include <fun>

#include <hamsandwich>

#include <xs>



#define DAMAGE 27

#define LONG_DAMAGE 19

#define CLIP 24

#define BPAMMO 120

#define RATEOFIRE 0.6

#define RECOIL 1.35

#define RELOAD_TIME 2.5

#define WALKSPEED 240.0

#define PRICE 500

#define ORIG_WPN_PRICE 800

#define BOT_BUY_CHANCE 2



#define BASEWPN_CLIP 20

#define BASEWPN_AMMO 100

#define AMMOID 7

#define ACOST 50

#define AUNITS 30



#define SHOOT_ANIM 3

#define DRAW_ANIM 2

#define RELOAD_ANIM 1

#define INSPECT_ANIM 6

#define BODY_NUM 0



#define WEAPON_SECRETCODE 205309



// MACROS

#define Get_BitVar(%1,%2) (%1 & (1 << (%2 & 31)))

#define Set_BitVar(%1,%2) %1 |= (1 << (%2 & 31))

#define UnSet_BitVar(%1,%2) %1 &= ~(1 << (%2 & 31))



new const P_MODEL[]     = "models/p_tec9.mdl";

new const 
W_MODEL[]     = "models/w_tec9.mdl";

new const 
V_MODEL[]     = "models/v_tec9.mdl";

new const 
V_MODEL_ALT[]    = "models/alt/v_tec9.mdl";



new const 
CSW_NEWPN CSW_FIVESEVEN;

new const 
weapon_newpn[] = "weapon_fiveseven";

new const 
WEAPON_EVENT[] = "events/fiveseven.sc";

new const 
BASE_W_MODEL[] = "models/w_fiveseven.mdl";

new const 
FIRE_SOUND[] = "weapons/tec9-1.wav";



new const 
NEW_WPN_NAME[] = "weapon_tec9";

new const 
PRI_AMMO_ID     7;

new const 
SLOT_ID     1;

new const 
NUM_IN_SLOT     6;

new const 
ITEM_FLAGS     0;



new const 
newpn_shortname[]     = "tec9";

new const 
basewpn_shortname[]     = "fiveseven";

new const 
basewpn_buynames[][]     = {"fiveseven""fn57"}



new const 
weapon_classnames[][] =

{

    
"weapon_usp",

    
"weapon_glock18",

    
"weapon_deagle",

    
"weapon_p228",

    
"weapon_fiveseven",

    
"weapon_elite"

}



new const 
weapon_sprites[][] =

{

    
"sprites/weapon_tec9.txt",

    
"sprites/640csws02.spr",

    
"sprites/640csws02_s.spr"

}



const 
m_flNextPrimaryAttack  46;

const 
m_pPlayer 41;

const 
m_pActiveItem 373;



// Weapon bitsums

const WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE);



new 
g_hambotg_has_weapong_weapon_eventg_buytime_expireg_rebuy[32], g_newrnd_bypass;

new 
Float:g_recoil[33][3], g_clip[33], g_prev_weapon[33], g_restart_roundshell_modelsmoke_sprite;

new 
cvar_bot_allow_wpnscvar_freezetimecvar_buytimecvar_decals;

new 
msg_CurWeaponmsg_Moneymsg_BlinkAcctmsg_WeaponListcvar_alteam;



new 
TASKID_BUYTIME 100000;



public 
plugin_init()

{

    
register_plugin("CS:GO Tec-9""2.3""Sneaky.amxx, dias, MeRcyLeZZ, Arkshine, hellmonja");

    

    
register_event("TextMsg""Game_Commencing""a""2=#Game_Commencing""2=#Game_will_restart_in");

    
register_event("HLTV""Event_New_Round""a""1=0""2=0");

    
register_event("CurWeapon""Event_CurWeapon""be""1=1");

    
register_message(get_user_msgid("DeathMsg"), "Message_DeathMsg");

    

    
register_forward(FM_UpdateClientData"Fw_UpdateClientData_Post"1);

    
register_forward(FM_PlaybackEvent"Fw_PlaybackEvent");

    
register_forward(FM_SetModel"Fw_SetModel");

    

    
RegisterHam(Ham_Item_Deployweapon_newpn"Fw_ItemDeployPost"1);

    
RegisterHam(Ham_AddPlayerItem"player""Fw_AddItem");

    
RegisterHam(Ham_RemovePlayerItem"player""Fw_RemoveItem");

    
RegisterHam(Ham_TraceAttack"worldspawn""Fw_TraceAttack_World");

    
RegisterHam(Ham_TraceAttack"player""Fw_TraceAttack_Player");

    
RegisterHam(Ham_Weapon_PrimaryAttackweapon_newpn"Fw_Weapon_PrimaryAttack");

    
RegisterHam(Ham_Weapon_PrimaryAttackweapon_newpn"Fw_Weapon_PrimaryAttack_Post"1);

    
RegisterHam(Ham_Item_AddToPlayerweapon_newpn"Fw_Item_AddToPlayer_Post"1);

    
RegisterHam(Ham_Item_PostFrameweapon_newpn"Fw_Item_PostFrame");

    
RegisterHam(Ham_Weapon_Reloadweapon_newpn"Fw_Weapon_Reload");

    
RegisterHam(Ham_Weapon_Reloadweapon_newpn"Fw_Weapon_Reload_Post"1);

    
RegisterHam(Ham_CS_Item_GetMaxSpeedweapon_newpn"Player_Weapon_Walkspeed");

    
RegisterHam(Ham_Touch"weapon_shield""Ham_Block_Sheild_Pickup");

    
RegisterHam(Ham_Killed"player""Player_Death");

    

    
msg_WeaponList get_user_msgid("WeaponList");  

    
msg_CurWeapon get_user_msgid("CurWeapon");

    
msg_Money get_user_msgid("Money");

    
msg_BlinkAcct get_user_msgid("BlinkAcct");

    

    new 
clcmd[24]; formatex(clcmd25"say %s"newpn_shortname);

    for(new 
0sizeof basewpn_buynames 1i++)

        
register_clcmd(basewpn_buynames[i], "ClientCommand_BuyBaseWpn");

    

    
register_clcmd(clcmd"Get_Weapon");

    
register_clcmd(NEW_WPN_NAME"ClientCommand_SelectWeapon");

    
register_clcmd("buyammo2""ClientCommand_BuyAmmo");

    
register_clcmd("secammo""ClientCommand_BuySecAmmo");

    
register_clcmd("shield""ClientCommand_BuyShield");

    
register_concmd("repurchase""ClientCommand_RePurchase");

    
register_concmd("inspect""Inspect_Weapon");

    
register_concmd(newpn_shortname"Get_Weapon");    

    
register_clcmd("say /tec9""Get_Weapon")

    

    
//CVARS

    
cvar_freezetime get_cvar_pointer("mp_freezetime");

    
cvar_buytime get_cvar_pointer("mp_buytime");

    
cvar_bot_allow_wpns get_cvar_pointer("bot_allow_pistols");

    
cvar_alteam register_cvar("armsw_team""0");

    
cvar_decals register_cvar("csws_decals""0");

}



public 
plugin_precache()

{

    for(new 
1sizeof weapon_spritesi++)

        
precache_generic(weapon_sprites[i]);

    

    
precache_model(P_MODEL);

    
precache_model(W_MODEL);

    
precache_model(V_MODEL);

    
precache_model(V_MODEL_ALT);

    
precache_sound(FIRE_SOUND);

    

    
smoke_sprite engfunc(EngFunc_PrecacheModel"sprites/gunsmoke.spr");

    
shell_model engfunc(EngFunc_PrecacheModel"models/pshell.mdl")

    

    
register_forward(FM_PrecacheEvent"Fw_PrecacheEvent_Post"1);

}



public 
Fw_PrecacheEvent_Post(type, const name[])

{

    if(
equal(WEAPON_EVENTname))

        
g_weapon_event get_orig_retval();

}



public 
client_putinserver(id)

{

    if(!
g_hambot && is_user_bot(id))

    {

        
g_hambot 1

        set_task
(0.1"Do_RegisterHam"id)

    }

}



public 
Do_RegisterHam(id)

{

    
RegisterHamFromEntity(Ham_TraceAttackid"Fw_TraceAttack_Player");

    
RegisterHamFromEntity(Ham_AddPlayerItemid"Fw_AddItem"1);

    
RegisterHamFromEntity(Ham_RemovePlayerItemid"Fw_RemoveItem"1);

    
RegisterHamFromEntity(Ham_Killedid"Player_Death");

}



public 
Game_Commencing()

{

    
g_restart_round 1;

}



public 
Event_New_Round()

{

    new 
freezetime get_pcvar_num(cvar_freezetime);

    new 
buytime floatround((get_pcvar_float(cvar_buytime) * 60));

    new 
Float:t;

    

    
g_buytime_expire 0;

    
g_newrnd_bypass 0;

    

    if(
g_restart_round)

    {

        
Remove_Weapons(01);

        
g_restart_round 0;

    }

    

    
set_task(0.1"Bypass_NewRound_Items");

    
remove_task(TASKID_BUYTIME);

    

    if(
get_pcvar_num(cvar_bot_allow_wpns) && g_buytime_expire == 0)

        
set_task(1.5"Bot_Weapon");

    

    if(
buytime freezetime)

        
float(buytime);

    else

        
float(buytime+freezetime);

    

    
set_task(t"Buytime_Expired"TASKID_BUYTIME);

}



public 
Buytime_Expired()

{

    
g_buytime_expire 1;

}



public 
Bot_Weapon()

{

    new 
players[32], pnum;

    
get_players(playerspnum"ade""TERRORIST");

    

    for(new 
0pnumi++)

        if(
random_num(0,100) <= BOT_BUY_CHANCE && get_user_armor(players[i]) != 99)

        {    

            
Get_Weapon(players[i]);

            
cs_set_user_armor(players[i], 99CS_ARMOR_VESTHELM);

        }

}



public 
ClientCommand_BuyBaseWpn(id)

{

    if(
purchase_check(idORIG_WPN_PRICE) && Get_BitVar(g_has_weaponid))

    {

        
drop_weapons(id);

        
UnSet_BitVar(g_has_weapon,id);

        
g_rebuy[id] = 0;

    }

}



public 
ClientCommand_RePurchase(id)

{

    
client_cmd(id"rebuy");

        

    if(
g_rebuy[id] == && !Get_BitVar(g_has_weaponid))

        
Get_Weapon(id);

}



public 
ClientCommand_BuyAmmo(id)

{

    if(!
is_user_alive(id))

        return 
PLUGIN_HANDLED

        

    
if(!cs_get_user_buyzone(id))

        return 
PLUGIN_HANDLED

    

    
if(!Get_BitVar(g_has_weaponid))

        return 
PLUGIN_CONTINUE

    

    
new wpns[32], wnum;

    
get_user_weapons(idwpnswnum);



    for (new 
iwnumi++)

        if(
wpns[i] == CSW_NEWPN)

        {

            new 
i_bpammo cs_get_user_bpammo(idCSW_NEWPN);

        

            if(
i_bpammo >= BPAMMO)

                return 
PLUGIN_HANDLED

            

            
if(i_bpammo BPAMMO)

                if(
i_bpammo BPAMMO-AUNITS)

                {

                    new 
i_ammo BPAMMO i_bpammo;

                    
give_ammo(idi_ammoAMMOIDACOST);

                }

                else

                    
give_ammo(idAUNITSAMMOIDACOST);

                

            return 
PLUGIN_HANDLED

        
}

    

    return 
PLUGIN_CONTINUE

}



public 
ClientCommand_BuySecAmmo(id)

{

    if(!
is_user_alive(id))

        return 
PLUGIN_HANDLED

        

    
if(!cs_get_user_buyzone(id))

        return 
PLUGIN_HANDLED

    

    
if(!Get_BitVar(g_has_weaponid))

        return 
PLUGIN_CONTINUE

    

    
new i_bpammo cs_get_user_bpammo(idCSW_NEWPN);

    

    if(
i_bpammo BPAMMO)

    {

        new 
i_ammo BPAMMO i_bpammo;

        
give_ammo(idi_ammoAMMOIDACOST);

    }

    

    return 
PLUGIN_HANDLED

}



public 
ClientCommand_BuyShield(id)

{

    if(!
is_user_alive(id))

        return 
PLUGIN_HANDLED

        

    
if(!cs_get_user_buyzone(id))

        return 
PLUGIN_HANDLED

    

    
if(!purchase_check(id2200))

        return 
PLUGIN_HANDLED

    

    
if(Get_BitVar(g_has_weaponid))

        
drop_weapons(id);

    

    return 
PLUGIN_CONTINUE

}



public 
Get_Weapon(id)

{

    if(!
is_user_alive(id) || !is_user_connected(id))

        return



    
// Player tries to buy the same gun

    
if(Get_BitVar(g_has_weaponid))

    {

        
client_print(idprint_center"#Cstrike_Already_Own_Weapon");

        return

    }    



    if(
purchase_check(idPRICE))

    {

        if(
cs_get_user_shield(id))

        {

            
engclient_cmd(id"slot1");

            
engclient_cmd(id"drop");

        }



        
drop_weapons(id);        

        
Set_BitVar(g_has_weaponid);

        
g_rebuy[id] = 1;

        new 
weapon give_item(idweapon_newpn);

        

        
// Set Ammo

        
cs_set_weapon_ammo(weaponCLIP);

        
cs_set_user_bpammo(idCSW_NEWPNBPAMMO);

    

        
// Calculate new money amount

        
static newmoney;

        
newmoney cs_get_user_money(id) - PRICE;

    

        
// Update money offset

        
cs_set_user_money(idnewmoney);

    

        
// Update money on HUD

        
message_begin(MSG_ONEmsg_Money_id);

        
write_long(newmoney);     // amount

        
write_byte(1);         // flash

        
message_end();

        

        if(
is_weapon_slot_empty(id1weapon))

            return

        

        
//Set Model and Animation

        
arm_switch(id);

        

        
engfunc(EngFunc_MessageBeginMSG_ONE_UNRELIABLEmsg_CurWeapon, {000}, id)

        
write_byte(1)

        
write_byte(CSW_NEWPN)

        
write_byte(CLIP)

        
message_end()

    }

}



public 
ClientCommand_SelectWeapon(id)

{  

    
engclient_cmd(idweapon_newpn);

    return 
PLUGIN_HANDLED





public 
Event_CurWeapon(id)

{

    if(!
is_user_alive(id))

        return

    

    static 
CSW_IDCSW_ID read_data(2);



    if((
CSW_ID == CSW_NEWPN && g_prev_weapon[id] == CSW_NEWPN) && Get_BitVar(g_has_weaponid))

    {

        static 
weapon;

        
weaponfind_ent_by_owner(-1weapon_newpnid);

        

        if(!
pev_valid(weapon))

        {

            
g_prev_weapon[id] = get_user_weapon(id)

            return

        }

        
set_pdata_float(weaponm_flNextPrimaryAttackget_pdata_float(weaponm_flNextPrimaryAttack4) * RATEOFIRE4)

    }

    else if((
CSW_ID != CSW_NEWPN && g_prev_weapon[id] == CSW_NEWPN) && Get_BitVar(g_has_weaponid))

        
draw_new_weapon(idget_user_weapon(id));

        

    
g_prev_weapon[id] = get_user_weapon(id);

}



public 
Fw_ItemDeployPost(weapon)

{

    static 
id;

    
id get_pdata_cbase(weaponm_pPlayer4);

    

    if(!
is_user_alive(id))

        return

        

    if(
Get_BitVar(g_has_weaponid))

    {

        
arm_switch(id);

    

        if(
cs_get_user_shield(id))

        {

            
engclient_cmd(id"slot1");

            
engclient_cmd(id"drop");

        }

    }

        

}



public 
Fw_AddItem(idweapon)

{

    static 
classname[24];

    
pev(weaponpev_classnameclassnamecharsmax(classname));

    

    if(!
Get_BitVar(g_has_weapon,id) && g_rebuy[id] == 1)

    {

        for(new 
0sizeof weapon_classnamesi++)

            if(
equali(classnameweapon_classnames[i]) && g_newrnd_bypass == 1)

            {

                
g_rebuy[id] = 0;

                return

            }

    }

    else if(
equali(classnameweapon_newpn) && Get_BitVar(g_has_weapon,id))

        
g_rebuy[id] = 1;

}



public 
Fw_RemoveItem(id)

{

    
set_task(0.01"Fw_AddItem"id);

}



public 
Ham_Block_Sheild_Pickup(entid)

{

    if(!
is_user_connected(id) || !is_user_alive(id))

        return 
HAM_IGNORED

 

    
if(Get_BitVar(g_has_weaponid))

        return 
HAM_SUPERCEDE



    
return HAM_IGNORED

}



public 
Fw_UpdateClientData_Post(idsendweaponscd_handle)

{

    if(!
is_user_alive(id))

        return 
FMRES_IGNORED



    
if(get_user_weapon(id) == CSW_NEWPN && Get_BitVar(g_has_weaponid))

        
set_cd(cd_handleCD_flNextAttackget_gametime() + 0.001

    

    return 
FMRES_HANDLED

}



public 
Fw_PlaybackEvent(flagsinvokereventidFloat:delayFloat:origin[3], Float:angles[3], Float:fparam1Float:fparam2iParam1iParam2bParam1bParam2)

{

    if (!
is_user_connected(invoker))

        return 
FMRES_IGNORED

        

    
if(get_user_weapon(invoker) != CSW_NEWPN || !Get_BitVar(g_has_weaponinvoker))

        return 
FMRES_IGNORED

        

    
if(eventid != g_weapon_event)

        return 
FMRES_IGNORED

    

    engfunc
(EngFunc_PlaybackEventflags FEV_HOSTONLYinvokereventiddelayoriginanglesfparam1fparam2iParam1iParam2bParam1bParam2);

    
set_weapon_anim(invokerSHOOT_ANIM);

    
emit_sound(invokerCHAN_WEAPONFIRE_SOUNDVOL_NORMATTN_NORM0PITCH_NORM);

    
make_shell(invoker);

    

    return 
FMRES_SUPERCEDE

}



public 
Fw_SetModel(wpn_entmodel[])

{

    if(!
pev_valid(wpn_ent))

        return 
FMRES_IGNORED

    

    
static classname[32];

    
pev(wpn_entpev_classnameclassnamesizeof classname);

    

    if(!
equal(classname"weaponbox"))

        return 
FMRES_IGNORED

    

    
static id;

    
idpev(wpn_entpev_owner);

    

    if(
equal(modelBASE_W_MODEL))

    {

        static 
weapon;

        
weapon find_ent_by_owner(-1weapon_newpnwpn_ent);



        if(!
pev_valid(weapon))

            return 
FMRES_IGNORED;

        

        if(
Get_BitVar(g_has_weaponid))

        {

            
UnSet_BitVar(g_has_weapon,id)

            

            
set_pev(weaponpev_impulseWEAPON_SECRETCODE)

            
engfunc(EngFunc_SetModelwpn_entW_MODEL)

            
set_pev(wpn_entpev_bodyBODY_NUM)

            

            return 
FMRES_SUPERCEDE

        
}

    }



    return 
FMRES_IGNORED;

}



public 
Fw_TraceAttack_World(victimattackerFloat:damageFloat:direction[3], prtdamage_bits)

{

    if(!
is_user_connected(attacker))

        return 
HAM_IGNORED

        

    
if(get_user_weapon(attacker) != CSW_NEWPN || !Get_BitVar(g_has_weaponattacker))

        return 
HAM_IGNORED

        

    
static Float:flEnd[3], Float:vecPlane[3];

    

    
get_tr2(prtTR_vecEndPosflEnd);

    
get_tr2(prtTR_vecPlaneNormalvecPlane);        

        

    
make_bullet_hole(attackerflEnddamage);

    
make_bullet_smoke(attackerprt);



    
SetHamParamFloat(3float(DAMAGE));

    

    return 
HAM_IGNORED

}



public 
Fw_TraceAttack_Player(victimattackerFloat:damageFloat:direction[3], ptrdamage_bits)

{

    if(!
is_user_connected(attacker))

        return 
HAM_IGNORED

        

    
if(get_user_weapon(attacker) != CSW_NEWPN || !Get_BitVar(g_has_weaponattacker))

        return 
HAM_IGNORED

    

    
new dist floatround(entity_range(attackervictim));

    

    if(
dist >= 900)

        
SetHamParamFloat(3float(LONG_DAMAGE));

    else

        
SetHamParamFloat (3float(DAMAGE));



    return 
HAM_IGNORED

}



public 
Fw_Weapon_PrimaryAttack(weapon)

{

    static 
id;

    
id pev(weaponpev_owner);

    
pev(idpev_punchangleg_recoil[id]);

    

    return 
HAM_IGNORED

}



public 
Fw_Weapon_PrimaryAttack_Post(weapon)

{

    static 
id;

    
id pev(weaponpev_owner);

    

    if(
Get_BitVar(g_has_weaponid))

    {

        static 
Float:Push[3]

        
pev(idpev_punchanglePush);

        
xs_vec_sub(Pushg_recoil[id], Push);

        

        
xs_vec_mul_scalar(PushRECOILPush);

        
xs_vec_add(Pushg_recoil[id], Push);

        
set_pev(idpev_punchanglePush);

    }

}



public 
Fw_Item_AddToPlayer_Post(weaponid)

{

    if(!
pev_valid(weapon))

        return 
HAM_IGNORED

        

    
if(pev(weaponpev_impulse) == WEAPON_SECRETCODE)

    {

        
Set_BitVar(g_has_weaponid);

        
set_pev(weaponpev_impulse0);

        
g_rebuy[id] = 1;

    }



    if(
Get_BitVar(g_has_weapon,id))

    {

        
message_begin(MSG_ONEmsg_WeaponList, .player id);

        
write_string(NEW_WPN_NAME);     // WeaponName  

        
write_byte(PRI_AMMO_ID);    // PrimaryAmmoID

        
write_byte(BPAMMO);        // PrimaryAmmoMaxAmount  

        
write_byte(-1);            // SecondaryAmmoID  

        
write_byte(-1);            // SecondaryAmmoMaxAmount  

        
write_byte(SLOT_ID);        // SlotID (0...N)  

        
write_byte(NUM_IN_SLOT);    // NumberInSlot (1...N)  

        
write_byte(CSW_NEWPN);      // WeaponID  

        
write_byte(ITEM_FLAGS);        // Flags  

        
message_end();

    } else {

        
message_begin(MSG_ONEmsg_WeaponList, .player id);

        
write_string(weapon_newpn);     // WeaponName  

        
write_byte(PRI_AMMO_ID);    // PrimaryAmmoID

        
write_byte(BPAMMO);        // PrimaryAmmoMaxAmount  

        
write_byte(-1);            // SecondaryAmmoID  

        
write_byte(-1);            // SecondaryAmmoMaxAmount  

        
write_byte(SLOT_ID);        // SlotID (0...N)  

        
write_byte(NUM_IN_SLOT);    // NumberInSlot (1...N)  

        
write_byte(CSW_NEWPN);    // WeaponID  

        
write_byte(ITEM_FLAGS);        // Flags  

        
message_end();

    }

    

    return 
HAM_HANDLED    

}



public 
Fw_Item_PostFrame(weapon)

{

    if(!
pev_valid(weapon))

        return 
HAM_IGNORED

    

    
static id

    id 
pev(weaponpev_owner)

    

    if(
is_user_alive(id) && Get_BitVar(g_has_weaponid))

    {    

        static 
Float:flNextAttackflNextAttack get_pdata_float(id835);

        static 
bpammobpammo cs_get_user_bpammo(idCSW_NEWPN);

        static 
i_clipi_clip get_pdata_int(weapon514);

        static 
fInReloadfInReload get_pdata_int(weapon544);

        

        if(
fInReload && flNextAttack <= 0.0)

        {

            static 
temp1temp1 min(CLIP i_clipbpammo);



            
set_pdata_int(weapon51i_clip temp14);

            
cs_set_user_bpammo(idCSW_NEWPNbpammo temp1);

            

            
set_pdata_int(weapon5404);

            

            
fInReload 0

        
}        

    }

    

    return 
HAM_IGNORED    

}



public 
Fw_Weapon_Reload(weapon)

{

    static 
idid pev(weaponpev_owner);

    

    if(!
is_user_alive(id))

        return 
HAM_IGNORED

        

    
if(!Get_BitVar(g_has_weaponid))

        return 
HAM_IGNORED

    

    g_clip
[id] = -1;

    

    static 
bpammobpammo cs_get_user_bpammo(idCSW_NEWPN);

    static 
i_clipi_clip get_pdata_int(weapon514);

    

    if(
bpammo <= 0)

        return 
HAM_SUPERCEDE

    

    
if(i_clip >= CLIP)

        return 
HAM_SUPERCEDE        

        

    g_clip
[id] = i_clip;



    return 
HAM_HANDLED

}



public 
Fw_Weapon_Reload_Post(weapon)

{

    static 
id;

    
id pev(weaponpev_owner);

    

    if(!
is_user_alive(id))

        return 
HAM_IGNORED

    

    
if(!Get_BitVar(g_has_weaponid))

        return 
HAM_IGNORED



    
if (g_clip[id] == -1)

        return 
HAM_IGNORED

    

    set_pdata_int
(weapon51g_clip[id], 4);

    
set_pdata_int(weapon5414);

    

    
set_weapon_anim(idRELOAD_ANIM);

    
set_pdata_float(id83RELOAD_TIME5);



    return 
HAM_HANDLED

}



public 
Message_DeathMsg(msg_idmsg_destid)

{

    static 
attackerweapon[24];

    

    
attacker read_data(1);

    
read_data(4weapon23);



    if(!
is_user_connected(attacker))

        return 
PLUGIN_CONTINUE

        

    
if(equali(weaponbasewpn_shortname) && Get_BitVar(g_has_weaponattacker))

        
set_msg_arg_string(4newpn_shortname);

    

    return 
PLUGIN_CONTINUE

}



public 
Player_Death(id)

{

    if(!
is_user_connected(id))

        return 
HAM_IGNORED

    

    
if(Get_BitVar(g_has_weaponid))

    {

        
set_task(0.1"Remove_Weapons"id);

        
g_rebuy[id] = 1;

    }

    

    return 
HAM_HANDLED

}



public 
Player_Weapon_Walkspeed(weapon)

{

    new 
id get_pdata_cbase(weaponm_pPlayer4);

    

    if(!
is_user_alive(id))

        return 
HAM_IGNORED

    

    
if(Get_BitVar(g_has_weapon,id))

        
SetHamReturnFloat(WALKSPEED);

    else

        return 
HAM_IGNORED



    
return HAM_SUPERCEDE

}



public 
Inspect_Weapon(id)

{

    new 
wpn_id get_user_weapon(id);

    

    if(
wpn_id == CSW_NEWPN && Get_BitVar(g_has_weaponid))

        
set_weapon_anim(idINSPECT_ANIM);

}



public 
Remove_Weapons(idall)

{

    switch(
all)

    {

        case 
1:

        {

            new 
players[32], pnum;

            
get_players(playerspnum"a");

    

            for(new 
0<= pnumi++)

                
UnSet_BitVar(g_has_weaponplayers[i]);

        }

        default:

            
UnSet_BitVar(g_has_weaponid);

    }

}



public 
Bypass_NewRound_Items()

{

    
g_newrnd_bypass 1;

}



purchase_check(idcost)

{

    if (!
cs_get_user_buyzone(id))

        return 
false

    

    
// Check for buy time

    
if(g_buytime_expire == 1)

    {

        
client_print(idprint_center"%d seconds have passed.^n You can't buy anything now!",floatround(get_cvar_float("mp_buytime") * 60));

        return 
false

    
}

    

    
// Check if player has enough money

    
if (cs_get_user_money(id) < cost)

    {

        
client_print(idprint_center"#Cstrike_TitlesTXT_Not_Enough_Money");

        

        
// Blink money

        
message_begin(MSG_ONE_UNRELIABLEmsg_BlinkAcct_id);

        
write_byte(2); // times

        
message_end();

        return 
false

    
}

    return 
true

}



draw_new_weapon(idCSW_ID)

{

    static 
weapon;

    
weapon find_ent_by_owner(-1weapon_newpnid);



    if(
CSW_ID == CSW_NEWPN)

    {

        if(
pev_valid(weapon) && Get_BitVar(g_has_weaponid))

        {

            
set_pev(weaponpev_effectspev(weaponpev_effects) &~ EF_NODRAW);

            
engfunc(EngFunc_SetModelweaponP_MODEL);

            
set_pev(weaponpev_bodyBODY_NUM);

        }

    }

    else

        if(
pev_valid(weapon))

            
set_pev(weaponpev_effectspev(weaponpev_effects) | EF_NODRAW);

}



make_shell(id)

{

    static 
Float:player_origin[3], Float:origin[3], Float:origin2[3], Float:gunorigin[3], Float:oldangles[3], Float:v_forward[3], Float:v_forward2[3], Float:v_up[3], Float:v_up2[3], Float:v_right[3], Float:v_right2[3], Float:viewoffsets[3];

    

    
pev(id,pev_v_angleoldangles); pev(id,pev_origin,player_origin); pev(idpev_view_ofsviewoffsets);



    
engfunc(EngFunc_MakeVectorsoldangles)

    

    
global_get(glb_v_forwardv_forward); global_get(glb_v_upv_up); global_get(glb_v_rightv_right);

    
global_get(glb_v_forwardv_forward2); global_get(glb_v_upv_up2); global_get(glb_v_rightv_right2);

    

    
xs_vec_add(player_originviewoffsetsgunorigin);

    

    
xs_vec_mul_scalar(v_forward10.3v_forward); xs_vec_mul_scalar(v_right2.9v_right);

    
xs_vec_mul_scalar(v_up, -3.7v_up);

    
xs_vec_mul_scalar(v_forward210.0v_forward2); xs_vec_mul_scalar(v_right23.0v_right2);

    
xs_vec_mul_scalar(v_up2, -4.0v_up2);

    

    
xs_vec_add(gunoriginv_forwardorigin);

    
xs_vec_add(gunoriginv_forward2origin2);

    
xs_vec_add(originv_rightorigin);

    
xs_vec_add(origin2v_right2origin2);

    
xs_vec_add(originv_uporigin);

    
xs_vec_add(origin2v_up2origin2);



    static 
Float:velocity[3]

    
get_speed_vector(origin2originrandom_float(140.0160.0), velocity)



    static 
angleangle random_num(0360)



    
message_begin(MSG_ONE_UNRELIABLESVC_TEMPENTITY_id)

    
write_byte(TE_MODEL)

    
engfunc(EngFunc_WriteCoordorigin[0])

    
engfunc(EngFunc_WriteCoord,origin[1])

    
engfunc(EngFunc_WriteCoord,origin[2])

    
engfunc(EngFunc_WriteCoord,velocity[0])

    
engfunc(EngFunc_WriteCoord,velocity[1])

    
engfunc(EngFunc_WriteCoord,velocity[2])

    
write_angle(angle)

    
write_short(shell_model)

    
write_byte(1)

    
write_byte(20)

    
message_end()

}



make_bullet_smoke(idTrResult)

{

    static 
Float:vecSrc[3], Float:vecEnd[3], TE_FLAG;

    

    
get_weapon_attachment(idvecSrc);

    
global_get(glb_v_forwardvecEnd);

    

    
xs_vec_mul_scalar(vecEnd8192.0vecEnd);

    
xs_vec_add(vecSrcvecEndvecEnd);



    
get_tr2(TrResultTR_vecEndPosvecSrc);

    
get_tr2(TrResultTR_vecPlaneNormalvecEnd);

    

    
xs_vec_mul_scalar(vecEnd2.5vecEnd);

    
xs_vec_add(vecSrcvecEndvecEnd);

    

    
TE_FLAG |= TE_EXPLFLAG_NODLIGHTS;

    
TE_FLAG |= TE_EXPLFLAG_NOSOUND;

    
TE_FLAG |= TE_EXPLFLAG_NOPARTICLES;

    

    
engfunc(EngFunc_MessageBeginMSG_PASSVC_TEMPENTITYvecEnd0);

    
write_byte(TE_EXPLOSION);

    
engfunc(EngFunc_WriteCoordvecEnd[0]);

    
engfunc(EngFunc_WriteCoordvecEnd[1]);

    
engfunc(EngFunc_WriteCoordvecEnd[2] - 10.0);

    
write_short(smoke_sprite);

    
write_byte(5);

    
write_byte(50);

    
write_byte(TE_FLAG);

    
message_end();

}



make_bullet_hole(idFloat:origin[3], Float:damage)

{

    
// Find target

    
static decalloop_time;



    if(!
get_pcvar_num(cvar_decals))

        
decal random_num(4143);

    else

        
decal random_num(5255);

        

    if(
damage 100.0)

        
loop_time 2;

    else

        
loop_time 1;

    

    for(new 
0loop_timei++)

    {

        
// Put decal on "world" (a wall)

        
message_begin(MSG_BROADCASTSVC_TEMPENTITY);

        
write_byte(TE_WORLDDECAL);

        
engfunc(EngFunc_WriteCoordorigin[0]);

        
engfunc(EngFunc_WriteCoordorigin[1]);

        
engfunc(EngFunc_WriteCoordorigin[2]);

        
write_byte(decal);

        
message_end();

        

        
// Show sparkles

        
message_begin(MSG_BROADCASTSVC_TEMPENTITY);

        
write_byte(TE_GUNSHOTDECAL);

        
engfunc(EngFunc_WriteCoordorigin[0]);

        
engfunc(EngFunc_WriteCoordorigin[1]);

        
engfunc(EngFunc_WriteCoordorigin[2]);

        
write_short(id);

        
write_byte(decal);

        
message_end();

    }

}



get_weapon_attachment(idFloat:output[3], Float:fDis 40.0)



    static 
Float:vfEnd[3], viEnd[3] ;

    
get_user_origin(idviEnd3);

    
IVecFVec(viEndvfEnd);

    

    static 
Float:fOrigin[3], Float:fAngle[3];

    

    
pev(idpev_originfOrigin);

    
pev(idpev_view_ofsfAngle);

    

    
xs_vec_add(fOriginfAnglefOrigin);

    

    static 
Float:fAttack[3];

    

    
xs_vec_sub(vfEndfOriginfAttack);

    
xs_vec_sub(vfEndfOriginfAttack);

    

    static 
Float:fRate;

    

    
fRate fDis vector_length(fAttack);

    
xs_vec_mul_scalar(fAttackfRatefAttack);

    

    
xs_vec_add(fOriginfAttackoutput);

}



set_weapon_anim(idanim)

{

    if(!
is_user_alive(id))

        return

    

    
set_pev(idpev_weaponanimanim);

    

    
message_begin(MSG_ONE_UNRELIABLESVC_WEAPONANIM, {000}, id);

    
write_byte(anim);

    
write_byte(pev(idpev_body));

    
message_end();

}



// Drop primary/secondary weapons

drop_weapons(id)

{

    
// Get user weapons

    
static weapons[32], numiwpn_id;

    
num 0;     // reset passed weapons count (bugfix)

    
get_user_weapons(idweaponsnum);

    

    
// Loop through them and drop primaries or secondaries

    
for (0numi++)

    {

        
// Prevent re-indexing the array

        
wpn_id weapons[i];

        

        if(
1<<wpn_id WEAPONS_BIT_SUM)

        {

            
// Get weapon entity

            
static wname[32];

            
get_weaponname(wpn_idwnamecharsmax(wname));



            
// Player drops the weapon

            
engclient_cmd(id"drop"wname);

        }

    }

}



arm_switch(id)
{
    if(
get_user_team(id) == get_pcvar_num(cvar_alteam))
        
set_pev(idpev_viewmodel2V_MODEL_ALT);
    else
        
set_pev(idpev_viewmodel2V_MODEL);
    
    
set_pev(idpev_weaponmodel2P_MODEL)
    
set_weapon_anim(idDRAW_ANIM)
    
draw_new_weapon(idCSW_NEWPN)
}



is_weapon_slot_emptyid iSlot , &iEntity )

{

    if ( !( 
<= iSlot <= ) )

        return 
0;

    

    
iEntity 0;

    const 
m_rgpPlayerItems_Slot0 367;

    const 
m_iId 43;

    const 
EXTRAOFFSET_WEAPONS 4;

    

    
iEntity get_pdata_cbaseid m_rgpPlayerItems_Slot0 iSlot EXTRAOFFSET_WEAPONS );

    

    return ( 
iEntity ) ? get_pdata_intiEntity m_iId EXTRAOFFSET_WEAPONS ) : 0;





get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speedFloat:new_velocity[3])

{

    
new_velocity[0] = origin2[0] - origin1[0]

    
new_velocity[1] = origin2[1] - origin1[1]

    
new_velocity[2] = origin2[2] - origin1[2]

    new 
Float:num floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))

    
new_velocity[0] *= num

    new_velocity
[1] *= num

    new_velocity
[2] *= num

    

    
return 1;

}



give_ammo(idammoammo_idcost)

{

    if (
cs_get_user_money(id) < cost)

    {

        
client_print(idprint_center"#Cstrike_TitlesTXT_Not_Enough_Money");

    

        
// Blink money

        
message_begin(MSG_ONE_UNRELIABLEmsg_BlinkAcct_id);

        
write_byte(2); // times

        
message_end();

        return 
PLUGIN_HANDLED

    
}



    new 
newammo cs_get_user_bpammo(idCSW_NEWPN) + ammo;

    
cs_set_user_bpammo(idCSW_NEWPNnewammo);



    
message_begin(MSG_ONE,get_user_msgid("AmmoPickup"),_id );

    
write_byte(ammo_id);

    
write_byte(ammo);

    
message_end();



    
emit_sound(idCHAN_ITEM"items/9mmclip1.wav"VOL_NORMATTN_NORM0PITCH_NORM);



    
// Calculate new money amount

    
static newmoney;

    
newmoney cs_get_user_money(id) - cost;



    
// Update money offset

    
cs_set_user_money(idnewmoney1);



    return 
PLUGIN_CONTINUE


__________________

Last edited by Ayman Khaled; 05-27-2017 at 07:13.
Ayman Khaled is offline
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 05-28-2017 , 09:15   Re: Tec-9
Reply With Quote #2

anyone ?
the problem is here
PHP Code:
public Event_New_Round()

{

    new 
freezetime get_pcvar_num(cvar_freezetime);

    new 
buytime floatround((get_pcvar_float(cvar_buytime) * 60));

    new 
Float:t;

    

    
g_buytime_expire 0;

    
g_newrnd_bypass 0;

    

    if(
g_restart_round)

    {

        
Remove_Weapons(01);

        
g_restart_round 0;

    }

    

    
set_task(0.1"Bypass_NewRound_Items");

    
remove_task(TASKID_BUYTIME);

    

    if(
get_pcvar_num(cvar_bot_allow_wpns) && g_buytime_expire == 0)

        
set_task(1.5"Bot_Weapon");

    

    if(
buytime freezetime)

        
float(buytime);

    else

        
float(buytime+freezetime);

    

    
set_task(t"Buytime_Expired"TASKID_BUYTIME);


__________________

Last edited by Ayman Khaled; 05-28-2017 at 09:15.
Ayman Khaled is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-28-2017 , 09:26   Re: Tec-9
Reply With Quote #3

Why are there so many blank lines?!

Line 487: if(get_pcvar_num(cvar_bot_allow_wpns) && g_buytime_expire == 0)

Your server probably doesn't have the "cvar_bot_allow_wpns" cvar which is "bot_allow_pistols".
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:41.


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