AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=43)
-   -   Need help to locate the foult (https://forums.alliedmods.net/showthread.php?t=272751)

Bers 10-05-2015 16:08

Need help to locate the foult
 
1 Attachment(s)
I need someone to look this one though cant find the foult..
but i kinda need abit of help, so i seems that this code
Code:

// X P90 - Cool colt/p90.
 
/* CVARS - copy and paste to shconfig.cfg
 
//X P90
xpnty_level 10
xpnty_p90mult 1.5              //Multiplier for p90 damage
xpnty_gravity 0.40              //Gravity X P90 has
 
*/
 
 
#include <amxmod>
#include <Vexd_Utilities>
#include <superheromod>
 
// GLOBAL VARIABLES
new gHeroName[]="X P90"
new gHasXpntyPower[SH_MAXSLOTS+1]
//----------------------------------------------------------------------------------------------
public plugin_init()
{
        // Plugin Info
        register_plugin("SUPERHERO X P90", "1.1", "M0L")
 
        register_cvar("xpnty_level", "38")
        register_cvar("xpnty_p90mult", "4.5")
        register_cvar("xpnty_gravity", "0.40")
 
 
        // FIRE THE EVENT TO CREATE THIS SUPERHERO!
        shCreateHero(gHeroName, "P90 Reskin", " Lower Gravity / New P90 skin with unlimited ammo and more damage", false, "xpnty_level")
 
        // REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
        // Init
        register_srvcmd("xpnty_init", "xpnty_init")
        shRegHeroInit(gHeroName, "xpnty_init")
 
        register_event("ResetHUD", "newSpawn", "b")
        register_event("Damage", "xpnty_damage", "b")
        register_event("CurWeapon", "weaponChange", "be", "1=1")
 
        // Let Server know about US Marine's Variable
        shSetMinGravity(gHeroName, "xpnty_gravity")
        shSetShieldRestrict(gHeroName)
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
        precache_model("models/shmod/xpnty_p90.mdl")
}
//----------------------------------------------------------------------------------------------
public xpnty_init()
{
        // First Argument is an id
        new temp[6]
        read_argv(1,temp,5)
        new id = str_to_num(temp)
 
        // 2nd Argument is 0 or 1 depending on whether the id has the hero
        read_argv(2,temp,5)
        new hasPowers = str_to_num(temp)
 
        gHasXpntyPower[id] = (hasPowers != 0)
 
        //Reset thier shield restrict status
        //Shield restrict
        shResetShield(id)
 
        if ( !is_user_alive(id) ) return
 
        if ( gHasXpntyPower[id] ) {
                xpnty_weapons(id)
                switchmodel(id)
        }
        else {
                engclient_cmd(id, "drop", "weapon_p90")
                shRemGravityPower(id)
        }
}
//-----------------------------------------------------------------------------------------------
public newSpawn(id)
{
        if ( gHasXpntyPower[id] && is_user_alive(id) && shModActive() ) {
                set_task(0.1, "xpnty_weapons", id)
 
                new clip, ammo, wpnid = get_user_weapon(id, clip, ammo)
                if ( wpnid != CSW_P90 && wpnid > 0 ) {
                        new wpn[32]
                        get_weaponname(wpnid, wpn, 31)
                        engclient_cmd(id, wpn)
                }
        }
}
//-----------------------------------------------------------------------------------------------
public xpnty_weapons(id)
{
        if ( is_user_alive(id) && shModActive() ) {
                shGiveWeapon(id, "weapon_p90")
        }
}
//-----------------------------------------------------------------------------------------------
public switchmodel(id)
{
        if ( !is_user_alive(id) || !gHasXpntyPower[id] ) return
 
        new clip, ammo, wpnid = get_user_weapon(id, clip, ammo)
        if ( wpnid == CSW_P90 ) {
                // Weapon Model change
                Entvars_Set_String(id, EV_SZ_viewmodel, "models/shmod/xpnty_p90.mdl")
        }
}
//----------------------------------------------------------------------------------------------
public weaponChange(id)
{
        if ( !gHasXpntyPower[id] || !shModActive() ) return
 
        new wpnid = read_data(2)
        new clip = read_data(3)
 
        if ( wpnid != CSW_P90 ) return
 
        switchmodel(id)
 
        // Never Run Out of Ammo!
        if ( clip == 0 ) {
                shReloadAmmo(id)
        }
}
//-----------------------------------------------------------------------------------------------
public xpnty_damage(id)
{
        if ( !shModActive() || !is_user_alive(id) ) return
 
        new damage = read_data(2)
        new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart)
        new headshot = bodypart == 1 ? 1 : 0
 
        if ( attacker <= 0 || attacker > SH_MAXSLOTS ) return
 
        if ( gHasXpntyPower[attacker] && weapon == CSW_P90 && is_user_alive(id) ) {
                // do extra damage
                new extraDamage = floatround(damage * get_cvar_float("xpnty_p90mult") - damage)
                if (extraDamage > 0) shExtraDamage(id, attacker, extraDamage, "p90", headshot)
        }
}
//-----------------------------------------------------------------------------------------------

