Raised This Month: $32 Target: $400
 8% 

error 035: argument type mismatch (argument 2)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jorconnn
Junior Member
Join Date: Sep 2020
Old 09-20-2020 , 16:25   error 035: argument type mismatch (argument 2)
Reply With Quote #1

PHP Code:
/*
 *        [1.0] - First release
 *          |
 *          +———[1.1] - Fix adding hits on enemies to activate 2 mode (for amxx version 1.8.2 and less)
 *                      - Fix damage with knife in hands
 */

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>
#include <xs>
#include <zmvip>

#define IsCustomItem(%0)             (pev(%0, pev_impulse) == WEAPON_SPECIAL_CODE)
#define setWeaponState(%0,%1)        (set_pdata_int(%0, m_iWeaponState, %1, linux_diff_weapon))
#define getWeaponState(%0)            (get_pdata_int(%0, m_iWeaponState, linux_diff_weapon))
#define setHitCount(%0,%1)            (set_pdata_int(%0, m_iGlock18ShotsFired, %1, linux_diff_weapon))
#define getHitCount(%0)                (get_pdata_int(%0, m_iGlock18ShotsFired, linux_diff_weapon))

enum
{
    
WPNSTATE_IDLE 0,
    
WPNSTATE_SHOOT_SECONDARY
};

#define PDATA_SAFE                     2

#define pev_missile_type            pev_iuser3
#define pev_rotate                    pev_iuser4

/* ~ [ Weapon Animations ] ~ */
#define WEAPON_ANIM_IDLE_TIME         61/30.0 // 2nd - 91/30.0
#define WEAPON_ANIM_SHOOT_TIME         31/30.0
#define WEAPON_ANIM_SHOOT_EX_TIME    61/30.0
#define WEAPON_ANIM_RELOAD_TIME     121/30.0
#define WEAPON_ANIM_DRAW_TIME         31/30.0

#define WEAPON_ANIM_IDLE             0
#define WEAPON_ANIM_RELOAD             2
#define WEAPON_ANIM_DRAW             3
#define WEAPON_ANIM_SHOOT             random_num(4,5)
#define WEAPON_ANIM_SHOOT_EX        6

/* ~ [ Extra Item ] ~ */
new const WEAPON_ITEM_NAME[] =         "Shining Heart Rod";
const 
WEAPON_ITEM_COST =             50;

/* ~ [ Weapon Settings ] ~ */

// This macros enable animated sprite of heart in first mode
// At the enabled macro, Sprite will turn
#define ENABLE_ANIMATED_SPRITE        true // [ true = Enable / false = Disable ]

new const WEAPON_REFERENCE[] =         "weapon_m249";
new const 
WEAPON_WEAPONLIST[] =     "x/weapon_magicmg";
new const 
WEAPON_NATIVE[] =         "zp_give_user_magicmg";
new const 
WEAPON_MODEL_VIEW[] =     "models/x/v_magicmg.mdl";
new const 
WEAPON_MODEL_PLAYER[] =     "models/x/p_magicmg.mdl";
new const 
WEAPON_MODEL_WORLD[] =     "models/x/w_magicmg.mdl";
new const 
WEAPON_SOUND_FIRE[][] = 
{
    
"weapons/magicmg-1.wav",
    
"weapons/magicmg-2.wav"
};
new const 
WEAPON_SOUND_READY[] =     "weapons/magicmg_alarm.wav";

const 
WEAPON_SPECIAL_CODE =         14082019;
const 
WEAPON_BODY =                 0;

const 
WEAPON_HIT_COUNT =             40// Count of hit for active 2nd mode
const WEAPON_MAX_CLIP =             100;
const 
WEAPON_DEFAULT_AMMO =         200;
const 
FloatWEAPON_RATE =             0.2;
const 
FloatWEAPON_PUNCHANGLE =     0.834;

new const 
iWeaponList[] =             { 3200,-1, -10420};

/* ~ [ Entity: Missile ] ~ */
new const ENTITY_MISSILE_CLASSNAME[] = "ent_magicmg_missile";
new const 
ENTITY_MISSILE_SPRITE[][] =
{
    
"sprites/x/ef_magicmgmissile1.spr",
    
"sprites/x/ef_magicmgmissile2.spr"
};
new const 
ENTITY_MISSILE_EXP_SPRITE[][] =
{
    
"sprites/x/ef_magicmgexplo.spr",
    
"sprites/x/ef_magicmgexplo2.spr"
};
new const 
ENTITY_MISSILE_EXP_SOUND[][] =
{
    
"weapons/magicmg_1exp.wav",
    
"weapons/magicmg_2exp.wav"
};
const 
FloatENTITY_MISSILE_SPEED 650.0;
const 
FloatENTITY_MISSILE_RADIUS 75.0;
const 
FloatENTITY_MISSILE_RADIUS_EX 125.0;
const 
FloatENTITY_MISSILE_DAMAGE 75.0
const FloatENTITY_MISSILE_DAMAGE_EX 1750.0
const ENTITY_MISSILE_DMGTYPE DMG_BULLET|DMG_NEVERGIB;

/* ~ [ Offsets ] ~ */
// Linux extra offsets
#define linux_diff_weapon 4
#define linux_diff_player 5

// CWeaponBox
#define m_rgpPlayerItems_CWeaponBox 34

// CBasePlayerItem
#define m_pPlayer 41
#define m_pNext 42
#define m_iId 43

