Raised This Month: $51 Target: $400
 12% 

Max Level Code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lilxshadow
Junior Member
Join Date: Feb 2006
Old 03-07-2006 , 09:57   Max Level Code
Reply With Quote #1

Can someone help me fix this code because when i add the max level part, the max level wont work

Quote:
// PUNISHER! - Unlimited Ammo

/* CVARS - copy and paste to shconfig.cfg

//Punisher
punisher_level 0
punisher_dropwpn 0 //Should clinet be forced to drop thier weapon?

*/

#include <amxmod>
#include <superheromod>

// GLOBAL VARIABLES
new gHeroName[]="Punisher"
new gPlayerLevels[SH_MAXSLOTS+1]
new bool:gHasPunisherPowers[SH_MAXSLOTS+1]
new gHaspunisherSelected[SH_MAXSLOTS+1]
new gHaspunisherPower[SH_MAXSLOTS+1]

//----------------------------------------------------------------------------------------------
public plugin_init()
{
// Plugin Info
register_plugin("SUPERHERO Punisher","1.18","{HOJ} Batman")

// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
register_cvar("punisher_level", "0" )
register_cvar("punisher_dropwpn", "0" )
register_cvar("punisher_maxlevel", "15")

// FIRE THE EVENT TO CREATE THIS SUPERHERO!
shCreateHero(gHeroName, "Unlimited Ammo", "Endless Bullets. No Reload! Keep Shooting", false, "punisher_level" )

// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
register_srvcmd("punisher_init", "punisher_init")
shRegHeroInit(gHeroName, "punisher_init")
// LEVELS
register_srvcmd("punisher_levels", "punisher_levels")
shRegLevels(gHeroName,"punisher_levels")
// Punisher Test
register_event("CurWeapon","changeWeapon","be ","1=1")

}
//----------------------------------------------------------------------------------------------
public punisher_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 wolverine skills
read_argv(2,temp,5)
new hasPowers=str_to_num(temp)
gHaspunisherSelected[id] = gHaspunisherPower[id]
gHasPunisherPowers[id] = (hasPowers!=0)
}
//----------------------------------------------------------------------------------------------
public changeWeapon(id)
{
if ( !gHasPunisherPowers[id] || !shModActive() ) return

new wpnid = read_data(2)
new clip = read_data(3)

if ( wpnid == CSW_C4 || wpnid == CSW_KNIFE ) return
if ( wpnid == CSW_HEGRENADE || wpnid == CSW_SMOKEGRENADE || wpnid == CSW_FLASHBANG) return

if ( clip == 0 ) {
shReloadAmmo(id, get_cvar_num("punisher_dropwpn"))
}
}
//----------------------------------------------------------------------------------------------
public punisher_levels()
{
new id[5]
new lev[5]

read_argv(1,id,4)
read_argv(2,lev,4)

gPlayerLevels[str_to_num(id)] = str_to_num(lev)

punisher_checklevel(str_to_num(id))
}
//----------------------------------------------------------------------------------------------
public punisher_checklevel(id)
{
new punisher_maxlvl = get_cvar_num("punisher_maxlevel")
if (gHaspunisherSelected[id] && gPlayerLevels[id] > punisher_maxlvl) {
client_print(id,print_chat, "[SH](%s) You must be level %d or lower to use this hero",gHeroName,punisher_maxlvl)
gHaspunisherPower[id] = false
client_cmd(id,"say drop %s",gHeroName)
}

}
//----------------------------------------------------------------------------------------------
lilxshadow is offline
G-Dog
Senior Member
Join Date: Dec 2005
Location: Thunderstorm Central
Old 03-07-2006 , 14:17  
Reply With Quote #2

ok why do u have
Code:
new gHaspunisherPower[SH_MAXSLOTS+1]
when u already have
Code:
new bool:gHasPunisherPowers[SH_MAXSLOTS+1]
in the code? the reason its not workin is u never defined your added gHaspunisherPower so instead drop that line completely and go down and change the 2 places(in the public punisher_checklevel) where it says
Code:
gHaspunisherPower
to
Code:
gHasPunisherPowers
__________________
If at first you don't succeed, then skydiving isn't for you.
G-Dog is offline
Send a message via AIM to G-Dog
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 02:16.


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