is not what it seems like, kinda not sure why. i hope someone will look into this one, and help me out.

anon12 10-06-2015 00:45

Re: Need help to locate the foult
 
What's wrong with it?
It compiles fine..

Bers 10-06-2015 03:24

Re: Need help to locate the foult
 
/home/forums/content/files/2/3/0/6/0/2/148600.attach(38) : error 021: symbol already defined: "plugin_init"

1 Error.
Could not locate output file /home/groups/amxmodx/public_html/compiled3/148600.amx (compile failed).

there u go, it does not compile normal.

anon12 10-06-2015 13:18

Re: Need help to locate the foult
 
The error already explained what's wrong. There are 2 plugin_init in your code. You can only have 1.

Bers 10-06-2015 15:30

Re: Need help to locate the foult
 
so ive done and end's up with this.
Quote:

/tmp/texthUzbyL.sma(2) : error 017: undefined symbol "SH_MAXSLOTS"
/tmp/texthUzbyL.sma(4) : error 009: invalid array size (negative or zero)
/tmp/texthUzbyL.sma(7) : error 017: undefined symbol "register_plugin"
/tmp/texthUzbyL.sma(9) : error 017: undefined symbol "register_cvar"
/tmp/texthUzbyL.sma(10) : error 017: undefined symbol "register_cvar"
/tmp/texthUzbyL.sma(11) : error 017: undefined symbol "register_cvar"
/tmp/texthUzbyL.sma(15) : error 017: undefined symbol "shCreateHero"
/tmp/texthUzbyL.sma(19) : error 017: undefined symbol "register_srvcmd"
/tmp/texthUzbyL.sma(20) : error 017: undefined symbol "shRegHeroInit"
/tmp/texthUzbyL.sma(22) : error 017: undefined symbol "register_event"
/tmp/texthUzbyL.sma(23) : error 017: undefined symbol "register_event"
/tmp/texthUzbyL.sma(24) : error 017: undefined symbol "register_event"
/tmp/texthUzbyL.sma(27) : error 017: undefined symbol "shSetMinGravity"
/tmp/texthUzbyL.sma(28) : error 017: undefined symbol "shSetShieldRestrict"
/tmp/texthUzbyL.sma(33) : error 017: undefined symbol "precache_model"
/tmp/texthUzbyL.sma(40) : error 017: undefined symbol "read_argv"
/tmp/texthUzbyL.sma(41) : error 017: undefined symbol "str_to_num"
/tmp/texthUzbyL.sma(44) : error 017: undefined symbol "read_argv"
/tmp/texthUzbyL.sma(45) : error 017: undefined symbol "str_to_num"
/tmp/texthUzbyL.sma(51) : error 017: undefined symbol "shResetShield"
/tmp/texthUzbyL.sma(53) : error 017: undefined symbol "is_user_alive"
/tmp/texthUzbyL.sma(60) : error 017: undefined symbol "engclient_cmd"
/tmp/texthUzbyL.sma(61) : error 017: undefined symbol "shRemGravityPower"
/tmp/texthUzbyL.sma(67) : error 017: undefined symbol "is_user_alive"
/tmp/texthUzbyL.sma(68) : error 017: undefined symbol "set_task"
/tmp/texthUzbyL.sma(70) : error 017: undefined symbol "get_user_weapon"

Bers 10-06-2015 17:26

Re: Need help to locate the foult
 
so ive found the foult... it was register_plugin that was not removed from the start in the code.

thanks anyways


All times are GMT -4. The time now is 03:40.

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