// CBasePlayerWeapon
#define m_flNextPrimaryAttack 46
#define m_flNextSecondaryAttack 47
#define m_flTimeWeaponIdle 48
#define m_iPrimaryAmmoType 49
#define m_iClip 51
#define m_fInReload 54
#define m_iGlock18ShotsFired 70
#define m_iWeaponState 74

// CBaseMonster
#define m_LastHitGroup 75
#define m_flNextAttack 83

// CBasePlayer
#define m_rpgPlayerItems 367
#define m_pActiveItem 373
#define m_rgAmmo 376

/* ~ [ Params ] ~ */
new gl_iszAllocString_Entity,
    
gl_iszAllocString_ModelView,
    
gl_iszAllocString_ModelPlayer,
    
gl_iszAllocString_EnvSprite,
    
gl_iszAllocString_Misille,

    
gl_iszModelIndex_MissileExp[2],
    
gl_iszModelIndex_BloodSpray,
    
gl_iszModelIndex_BloodDrop,

    
gl_iMsgID_Weaponlist,
    
gl_iMsgID_StatusIcon,
    
gl_iMsgID_ScreenFade,

    
gl_iItemID;

public 
plugin_init()
{
    
// https://cso.fandom.com/wiki/Shining_Heart_Rod
    
register_plugin("[ZP] Weapon: Shining Heart Rod""1.1""xUnicorn (t3rkecorejz) / Batcoh: Code base");

    
gl_iItemID zv_register_extra_item(WEAPON_ITEM_NAMEWEAPON_ITEM_COSTZV_TEAM_HUMAN);

    
register_forward(FM_UpdateClientData,    "FM_Hook_UpdateClientData_Post"true);
    
register_forward(FM_SetModel,             "FM_Hook_SetModel_Pre"false);

    
// Hook Weapon
    
RegisterHam(Ham_Item_Holster,            WEAPON_REFERENCE,    "CWeapon__Holster_Post"true);
    
RegisterHam(Ham_Item_Deploy,            WEAPON_REFERENCE,    "CWeapon__Deploy_Post"true);
    
RegisterHam(Ham_Item_PostFrame,            WEAPON_REFERENCE,    "CWeapon__PostFrame_Pre"false);
    
RegisterHam(Ham_Item_AddToPlayer,        WEAPON_REFERENCE,    "CWeapon__AddToPlayer_Post"true);
    
RegisterHam(Ham_Weapon_Reload,            WEAPON_REFERENCE,    "CWeapon__Reload_Pre"false);
    
RegisterHam(Ham_Weapon_WeaponIdle,        WEAPON_REFERENCE,    "CWeapon__WeaponIdle_Pre"false);
    
RegisterHam(Ham_Weapon_PrimaryAttack,    WEAPON_REFERENCE,    "CWeapon__PrimaryAttack_Pre"false);
    
RegisterHam(Ham_Weapon_SecondaryAttack,    WEAPON_REFERENCE,    "CWeapon__SecondaryAttack_Pre"false);

    
// Hook Entities
    
RegisterHam(Ham_Touch,                    "env_sprite",        "CSprite__Touch_Post"true);

    
#if ENABLE_ANIMATED_SPRITE == true

    
RegisterHam(Ham_Think,                    "env_sprite",        "CSprite__Think_Post"true);

    
#endif

    // Messages
    
gl_iMsgID_Weaponlist get_user_msgid("WeaponList");
    
gl_iMsgID_StatusIcon get_user_msgid("StatusIcon");
    
gl_iMsgID_ScreenFade get_user_msgid("ScreenFade");
}

public 
plugin_precache()
{
    new 
i;

    
// Hook weapon
    
register_clcmd(WEAPON_WEAPONLIST"Command_HookWeapon");

    
// Precache models
    
engfunc(EngFunc_PrecacheModelWEAPON_MODEL_VIEW);
    
engfunc(EngFunc_PrecacheModelWEAPON_MODEL_PLAYER);
    
engfunc(EngFunc_PrecacheModelWEAPON_MODEL_WORLD);

    for(
0sizeof ENTITY_MISSILE_SPRITEi++)
        
engfunc(EngFunc_PrecacheModelENTITY_MISSILE_SPRITE[i]);

    
// Precache generic
    
UTIL_PrecacheSpritesFromTxt(WEAPON_WEAPONLIST);
    
    
// Precache sounds
    
for(0sizeof WEAPON_SOUND_FIREi++)
        
engfunc(EngFunc_PrecacheSoundWEAPON_SOUND_FIRE[i]);

    for(
0sizeof ENTITY_MISSILE_EXP_SOUNDi++)
        
engfunc(EngFunc_PrecacheSoundENTITY_MISSILE_EXP_SOUND[i]);

    
engfunc(EngFunc_PrecacheSoundWEAPON_SOUND_READY);
    
UTIL_PrecacheSoundsFromModel(WEAPON_MODEL_VIEW);

    
// Other
    
gl_iszAllocString_Entity engfunc(EngFunc_AllocStringWEAPON_REFERENCE);
    
gl_iszAllocString_ModelView engfunc(EngFunc_AllocStringWEAPON_MODEL_VIEW);
    
gl_iszAllocString_ModelPlayer engfunc(EngFunc_AllocStringWEAPON_MODEL_PLAYER);
    
gl_iszAllocString_EnvSprite engfunc(EngFunc_AllocString"env_sprite");
    
gl_iszAllocString_Misille engfunc(EngFunc_AllocStringENTITY_MISSILE_CLASSNAME);

    
// Model Index
    
for(0sizeof ENTITY_MISSILE_EXP_SPRITEi++)
        
gl_iszModelIndex_MissileExp[i] = engfunc(EngFunc_PrecacheModelENTITY_MISSILE_EXP_SPRITE[i]);

    
gl_iszModelIndex_BloodSpray engfunc(EngFunc_PrecacheModel"sprites/bloodspray.spr");
    
gl_iszModelIndex_BloodDrop engfunc(EngFunc_PrecacheModel"sprites/blood.spr");
}

