Author
|
Message
|
Junior Member
|
03-07-2006
, 09:57
Max Level Code
|
#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)
}
}
//----------------------------------------------------------------------------------------------
|
|
|
|
|