Hello,
Well, I haven't really scripted anything recently and as such I might have made some beginnermistakes (though I am still a beginner so I guess it's understandable).
What I am trying to do, is to add teamglow to this hero with a playermodel, but I keep getting argument type mismatch when I compile.
Sorry for having such a messy code, I originally just had an AWP hero called Captain AWP which was based on the template that I had for weaponheroes which was called Spas12 and then I decided to add a playermodel and healing so I ripped from Wolverine.... bleh.
Here are the errors:
Code:
// F:\Misc\scripting\sh_scream.sma(57) : error 035: argument type mismatch
(argument 4)
// F:\Misc\scripting\sh_scream.sma(82) : error 035: argument type mismatch
(argument 4)
//
Here it is. The errors are on both lines where I use set_task, so obviously I fail at setting tasks. They are in sh_hero_init and sh_client_spawn.
PHP Code:
//Spas 12
#include <superheromod>
// offsets
const m_pPlayer = 41
const XTRA_OFS_WEAPON = 4
// GLOBAL VARIABLES
new gHeroID
new bool:gHasSpas[SH_MAXSLOTS+1]
new gPcvarHealPoints
new const gScreamPlayer[] = "models/player/scream/scream.mdl"
new const gModelAwp[] = "models/shmod/captainawp_v_awp.mdl"
new const gModelAwp2[] = "models/shmod/captainawp_p_awp.mdl"
//----------------------------------------------------------------------------------------------
public plugin_init()
{
//Plugin info
register_plugin("SUPERHERO Scream", "2.1", "Exploited")
// DO NOT EDIT THIS FILE TO CHANGE THE CVARS, USE THE SHCONFIG.CFG
new pcvarLevel = register_cvar("scream_level", "18")
new pcvarM3Speed = register_cvar("scream_speed", "1000")
new pcvarM3Mult = register_cvar("scream_awpmult", "2.0")
gPcvarHealPoints = register_cvar("scream_healpoints", "10")
//FIRE THE EVENT TO CREATE THIS SUPERHERO
gHeroID = sh_create_hero("Scream", pcvarLevel)
sh_set_hero_info(gHeroID, "Scream", "Get a free AWP with increased damage and speed, also get a player model")
sh_set_hero_speed(gHeroID, pcvarM3Speed, {CSW_AWP})
sh_set_hero_dmgmult(gHeroID, pcvarM3Mult, CSW_AWP)
// REGISTER EVENTS THIS HERO WILL RESPOND TO!
register_event("CurWeapon", "weapon_change", "be", "2=18")
RegisterHam(Ham_Item_Deploy, "weapon_awp", "Ham_awp_Deploy_Post", 1)
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
precache_model(gModelAwp)
precache_model(gModelAwp2)
precache_model(gScreamPlayer)
}
//----------------------------------------------------------------------------------------------
public sh_hero_init(id, heroID, mode)
{
if ( gHeroID != heroID ) return
switch(mode)
{
case SH_HERO_ADD:
{
gHasSpas[id] = true
spas_weapons(id)
hero_morph(id)
set_task(1.0, "wolv_loop", _, id, 1, "b")
if ( get_user_weapon(id) == CSW_AWP )
{
switchmodel(id)
}
}
case SH_HERO_DROP:
{
gHasSpas[id] = false
hero_unmorph(id)
if ( is_user_alive(id) )
{
sh_drop_weapon(id, CSW_AWP, true)
}
}
}
}
//----------------------------------------------------------------------------------------------
public sh_client_spawn(id)
{
if ( gHasSpas[id] )
{
spas_weapons(id)
hero_morph(id)
set_task(1.0, "wolv_loop", _, id, _, "b")
}
}
//----------------------------------------------------------------------------------------------
spas_weapons(id)
{
if ( sh_is_active() && is_user_alive(id) && gHasSpas[id] )
{
sh_give_weapon(id, CSW_AWP)
}
}
//----------------------------------------------------------------------------------------------
public weapon_change(id)
{
if ( !sh_is_active() || !gHasSpas[id] ) return
// Never Run Out of Ammo!
//clip = read_data(3)
if (read_data(3) == 0)
{
sh_reload_ammo(id, 1)
}
}
//----------------------------------------------------------------------------------------------
public Ham_awp_Deploy_Post(const weapon_ent)
{
static owner
owner = get_pdata_cbase(weapon_ent, m_pPlayer, XTRA_OFS_WEAPON)
switchmodel(owner)
}
//----------------------------------------------------------------------------------------------
switchmodel(id)
{
if ( !sh_is_active() || !is_user_alive(id) || !gHasSpas[id] ) return
set_pev(id, pev_viewmodel2, gModelAwp)
set_pev(id, pev_weaponmodel2, gModelAwp2)
}
//----------------------------------------------------------------------------------------------
public wolv_loop(id)
{
if ( !sh_is_active() ) return
static players[SH_MAXSLOTS], playerCount, player, i
get_players(players, playerCount, "ah")
if ( gHasSpas[id] && is_user_alive(id) )
{
switch(cs_get_user_team(id))
{
case CS_TEAM_T: shGlow(id, 100, 0, 0)
case CS_TEAM_CT: shGlow(id, 0, 0, 100)
}
}
for ( i = 0; i < playerCount; i++ ) {
player = players[i]
if ( gHasSpas[player] ) {
sh_add_hp(player, get_pcvar_num(gPcvarHealPoints))
}
}
}
//----------------------------------------------------------------------------------------------
hero_morph(id)
{
cs_set_user_model(id, "scream")
}
//----------------------------------------------------------------------------------------------
hero_unmorph(id)
{
cs_reset_user_model(id)
}
//----------------------------------------------------------------------------------------------
Thanks,
Exploited
__________________