public 
plugin_natives() register_native(WEAPON_NATIVE"Command_GiveWeapon"1);

// [ Amxx ]
public zv_extra_item_selected(iPlayeriItem)
{
    if(
iItem == gl_iItemID)
        
Command_GiveWeapon(iPlayer);
}

public 
zp_user_infected_post(iPlayerUTIL_StatusIcon(iPlayer0);

public 
Command_HookWeapon(iPlayer)
{
    
engclient_cmd(iPlayerWEAPON_REFERENCE);
    return 
PLUGIN_HANDLED;
}

public 
Command_GiveWeapon(iPlayer)
{
    static 
iEntityiEntity engfunc(EngFunc_CreateNamedEntitygl_iszAllocString_Entity);
    if(
iEntity <= 0) return 0;

    
set_pev(iEntitypev_impulseWEAPON_SPECIAL_CODE);
    
ExecuteHam(Ham_SpawniEntity);
    
set_pdata_int(iEntitym_iClipWEAPON_MAX_CLIPlinux_diff_weapon);
    
UTIL_DropWeapon(iPlayer1);

    if(!
ExecuteHamB(Ham_AddPlayerItemiPlayeriEntity))
    {
        
set_pev(iEntitypev_flagspev(iEntitypev_flags) | FL_KILLME);
        return 
0;
    }

    
ExecuteHamB(Ham_Item_AttachToPlayeriEntityiPlayer);

    new 
iAmmoType m_rgAmmo get_pdata_int(iEntitym_iPrimaryAmmoTypelinux_diff_weapon);
    if(
get_pdata_int(iPlayerm_rgAmmolinux_diff_player) < WEAPON_DEFAULT_AMMO)
        
set_pdata_int(iPlayeriAmmoTypeWEAPON_DEFAULT_AMMOlinux_diff_player);

    
emit_sound(iPlayerCHAN_ITEM"items/gunpickup2.wav"VOL_NORMATTN_NORM0PITCH_NORM);
    return 
1;
}

// [ Fakemeta ]
public FM_Hook_UpdateClientData_Post(iPlayerSendWeaponsCD_Handle)
{
    if(!
is_user_alive(iPlayer)) return;

    static 
iItemiItem get_pdata_cbase(iPlayerm_pActiveItemlinux_diff_player);
    if(
pev_valid(iItem) != PDATA_SAFE || !IsCustomItem(iItem)) return;

    
set_cd(CD_HandleCD_flNextAttackget_gametime() + 0.001);
}

public 
FM_Hook_SetModel_Pre(iEntity)
{
    static 
iszClassName[32], iItem;
    
pev(iEntitypev_classnameszClassNamecharsmax(szClassName));

    if(!
equal(szClassName"weaponbox")) return FMRES_IGNORED;

    for(
06i++)
    {
        
iItem get_pdata_cbase(iEntitym_rgpPlayerItems_CWeaponBox ilinux_diff_weapon);

        if(
iItem && IsCustomItem(iItem))
        {
            
engfunc(EngFunc_SetModeliEntityWEAPON_MODEL_WORLD);
            
set_pev(iEntitypev_bodyWEAPON_BODY);
            
            return 
FMRES_SUPERCEDE;
        }
    }

    return 
FMRES_IGNORED;
}

// [ HamSandwich ]
public CWeapon__Holster_Post(iItem)
{
    if(!
IsCustomItem(iItem)) return;
    static 
iPlayeriPlayer get_pdata_cbase(iItemm_pPlayerlinux_diff_weapon);
    
    
UTIL_StatusIcon(iPlayer0);
    
setWeaponState(iItemWPNSTATE_IDLE);
    
set_pdata_float(iItemm_flNextPrimaryAttack0.0linux_diff_weapon);
    
set_pdata_float(iItemm_flNextSecondaryAttack0.0linux_diff_weapon);
    
set_pdata_float(iItemm_flTimeWeaponIdle0.0linux_diff_weapon);
    
set_pdata_float(iPlayerm_flNextAttack0.0linux_diff_player);
}

public 
CWeapon__Deploy_Post(iItem)
{
    if(!
IsCustomItem(iItem)) return;
    
    static 
iPlayeriPlayer get_pdata_cbase(iItemm_pPlayerlinux_diff_weapon);

    
set_pev_string(iPlayerpev_viewmodel2gl_iszAllocString_ModelView);
    
set_pev_string(iPlayerpev_weaponmodel2gl_iszAllocString_ModelPlayer);

    
UTIL_SendWeaponAnim(iPlayerWEAPON_ANIM_DRAW);
    
UTIL_StatusIcon(iPlayergetHitCount(iItem) >= WEAPON_HIT_COUNT 0);

    
set_pdata_float(iPlayerm_flNextAttackWEAPON_ANIM_DRAW_TIMElinux_diff_player);
    
set_pdata_float(iItemm_flTimeWeaponIdleWEAPON_ANIM_DRAW_TIMElinux_diff_weapon);
}

public 
CWeapon__PostFrame_Pre(iItem)
{
    if(!
IsCustomItem(iItem)) return HAM_IGNORED;

    static 
iPlayeriPlayer get_pdata_cbase(iItemm_pPlayerlinux_diff_weapon);
    static 
iButtoniButton pev(iPlayerpev_button);

    
// Reload
    
if(get_pdata_int(iItemm_fInReloadlinux_diff_weapon) == 1)
    {
        static 
iClipiClip get_pdata_int(iItemm_iCliplinux_diff_weapon);
        static 
iAmmoTypeiAmmoType m_rgAmmo get_pdata_int(iItemm_iPrimaryAmmoTypelinux_diff_weapon);
        static 
iAmmoiAmmo get_pdata_int(iPlayeriAmmoTypelinux_diff_player);
        static 
jmin(WEAPON_MAX_CLIP iClipiAmmo);

        
set_pdata_int(iItemm_iClipiClip jlinux_diff_weapon);
        
set_pdata_int(iPlayeriAmmoTypeiAmmo jlinux_diff_player);
        
set_pdata_int(iItemm_fInReload0linux_diff_weapon);
    }

    
// Shoot from SecondaryAttack
    
if(getWeaponState(iItem) == WPNSTATE_SHOOT_SECONDARY)
    {
        
CWeapon__CreateMissile(iPlayer1);
        
setWeaponState(iItemWPNSTATE_IDLE);
    }

    
// Hook SecondaryAttack
    
if(iButton IN_ATTACK2 && get_pdata_float(iItemm_flNextSecondaryAttacklinux_diff_weapon) < 0.0)
    {
        
ExecuteHamB(Ham_Weapon_SecondaryAttackiItem);

        
iButton &= ~IN_ATTACK2;
        
set_pev(iPlayerpev_buttoniButton);
    }

    return 
HAM_IGNORED;
}

public 
CWeapon__AddToPlayer_Post(iItemiPlayer)
{
    if(
IsCustomItem(iItem)) UTIL_WeaponList(iPlayertrue);
    else if(
pev(iItempev_impulse) == 0UTIL_WeaponList(iPlayerfalse);
}

public 
CWeapon__Reload_Pre(iItem)
{
    if(!
IsCustomItem(iItem)) return HAM_IGNORED;

    static 
iClipiClip get_pdata_int(iItemm_iCliplinux_diff_weapon);
    if(
iClip >= WEAPON_MAX_CLIP) return HAM_SUPERCEDE;

    static 
iPlayeriPlayer get_pdata_cbase(iItemm_pPlayerlinux_diff_weapon);
    static 
iAmmoTypeiAmmoType m_rgAmmo get_pdata_int(iItemm_iPrimaryAmmoTypelinux_diff_weapon);
    if(
get_pdata_int(iPlayeriAmmoTypelinux_diff_player) <= 0) return HAM_SUPERCEDE;

    
set_pdata_int(iItemm_iClip0linux_diff_weapon);
    
ExecuteHam(Ham_Weapon_ReloadiItem);
    
set_pdata_int(iItemm_iClipiCliplinux_diff_weapon);
    
set_pdata_int(iItemm_fInReload1linux_diff_weapon);

    
UTIL_SendWeaponAnim(iPlayerWEAPON_ANIM_RELOAD);

    
set_pdata_float(iItemm_flNextPrimaryAttackWEAPON_ANIM_RELOAD_TIMElinux_diff_weapon);
    
set_pdata_float(iItemm_flNextSecondaryAttackWEAPON_ANIM_RELOAD_TIMElinux_diff_weapon);
    
set_pdata_float(iItemm_flTimeWeaponIdleWEAPON_ANIM_RELOAD_TIMElinux_diff_weapon);
    
set_pdata_float(iPlayerm_flNextAttackWEAPON_ANIM_RELOAD_TIMElinux_diff_player);

    return 
HAM_SUPERCEDE;
}

public 
CWeapon__WeaponIdle_Pre(iItem)
{
    if(!
IsCustomItem(iItem) || get_pdata_float(iItemm_flTimeWeaponIdlelinux_diff_weapon) > 0.0) return HAM_IGNORED;
    static 
iPlayeriPlayer get_pdata_cbase(iItemm_pPlayerlinux_diff_weapon);
    static 
iIdleAnim;
    if(
random_num(010) <= 1// Chance for second idle anim 10%
        
iIdleAnim 1;
    else 
iIdleAnim 0;

    
UTIL_SendWeaponAnim(iPlayerWEAPON_ANIM_IDLE iIdleAnim);
    
set_pdata_float(iItemm_flTimeWeaponIdleWEAPON_ANIM_IDLE_TIME + (iIdleAnim 1.0 0.0), linux_diff_weapon);

    return 
HAM_SUPERCEDE;
}

public 
CWeapon__PrimaryAttack_Pre(iItem)
{
    if(!
IsCustomItem(iItem)) return HAM_IGNORED;

    static 
iClipiClip get_pdata_int(iItemm_iCliplinux_diff_weapon);
    if(!
iClip)
    {
        
ExecuteHam(Ham_Weapon_PlayEmptySoundiItem);
        
set_pdata_float(iItemm_flNextPrimaryAttack0.2linux_diff_weapon);

        return 
HAM_SUPERCEDE;
    }

    static 
iPlayeriPlayer get_pdata_cbase(iItemm_pPlayerlinux_diff_weapon);

    static 
FloatvecPunchangle[3];
    
vecPunchangle[0] = -WEAPON_PUNCHANGLE 2.0;
    
vecPunchangle[1] = random_float(-WEAPON_PUNCHANGLE 2.0WEAPON_PUNCHANGLE 2.0);
    
vecPunchangle[2] = 0.0;
    
set_pev(iPlayerpev_punchanglevecPunchangle);

    
CWeapon__CreateMissile(iPlayer0);

    
UTIL_SendWeaponAnim(iPlayerWEAPON_ANIM_SHOOT);
    
emit_sound(iPlayerCHAN_WEAPONWEAPON_SOUND_FIRE[0], VOL_NORMATTN_NORM0PITCH_NORM);

    if(
getWeaponState(iItem) != WPNSTATE_IDLEsetWeaponState(iItemWPNSTATE_IDLE);
    
set_pdata_int(iItemm_iClipiClip 1linux_diff_weapon);
    
set_pdata_float(iItemm_flNextPrimaryAttackWEAPON_RATElinux_diff_weapon);
    
set_pdata_float(iItemm_flNextSecondaryAttackWEAPON_RATElinux_diff_weapon);
    
set_pdata_float(iItemm_flTimeWeaponIdleWEAPON_ANIM_SHOOT_TIMElinux_diff_weapon);

    return 
HAM_SUPERCEDE;
}

public 
CWeapon__SecondaryAttack_Pre(iItem)
{
    if(!
IsCustomItem(iItem)) return HAM_IGNORED;
    if(
getHitCount(iItem) < WEAPON_HIT_COUNT) return HAM_SUPERCEDE;

    static 
iPlayeriPlayer get_pdata_cbase(iItemm_pPlayerlinux_diff_weapon);

    
UTIL_StatusIcon(iPlayer0);
    
UTIL_SendWeaponAnim(iPlayerWEAPON_ANIM_SHOOT_EX);
    
emit_sound(iPlayerCHAN_WEAPONWEAPON_SOUND_FIRE[1], VOL_NORMATTN_NORM0PITCH_NORM);

    
setHitCount(iItem0);
    
setWeaponState(iItemWPNSTATE_SHOOT_SECONDARY);
    
set_pdata_float(iPlayerm_flNextAttack31/30.0linux_diff_player);
    
set_pdata_float(iItemm_flNextPrimaryAttackWEAPON_ANIM_SHOOT_EX_TIMElinux_diff_weapon);
    
set_pdata_float(iItemm_flNextSecondaryAttackWEAPON_ANIM_SHOOT_EX_TIMElinux_diff_weapon);
    
set_pdata_float(iItemm_flTimeWeaponIdleWEAPON_ANIM_SHOOT_EX_TIMElinux_diff_weapon);

    return 
HAM_SUPERCEDE;
}

public 
CSprite__Touch_Post(iEntityiTouch)
{
    if(
pev_valid(iEntity) != PDATA_SAFE) return HAM_IGNORED;
    if(
pev(iEntitypev_classname) == gl_iszAllocString_Misille)
    {
        new 
iOwner pev(iEntitypev_owner);
        if(
iTouch == iOwner) return HAM_SUPERCEDE;

        new 
FloatvecOrigin[3]; pev(iEntitypev_originvecOrigin);
        if(
engfunc(EngFunc_PointContentsvecOrigin) == CONTENTS_SKY)
        {
            
set_pev(iEntitypev_flagsFL_KILLME);
            return 
HAM_IGNORED;
        }

        new 
iMissileType pev(iEntitypev_missile_type);

        
emit_sound(iEntityCHAN_ITEMENTITY_MISSILE_EXP_SOUND[iMissileType], VOL_NORMATTN_NORM0PITCH_NORM);

        
engfunc(EngFunc_MessageBeginMSG_PASSVC_TEMPENTITYvecOrigin0);
        
write_byte(TE_EXPLOSION); // TE
        
engfunc(EngFunc_WriteCoordvecOrigin[0]); // Position X
        
engfunc(EngFunc_WriteCoordvecOrigin[1]); // Position Y
        
engfunc(EngFunc_WriteCoordvecOrigin[2] + 20.0); // Position Z
        
write_short(gl_iszModelIndex_MissileExp[iMissileType]); // Model Index
        
write_byte(iMissileType 16 8); // Scale
        
write_byte(32); // Framerate
        
write_byte(TE_EXPLFLAG_NODLIGHTS|TE_EXPLFLAG_NOSOUND|TE_EXPLFLAG_NOPARTICLES); // Flags
        
message_end();

        new 
iItem get_pdata_cbase(iOwnerm_rpgPlayerItems 1linux_diff_player);
        if(
pev_valid(iItem) == PDATA_SAFE && IsCustomItem(iItem))
        {
            new 
iVictim FM_NULLENT;
            new 
FloatflRadius iMissileType ENTITY_MISSILE_RADIUS_EX ENTITY_MISSILE_RADIUS;
            new 
FloatflDamage iMissileType ENTITY_MISSILE_DAMAGE_EX ENTITY_MISSILE_DAMAGE;
            
flDamage *= random_float(0.751.25);

            
// It's only blood
            
if(is_user_alive(iTouch) && zp_get_user_zombie(iTouch))
                
UTIL_BloodDrips(vecOriginiTouchfloatround(flDamage));

            while((
iVictim engfunc(EngFunc_FindEntityInSphereiVictimvecOriginflRadius)) > 0)
            {
                if(
pev(iVictimpev_takedamage) == DAMAGE_NO) continue;
                if(
is_user_alive(iVictim))
                {
                    if(
iVictim == iOwner || !zp_get_user_zombie(iVictim) || !is_wall_between_points(iOwneriVictim))
                        continue;
                }
                else if(
pev(iVictimpev_solid) == SOLID_BSP)
                {
                    if(
pev(iVictimpev_spawnflags) & SF_BREAK_TRIGGER_ONLY)
                        continue;
                }

                if(
is_user_alive(iVictim))
                {
                    
set_pdata_int(iVictimm_LastHitGroupHIT_GENERIClinux_diff_player);

                    if(!
iMissileTypeCWeapon__CheckHitCount(iOwneriItem);
                }

                
ExecuteHamB(Ham_TakeDamageiVictimiItemiOwnerflDamageENTITY_MISSILE_DMGTYPE);
            }
        }

        
set_pev(iEntitypev_flagsFL_KILLME);
    }

    return 
HAM_IGNORED;
}

#if ENABLE_ANIMATED_SPRITE == true

public CSprite__Think_Post(iEntity)
{
    if(
pev_valid(iEntity) != PDATA_SAFE) return HAM_IGNORED;
    if(
pev(iEntitypev_classname) == gl_iszAllocString_Misille)
    {
        if(
pev(iEntitypev_missile_type) == 1) return HAM_IGNORED;

        new 
FloatflGameTime get_gametime();
        new 
iRotate pev(iEntitypev_rotate);
        new 
FloatvecAngles[3]; pev(iEntitypev_anglesvecAngles);

        
vecAngles[1] += iRotate 15.0 : -15.0;
        
vecAngles[2] += iRotate 15.0 : -15.0;

        
set_pev(iEntitypev_anglesvecAngles);
        
set_pev(iEntitypev_nextthinkflGameTime 0.05);
    }

    return 
HAM_IGNORED;
}

#endif

// [ Other ]
public CWeapon__CheckHitCount(iPlayeriItem)
{
    if(
getHitCount(iItem) > WEAPON_HIT_COUNT) return;
    if(
getHitCount(iItem) == WEAPON_HIT_COUNT)
    {
        
UTIL_StatusIcon(iPlayer1);
        
UTIL_ScreenFade(iPlayer, (1<<10) * 2, (1<<10) * 20x00002194813070);

        
emit_sound(iPlayerCHAN_ITEMWEAPON_SOUND_READYVOL_NORMATTN_NORM0PITCH_NORM);
    }

    
setHitCount(iItemgetHitCount(iItem) + 1);
}

public 
CWeapon__CreateMissile(iPlayeriMissileType)
{
    new 
iEntity engfunc(EngFunc_CreateNamedEntitygl_iszAllocString_EnvSprite);
    if(!
iEntity) return 0;

    new 
FloatflGameTime get_gametime();
    new 
FloatvecOrigin[3]; pev(iPlayerpev_originvecOrigin);
    new 
FloatvecAngles[3]; pev(iPlayerpev_v_anglevecAngles);
    new 
FloatvecForward[3]; angle_vector(vecAnglesANGLEVECTOR_FORWARDvecForward);
    new 
FloatvecRight[3]; angle_vector(vecAnglesANGLEVECTOR_RIGHTvecRight);
    new 
FloatvecUp[3]; angle_vector(vecAnglesANGLEVECTOR_UPvecUp);
    new 
FloatvecVelocity[3]; xs_vec_copy(vecForwardvecVelocity);
    new 
FloatvecViewOfs[3]; pev(iPlayerpev_view_ofsvecViewOfs);

    
// Create start position
    
xs_vec_add(vecOriginvecViewOfsvecOrigin);
    
xs_vec_mul_scalar(vecForward25.0vecForward);
    
xs_vec_mul_scalar(vecRightrandom_float(-10.010.0), vecRight);
    
xs_vec_mul_scalar(vecUprandom_float(-10.010.0), vecUp);
    
xs_vec_add(vecOriginvecForwardvecOrigin);
    
xs_vec_add(vecOriginvecRightvecOrigin);
    
xs_vec_add(vecOriginvecUpvecOrigin);

    
// Speed for missile
    
xs_vec_mul_scalar(vecVelocityENTITY_MISSILE_SPEEDvecVelocity);

    
engfunc(EngFunc_SetModeliEntityENTITY_MISSILE_SPRITE[iMissileType]);
    
    
set_pev_string(iEntitypev_classnamegl_iszAllocString_Misille);
    
set_pev(iEntitypev_spawnflagsSF_SPRITE_STARTON);
    
set_pev(iEntitypev_animtimeflGameTime);
    
set_pev(iEntitypev_framerate32.0);
    
set_pev(iEntitypev_frame1.0);
    
set_pev(iEntitypev_rendermodekRenderTransAdd);
    
set_pev(iEntitypev_renderamt200.0);
    
set_pev(iEntitypev_scaleiMissileType 0.5 random_float(0.10.4));

    
dllfunc(DLLFunc_SpawniEntity);

    
set_pev(iEntitypev_solidSOLID_TRIGGER);
    
set_pev(iEntitypev_movetypeMOVETYPE_FLY);
    
set_pev(iEntitypev_owneriPlayer);
    
set_pev(iEntitypev_rotaterandom_num(01));
    
set_pev(iEntitypev_missile_typeiMissileType);
    
set_pev(iEntitypev_velocityvecVelocity);
    
set_pev(iEntitypev_nextthinkflGameTime);

    
engfunc(EngFunc_SetSizeiEntityFloat: {-1.0, -1.0, -1.0}, Float: {1.01.01.0});
    
engfunc(EngFunc_SetOriginiEntityvecOrigin);

    return 
iEntity;
}

// [ Stocks ]
stock is_wall_between_points(iPlayeriEntity)
{
    if(!
is_user_alive(iEntity))
        return 
0;

    new 
iTrace create_tr2();
    new 
FloatflStart[3], FloatflEnd[3], FloatflEndPos[3];

    
pev(iPlayerpev_originflStart);
    
pev(iEntitypev_originflEnd);

    
engfunc(EngFunc_TraceLineflStartflEndIGNORE_MONSTERSiPlayeriTrace);
    
get_tr2(iTraceTR_vecEndPosflEndPos);

    
free_tr2(iTrace);

    return 
xs_vec_equal(flEndflEndPos);
}

stock UTIL_SendWeaponAnim(iPlayeriAnim)
{
    
set_pev(iPlayerpev_weaponanimiAnim);

    
message_begin(MSG_ONESVC_WEAPONANIM_iPlayer);
    
write_byte(iAnim);
    
write_byte(0);
    
message_end();
}

stock UTIL_DropWeapon(iPlayeriSlot)
{
    static 
iEntityiNextszWeaponName[32];
    
iEntity get_pdata_cbase(iPlayerm_rpgPlayerItems iSlotlinux_diff_player);

    if(
iEntity 0)
    {
        do
        {
            
iNext get_pdata_cbase(iEntitym_pNextlinux_diff_weapon);

            if(
get_weaponname(get_pdata_int(iEntitym_iIdlinux_diff_weapon), szWeaponNamecharsmax(szWeaponName)))
                
engclient_cmd(iPlayer"drop"szWeaponName);
        }
        
        while((
iEntity iNext) > 0);
    }
}

stock UTIL_PrecacheSoundsFromModel(const szModelPath[])
{
    new 
iFile;
    
    if((
iFile fopen(szModelPath"rt")))
    {
        new 
szSoundPath[64];
        
        new 
iNumSeqiSeqIndex;
        new 
iEventiNumEventsiEventIndex;
        
        
fseek(iFile164SEEK_SET);
        
fread(iFileiNumSeqBLOCK_INT);
        
fread(iFileiSeqIndexBLOCK_INT);
        
        for(new 
k0iNumSeqi++)
        {
            
fseek(iFileiSeqIndex 48 176 iSEEK_SET);
            
fread(iFileiNumEventsBLOCK_INT);
            
fread(iFileiEventIndexBLOCK_INT);
            
fseek(iFileiEventIndex 176 iSEEK_SET);
            
            for(
0iNumEventsk++)
            {
                
fseek(iFileiEventIndex 76 kSEEK_SET);
                
fread(iFileiEventBLOCK_INT);
                
fseek(iFile4SEEK_CUR);
                
                if(
iEvent != 5004)
                    continue;
                
                
fread_blocks(iFileszSoundPath64BLOCK_CHAR);
                
                if(
strlen(szSoundPath))
                {
                    
strtolower(szSoundPath);
                    
engfunc(EngFunc_PrecacheSoundszSoundPath);
                }
            }
        }
    }
    
    
fclose(iFile);
}

stock UTIL_PrecacheSpritesFromTxt(const szWeaponList[])
{
    new 
szTxtDir[64], szSprDir[64]; 
    new 
szFileData[128], szSprName[48], temp[1];

    
format(szTxtDircharsmax(szTxtDir), "sprites/%s.txt"szWeaponList);
    
engfunc(EngFunc_PrecacheGenericszTxtDir);

    new 
iFile fopen(szTxtDir"rb");
    while(
iFile && !feof(iFile)) 
    {
        
fgets(iFileszFileDatacharsmax(szFileData));
        
trim(szFileData);

        if(!
strlen(szFileData)) 
            continue;

        new 
pos containi(szFileData"640");    
            
        if(
pos == -1)
            continue;
            
        
format(szFileDatacharsmax(szFileData), "%s"szFileData[pos+3]);        
        
trim(szFileData);

        
strtok(szFileDataszSprNamecharsmax(szSprName), tempcharsmax(temp), ' '1);
        
trim(szSprName);
        
        
format(szSprDircharsmax(szSprDir), "sprites/%s.spr"szSprName);
        
engfunc(EngFunc_PrecacheGenericszSprDir);
    }

    if(
iFilefclose(iFile);
}

public 
UTIL_BloodDrips(FloatvecOrigin[3], iVictimiAmount)
{
    if(
iAmount 255iAmount 255;
    
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYvecOrigin0);
    
write_byte(TE_BLOODSPRITE);
    
engfunc(EngFunc_WriteCoordvecOrigin[0]);
    
engfunc(EngFunc_WriteCoordvecOrigin[1]);
    
engfunc(EngFunc_WriteCoordvecOrigin[2]);
    
write_short(gl_iszModelIndex_BloodSpray);
    
write_short(gl_iszModelIndex_BloodDrop);
    
write_byte(ExecuteHamB(Ham_BloodColoriVictim));
    
write_byte(min(max(3iAmount 10), 16));
    
message_end();
}

stock UTIL_WeaponList(iPlayerboolbEnabled)
{
    
message_begin(MSG_ONEgl_iMsgID_Weaponlist_iPlayer);
    
write_string(bEnabled WEAPON_WEAPONLIST WEAPON_REFERENCE);
    
write_byte(iWeaponList[0]);
    
write_byte(bEnabled WEAPON_DEFAULT_AMMO iWeaponList[1]);
    
write_byte(iWeaponList[2]);
    
write_byte(iWeaponList[3]);
    
write_byte(iWeaponList[4]);
    
write_byte(iWeaponList[5]);
    
write_byte(iWeaponList[6]);
    
write_byte(iWeaponList[7]);
    
message_end();
}

stock UTIL_StatusIcon(iPlayeriUpdateMode)
{
    
message_begin(MSG_ONEgl_iMsgID_StatusIcon, { 00}, iPlayer);
    
write_byte(iUpdateMode 0);
    
write_string("number_1"); 
    
write_byte(219);
    
write_byte(48); 
    
write_byte(130);
    
message_end();
}

stock UTIL_ScreenFade(iPlayeriDurationiHoldTimeiFlagsiRediGreeniBlueiAlphaiReliable 0)
{
    if(!
iPlayer)
        
message_begin(iReliable MSG_ALL MSG_BROADCASTgl_iMsgID_ScreenFade);
    else 
message_begin(iReliable MSG_ONE MSG_ONE_UNRELIABLEgl_iMsgID_ScreenFade_iPlayer);

    
write_short(iDuration);
    
write_short(iHoldTime);
    
write_short(iFlags);
    
write_byte(iRed);
    
write_byte(iGreen);
    
write_byte(iBlue);
    
write_byte(iAlpha);
    
message_end();

jorconnn is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-20-2020 , 16:50   Re: error 035: argument type mismatch (argument 2)
Reply With Quote #2

You're going to have to provide more details.
__________________
fysiks is offline
jorconnn
Junior Member
Join Date: Sep 2020
Old 09-20-2020 , 17:08   Re: error 035: argument type mismatch (argument 2)
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
You're going to have to provide more details.
I tried to add it to the vip menu but when I compile it it gives me error 035
jorconnn is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-20-2020 , 20:20   Re: error 035: argument type mismatch (argument 2)
Reply With Quote #4

What did you try to add and on what line did you add it? We can't read your mind and it's much easier if you tell exactly what and where the issue occurred to be able to help you more quickly.
__________________

Last edited by fysiks; 09-20-2020 at 20:21.
fysiks is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-20-2020 , 20:28   Re: error 035: argument type mismatch (argument 2)
Reply With Quote #5

Post the line(s) of code that are causing the issue. We need all associated variables/functions too.
__________________
Bugsy is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 09-21-2020 , 12:38   Re: error 035: argument type mismatch (argument 2)
Reply With Quote #6

You're missing an argument. The error is from passing an integer into something that expects a string.

I would assume an error about the number of arguments but the code is probably processed from left to right and the first error that the compiler encounters is what it prints before halting the compilation process.

Code:
/* Registers extra items on this plugin for VIPs (Only if MODE 2 is active) * *  @param name           Extra item name. *  @param discription    Extra item discription (simmilar like zombie class discription). *  @param cost           How much ammo packs will cost this item for player. *  @param team           Teams allowed to buy this item. (0 for all teams) *  @return               Extra item id. */ native zv_register_extra_item(const name[], const discription[], cost, team)

Code:
gl_iItemID = zv_register_extra_item(WEAPON_ITEM_NAME, WEAPON_ITEM_COST, ZV_TEAM_HUMAN);
->
Code:
gl_iItemID = zv_register_extra_item(WEAPON_ITEM_NAME, "Add a very fancy description here...", WEAPON_ITEM_COST, ZV_TEAM_HUMAN);
__________________

Last edited by Black Rose; 09-21-2020 at 12:41.
Black Rose is offline
jorconnn
Junior Member
Join Date: Sep 2020
Old 09-21-2020 , 17:46   Re: error 035: argument type mismatch (argument 2)
Reply With Quote #7

Quote:
Originally Posted by Black Rose View Post
You're missing an argument. The error is from passing an integer into something that expects a string.

I would assume an error about the number of arguments but the code is probably processed from left to right and the first error that the compiler encounters is what it prints before halting the compilation process.

Code:
/* Registers extra items on this plugin for VIPs (Only if MODE 2 is active) * *  @param name           Extra item name. *  @param discription    Extra item discription (simmilar like zombie class discription). *  @param cost           How much ammo packs will cost this item for player. *  @param team           Teams allowed to buy this item. (0 for all teams) *  @return               Extra item id. */ native zv_register_extra_item(const name[], const discription[], cost, team)

Code:
gl_iItemID = zv_register_extra_item(WEAPON_ITEM_NAME, WEAPON_ITEM_COST, ZV_TEAM_HUMAN);
->
Code:
gl_iItemID = zv_register_extra_item(WEAPON_ITEM_NAME, "Add a very fancy description here...", WEAPON_ITEM_COST, ZV_TEAM_HUMAN);
thx it s work
jorconnn is offline
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 22:28.


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