Junior Member
|
06-06-2006
, 14:24
Error on Null
|
#1
|
Well... i have a bug with the admin only plugin in my hero .... The hero should be for admin only but its a bug , if you choose the hero 5 times one behind the other you can choose it , though he isnt an admin
heres the admin only code
Code:
//----------------------------------------------------------------------------------------------
public Null_admincheck(id)
{
new accessLevel[10]
get_cvar_string("Null_adminflag", accessLevel, 9)
if ( gNullSelected[id] && !(get_user_flags(id)&read_flags(accessLevel)) ) {
client_print(id, print_chat, "[DX]m(%s) you don`t buy this artificate heroy", gHeroName)
gHasNullPower[id] = false
client_cmd(id, "say drop %s", gHeroName)
}
}
//----------------------------------------------------------------------------------------------
and if you need all:
Code:
// Null By Trance
/* CVARS - copy and paste to shconfig.cfg
//Null
Null_level 0
Null_teamglow 1 //Glow Team Color when player skin in use (0=no 1=yes)
Null_scoutmult 1 //Damage multiplyer for his P90
Null_health 100 //Default 100 (no extra health)
Null_armor 100 //Default 100
Null_gravity 1.0 //Default 1.0 = no extra gravity (0.50 is 50% normal gravity, ect.)
Null_speed -1 //Default -1 = no extra speed, this cvar is for all weapons (for faster then normal speed set to 321 or higher)
Null_adminflag a // Admin flag required to use this hero (Default a = ADMIN_IMMUNITY)
*/
#include <amxmod>
#include <vexd_utilities>
#include <superheromod>
// GLOBAL VARIABLES
new gHeroName[]="Null (Admin Only)"
new bool:gHasNullPower[SH_MAXSLOTS+1]
new bool:gNullSelected[SH_MAXSLOTS+1]
new bool:gmorphed[SH_MAXSLOTS+1]
new gIsInvisible[SH_MAXSLOTS+1]
new gStillTime[SH_MAXSLOTS+1]
//----------------------------------------------------------------------------------------------
public plugin_init()
{
// Plugin Info
register_plugin("SUPERHERO Null (Admin Only)", "1.4", "Dong")
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
register_cvar("Null_level", "0")
register_cvar("Null_teamglow", "1")
register_cvar("Null_scoutmult", "1")
register_cvar("Null_health", "100")
register_cvar("Null_armor", "100")
register_cvar("Null_gravity", "1.0")
register_cvar("Null_speed", "-1")
register_cvar("Null_adminflag", "a")
register_cvar("Null_alpha", "50")
register_cvar("Null_delay", "5")
register_cvar("Null_checkmove", "1")
// FIRE THE EVENT TO CREATE THIS SUPERHERO!
shCreateHero(gHeroName, "Artificate Model", "More damage on scout/jump Hight/more Hp", false, "Null_level")
// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
// INIT
register_srvcmd("Null_init", "Null_init")
shRegHeroInit(gHeroName, "Null_init")
// EVENTS
register_event("ResetHUD", "newSpawn", "b")
register_event("CurWeapon", "weaponChange", "be", "1=1")
register_event("Damage", "Null_damage", "b", "2!0")
register_event("DeathMsg", "Null_death", "a")
// CHECK SOME BUTTONS
set_task(0.1,"checkButtons",0,"",0,"b")
// Let Server know about Master Chief's Variables
shSetShieldRestrict(gHeroName)
shSetMaxHealth(gHeroName, "Null_health")
shSetMaxArmor(gHeroName, "Null_armor")
shSetMinGravity(gHeroName, "Null_gravity")
shSetMaxSpeed(gHeroName, "Null_speed", "[0]")
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
precache_model("models/player/Null/Null1.mdl")
precache_model("models/shmod/Null_v_scout.mdl")
}
//----------------------------------------------------------------------------------------------
public Null_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)
if (!is_user_connected(id)) return
//Reset thier shield restrict status
//Shield restrict MUST be before weapons are given out
shResetShield(id)
gHasNullPower[id] = (hasPowers != 0)
gNullSelected[id] = gHasNullPower[id]
//Give Powers to the Invisible Man
if ( !gHasNullPower[id] ) remInvisibility(id)
if ( gHasNullPower[id] && is_user_connected(id) ) {
Null_admincheck(id)
Null_weapons(id)
switchmodel(id)
Null_tasks(id)
}
//This gets run if they had the power but don't anymore
else if ( !hasPowers && gHasNullPower[id] ) {
engclient_cmd(id, "drop", "weapon_scout")
Null_unmorph(id)
shRemHealthPower(id)
shRemArmorPower(id)
shRemGravityPower(id)
shRemSpeedPower(id)
}
//Sets this variable to the current status
gHasNullPower[id] = (hasPowers != 0)
}
//----------------------------------------------------------------------------------------------
public newRound(id)
{
remInvisibility(id)
}
//----------------------------------------------------------------------------------------------
public setInvisibility(id, alpha)
{
if (alpha < 125) {
set_user_rendering(id,kRenderFxGlowShell,8,8,8,kRenderTransAlpha,alpha)
}
else {
set_user_rendering(id,kRenderFxNone,0,0,0,kRenderTransAlpha,alpha)
}
}
//----------------------------------------------------------------------------------------------
public remInvisibility(id)
{
gStillTime[id] = -1
if (gIsInvisible[id] > 0) {
shUnglow(id)
client_print(id,print_center,"[FoF]Null: You are no longer cloaked")
}
gIsInvisible[id] = 0
}
//----------------------------------------------------------------------------------------------
public checkButtons()
{
if ( !hasRoundStarted() || !shModActive()) return
new bool:setVisible
new butnprs
for(new id = 1; id <= SH_MAXSLOTS; id++) {
if (!is_user_alive(id) || !gHasNullPower[id]) continue
setVisible = false
butnprs = Entvars_Get_Int(id, EV_INT_button)
//Always check these
if (butnprs&IN_ATTACK || butnprs&IN_ATTACK2 || butnprs&IN_RELOAD || butnprs&IN_USE) setVisible = true
//Only check these if invisman_checkmove is off
if ( get_cvar_num("Null_checkmove") ) {
if (butnprs&IN_JUMP) setVisible = true
if (butnprs&IN_FORWARD || butnprs&IN_BACK || butnprs&IN_LEFT || butnprs&IN_RIGHT) setVisible = true
if (butnprs&IN_MOVELEFT || butnprs&IN_MOVERIGHT) setVisible = true
}
if (setVisible) remInvisibility(id)
else {
new sysTime = get_systime()
new delay = get_cvar_num("Null_delay")
if ( gStillTime[id] < 0 ) {
gStillTime[id] = sysTime
}
if ( sysTime - delay >= gStillTime[id] ) {
if (gIsInvisible[id] != 100) client_print(id,print_center,"[FoF]Null: 100%s cloaked", "%")
gIsInvisible[id] = 100
setInvisibility(id, get_cvar_num("Null_alpha"))
}
else if ( sysTime > gStillTime[id] ) {
new alpha = get_cvar_num("invisman_alpha")
new Float:prcnt = float(sysTime - gStillTime[id]) / float(delay)
new rPercent = floatround(prcnt * 100)
alpha = floatround(255 - ((255 - alpha) * prcnt) )
client_print(id,print_center,"[FoF]Null: %d%s cloaked", rPercent, "%")
gIsInvisible[id] = rPercent
setInvisibility(id, alpha)
}
}
}
}
//----------------------------------------------------------------------------------------------
public newSpawn(id)
{
if ( gHasNullPower[id] && is_user_alive(id) && shModActive() ) {
set_task(0.1, "Null_admincheck", id)
set_task(0.1, "Null_weapons", id)
Null_tasks(id)
new clip, ammo, wpnid = get_user_weapon(id, clip, ammo)
if (wpnid != CSW_SCOUT && wpnid > 0) {
new wpn[32]
get_weaponname(wpnid, wpn, 31)
engclient_cmd(id, wpn)
}
}
}
//----------------------------------------------------------------------------------------------
public Null_tasks(id)
{
set_task(1.0, "Null_morph", id)
if( get_cvar_num("Null_teamglow") ){
set_task(1.0, "Null_glow", id+100, "", 0, "b")
}
}
//----------------------------------------------------------------------------------------------
public switchmodel(id)
{
if ( !is_user_alive(id) ) return
new clip, ammo, wpnid = get_user_weapon(id, clip, ammo)
if (wpnid == CSW_SCOUT) {
// Weapon Model change thanks to [CCC]Taz-Devil
Entvars_Set_String(id, EV_SZ_viewmodel, "models/shmod/Null_v_scout.mdl")
}
}
//----------------------------------------------------------------------------------------------
public Null_weapons(id)
{
if ( is_user_alive(id) ) {
shGiveWeapon(id, "weapon_scout")
}
}
//----------------------------------------------------------------------------------------------
public weaponChange(id)
{
if ( !gHasNullPower[id] || !shModActive() ) return
new wpnid = read_data(2)
new clip = read_data(3)
if ( wpnid != CSW_SCOUT ) return
switchmodel(id)
// Never Run Out of Ammo!
if ( clip == 0 ) {
shReloadAmmo(id)
}
}
//----------------------------------------------------------------------------------------------
public Null_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 ( gHasNullPower[attacker] && weapon == CSW_SCOUT && is_user_alive(id) ) {
// do extra damage
new extraDamage = floatround(damage * get_cvar_float("Null_scoutmult") - damage)
if (extraDamage > 0) shExtraDamage(id, attacker, extraDamage, "scout", headshot)
if (!shModActive() || !gHasNullPower[id] ) return
remInvisibility(id)
}
}
//----------------------------------------------------------------------------------------------
public Null_morph(id)
{
if ( gmorphed[id] || !is_user_alive(id) ) return
#if defined AMXX_VERSION
cs_set_user_model(id, "Null")
#else
CS_SetModel(id, "Null")
#endif
// Message
set_hudmessage(50, 205, 50, -1.0, 0.40, 2, 0.02, 4.0, 0.01, 0.1, 7)
show_hudmessage(id, "Null - Activated")
gmorphed[id] = true
}
//----------------------------------------------------------------------------------------------
public Null_unmorph(id)
{
if ( gmorphed[id] ) {
// Message
set_hudmessage(50, 205, 50, -1.0, 0.40, 2, 0.02, 4.0, 0.01, 0.1, 7)
show_hudmessage(id, "Null - Deactivated")
#if defined AMXX_VERSION
cs_reset_user_model(id)
#else
CS_ClearModel(id)
#endif
gmorphed[id] = false
if ( get_cvar_num("Null_teamglow") ) {
remove_task(id+100)
set_user_rendering(id)
}
}
}
//----------------------------------------------------------------------------------------------
public Null_glow(id)
{
id -= 100
if ( !is_user_connected(id) ) {
//Don't want any left over residuals
remove_task(id+100)
return
}
if ( gHasNullPower[id] && is_user_alive(id) ) {
if ( get_user_team(id) == 1 ) {
shGlow(id, 100, 0, 0)
}
else {
shGlow(id, 0, 0, 100)
}
}
}
//----------------------------------------------------------------------------------------------
public Null_death()
{
new id = read_data(2)
// In case server does not allow drop alive check on death
Null_admincheck(id)
if ( !gHasNullPower[id] ) return
Null_unmorph(id)
}
//----------------------------------------------------------------------------------------------
public client_connect(id)
{
gmorphed[id] = false
}
//----------------------------------------------------------------------------------------------
public Null_admincheck(id)
{
new accessLevel[10]
get_cvar_string("Null_adminflag", accessLevel, 9)
if ( gNullSelected[id] && !(get_user_flags(id)&read_flags(accessLevel)) ) {
client_print(id, print_chat, "[DX]m(%s) you don`t buy this artificate heroy", gHeroName)
gHasNullPower[id] = false
client_cmd(id, "say drop %s", gHeroName)
}
}
//----------------------------------------------------------------------------------------------
Ahh and if you are very nice ... there are some compilation errors
THX a lot for help
|
|