AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need help with this plugin (https://forums.alliedmods.net/showthread.php?t=48655)

godlike 12-17-2006 09:06

Need help with this plugin
 
hej , Mateo10 made this plugin for me i requested it. Its called santa mod. everyone will have a santa model and a machine gun .(machine gun is also a custom model) the terror team has a red glow and the ct team got a blue glow. They are suposed to have 250hp,200AP and double speed but the only thing that works is the glow thing with the terrorist team.This is the code that mateo made for me. Can someone helpme plz.

Code:

#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <fun>

new g_PlayerModel[] = "models/christmas_santa.mdl"
new g_WeaponVModel[] = "models/santa_v_m249.mdl"
new g_WeaponWModel[] = "models/santa_w_m249.mdl"
new g_RoundStartSound[] = "sound/hohoho.wav"

new g_Switch, g_BulletSpeed

public plugin_init() {
    register_plugin("Christmas Santa", "0.1", "MaTTe")
   
    g_Switch = register_cvar("cs_enable", "1")
    g_BulletSpeed = register_cvar("cs_bulletspeed", "450")
   
    register_event("CurWeapon", "switch_weaponmodel", "b", "CSW_M249")
    register_event("HLTV", "round_start", "a", "1=0", "2=0")
    register_event("ResetHUD", "switch_playermodel", "be")
    register_logevent("round_end", 2, "1=Round_End")
}

public round_start(id) {
    emit_sound(0, CHAN_AUTO, g_RoundStartSound, 1.0, ATTN_NORM, 0, PITCH_NORM)
    santa(id)
}

public santa(id) {
    if(!get_pcvar_num(g_Switch))
        return PLUGIN_HANDLED
       
    set_user_health(id, 250)
    set_user_armor(id, 200)
   
    if((pev(id, pev_button) & IN_ATTACK)) {
        bullet_slowdown(id)
    }
    return PLUGIN_CONTINUE
}

public bullet_slowdown(id) {
    new clipTemp, ammoTemp, wpnid = get_user_weapon(id, clipTemp, ammoTemp)
    if(wpnid==CSW_HEGRENADE || wpnid==CSW_SMOKEGRENADE || wpnid==CSW_C4 || wpnid==CSW_FLASHBANG
    || wpnid==CSW_KNIFE || wpnid==CSW_VEST || wpnid==CSW_VESTHELM)
        return PLUGIN_HANDLED

   
    new Float:viewOfs[3], Float:vOrigin[3], Float:vAngle[3]
    pev(id, pev_origin, vOrigin)
    pev(id, pev_view_ofs, viewOfs)

    vOrigin[0] += viewOfs[0]
    vOrigin[1] += viewOfs[1]
    vOrigin[2] += viewOfs[2]

    pev(id, pev_v_angle, vAngle)

    vOrigin[0] += ( floatcos(vAngle[1], degrees) * floatcos(vAngle[0], degrees) ) * 26.0
    vOrigin[1] += ( floatsin(vAngle[1], degrees) * floatcos(vAngle[0], degrees) ) * 26.0
    vOrigin[2] += ( floatsin(vAngle[0], degrees) * -1.0 ) * 26.0

    vAngle[0] *= -1.0

    new NewEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
    set_pev(NewEnt, pev_classname, "santaBullet")

    set_pev(NewEnt, pev_flags, wpnid)
    engfunc(EngFunc_SetModel, NewEnt, "models/shell.mdl")

    new Float:VecMins[3] = {-1.0, -1.0, -1.0}
    new Float:VecMaxs[3] = {1.0, 1.0, 1.0}
    set_pev(NewEnt, pev_mins, VecMins)
    set_pev(NewEnt, pev_maxs, VecMaxs)

    engfunc(EngFunc_SetOrigin, NewEnt, vOrigin)
    set_pev(NewEnt, pev_angles, vAngle)

    set_pev(NewEnt, pev_solid, SOLID_BBOX)
    set_pev(NewEnt, pev_movetype, MOVETYPE_FLY)
    set_pev(NewEnt, pev_owner, id)

    new Float:fNewVelocity[3]
    velocity_by_aim(id, get_pcvar_num(g_BulletSpeed), fNewVelocity)

    set_pev(NewEnt, pev_velocity, fNewVelocity)
    return PLUGIN_CONTINUE
}

public switch_playermodel(id) {
    new team[32]
    get_user_team(id, team, 31)
   
    if(equal(team, "TERRORIST")) {
        cs_set_user_model(id, g_PlayerModel)
        set_user_rendering(id, kRenderFxGlowShell, 155, 0, 0, kRenderGlow, 155)
    } else if(equal(team, "COUNTER_TERRORIST")) {
        cs_set_user_model(id, g_PlayerModel)
        set_user_rendering(id, kRenderFxGlowShell, 0, 0, 155, kRenderGlow, 155)
    }
}

public switch_weaponmodel(id) {
    new wpnid, clip, ammo = get_user_weapon(id, clip, ammo)
    if(wpnid==CSW_M249) {
        set_pev(id, pev_viewmodel2, g_WeaponVModel)
        set_pev(id, pev_viewmodel2, g_WeaponWModel)
    }
}

public plugin_precache() {
    precache_model(g_PlayerModel)
    precache_model(g_WeaponWModel)
    precache_model(g_WeaponVModel)
    precache_sound(g_RoundStartSound)
}


jim_yang 12-17-2006 09:19

Re: Need help with this plugin
 
round_start(id) <-----
//no id passed here.

round_start() {
get_players
then loop
}

godlike 12-17-2006 09:24

Re: Need help with this plugin
 
Code:


public round_start() {
    get_players
    emit_sound(0, CHAN_AUTO, g_RoundStartSound, 1.0, ATTN_NORM, 0,PITCH_NORM)
    santa(id)
}

Like this?

jim_yang 12-17-2006 09:30

Re: Need help with this plugin
 
Code:

new players[32],num,player
get_players(players, num)
for(new i=0; i<num; i++)
{
    player = players[i]
    emit_sound(player, ...
    santa(player)
}


godlike 12-17-2006 09:34

Re: Need help with this plugin
 
thx im totally noob in scripting.

godlike 12-17-2006 10:28

Re: Need help with this plugin
 
still the same old problem ...

jim_yang 12-17-2006 10:32

Re: Need help with this plugin
 
register_event("CurWeapon", "switch_weaponmodel", "b", "CSW_M249")
to
register_event("CurWeapon", "switch_weaponmodel", "b", "1=1","2=20")

jim_yang 12-17-2006 10:34

Re: Need help with this plugin
 
if((pev(id, pev_button) & IN_ATTACK)) {
bullet_slowdown(id)
}
should in FM_PlayerPreThink forward
basiclly this script need rewriting

godlike 12-17-2006 12:42

Re: Need help with this plugin
 
hmmm. What do you mean with rewriting?

[ --<-@ ] Black Rose 12-17-2006 18:19

Re: Need help with this plugin
 
The plugin needs to be redone.
Change everything/Start from scratch.


All times are GMT -4. The time now is 08:01.

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