Monthly Target: $400 Donations: $289
 72% 

Phoenix (VIP)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DJ Fox
BANNED
Join Date: Jun 2010
Old 04-07-2012 , 08:31   Phoenix (VIP)
Reply With Quote #1

First Good morning / Good afternoon / Good Night

I encontri the hero sasuke here on the forum and saw that it was only for those who have access to flasg who could use it, I found this enteressante and try to make the hero (PHOENIX) except that it did not work out, what went wrong in script?


# Include <amxmod>
# Include <amxmisc>
# Include <Vexd_Utilities>
# Include <superheromod>

g_heroName new [] = "Phoenix \ y (\ rVIP \ y) \ w"
new bool: g_hasPhoenix [SH_MAXSLOTS +1]
new bool: g_phoenixPowerUsed [SH_MAXSLOTS +1]
new bool: g_betweenRounds
new g_userTeam [SH_MAXSLOTS +1]
new bool: gHasPowers [SH_MAXSLOTS +1]
new bool: gSelected [SH_MAXSLOTS +1]
new g_savedOrigin [SH_MAXSLOTS +1] [3]
new g_lastPosition [SH_MAXSLOTS +1] [3]
new g_spriteSmoke, g_spriteRing, g_spriteExplosion
/ / ------------------------------------------------ ----------------------------------------------
public plugin_init ()
{
/ / Plugin Info
register_plugin ("SUPERHERO Phoenix", "1.1", "[FTW]-SWAT / Vittu")

/ / DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
register_cvar ("phoenix_level", "8")
register_cvar ("phoenix_adminflag", "h");
register_cvar ("phoenix_cooldown", "120")
register_cvar ("phoenix_radius", "375")
register_cvar ("phoenix_maxdamage", "90")

/ / FIRE THE EVENT TO CREATE THIS SUPERHERO!
shCreateHero (g_heroName, "\ yRenascer the ashes," "How the Phoenix you should raise their burning ashes." false, "phoenix_level")

/ / REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
/ / INIT
register_srvcmd ("phoenix_init", "phoenix_init")
shRegHeroInit (g_heroName, "phoenix_init")

/ / DEATH EVENT
register_event ("DeathMsg", "phoenix_death", "a")

/ / ROUND EVENTS
register_logevent ("round_start," 2 "= 1 Round_Start")
register_logevent ("round_end," 2 "= 1 Round_End")
register_logevent ("round_end", 2 "& 1 Restart_Round_")
}
/ / ------------------------------------------------ ----------------------------------------------
public plugin_precache ()
{
g_spriteSmoke precache_model = ("sprites/steam1.spr")
g_spriteRing precache_model = ("sprites / white.spr")
g_spriteExplosion precache_model = ("sprites/explode1.spr")
precache_sound ("ambience/port_suckin1.wav")
precache_sound ("ambience/3dmeagle.wav")
}
/ / ------------------------------------------------ ----------------------------------------------
public phoenix_init ()
{
/ / If (! Cmd_access (id, level, cid, 0) && (get_cvar_num ("phoenix_adminonly") == 1))
/ / Return PLUGIN_HANDLED;

new temp [6];
read_argv (1, temp, 5);

new id = str_to_num (temp);
read_argv (2, temp, 5);
hasPowers str_to_num = new (temp);
gHasPowers [id] = (hasPowers! = 0);

gSelected [id] = gHasPowers [id];

if (is_user_connected (id)) {
if (hasPowers) {
phoenix_admincheck (id);
}

}

set_task (1.0, "phoenix_loop", 0, "", 0, "b");

return PLUGIN_HANDLED;
}
-------------------------------------------------- ------------------------------------------------
public phoenix_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)
hasPowers str_to_num = new (temp)

g_hasPhoenix [id] = (hasPowers! = 0)
}
/ / ------------------------------------------------ ----------------------------------------------
public phoenix_death ()
{
if (! shModActive () | | g_betweenRounds) return

id = read_data new (second)

if (! is_user_connected (id) | |! g_hasPhoenix [id]) return

g_userTeam [id] = get_user_team (id)

/ / Save users origin on death
get_user_origin (id, g_savedOrigin [id])
g_savedOrigin [id] [2] + 8 =

/ / Look for self to raise from dead
if (! is_user_alive (id) &&! g_phoenixPowerUsed [id]) {
new parm [1]
parm [0] = id
/ / Respawn it faster then Zues, let this power be used before Zues's
/ / September never higher or lower then 1.9 then 0.5
set_task (0.6, "phoenix_respawn", 0, parm, 1)
}
}
/ / ------------------------------------------------ ----------------------------------------------
public phoenix_respawn (parm [])
{
new id = parm [0]

if (! is_user_connected (id) | | is_user_alive (id)) return
if (g_phoenixPowerUsed [id] | | g_betweenRounds) return
if (g_userTeam [id]! get_user_team = (id)) return / / prevents respawning spectators

emit_sound (id, CHAN_STATIC, "ambience/port_suckin1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)

client_print (id, print_chat, "[SH] (Phoenix) You used to power the Phoenix from the Ashes Rise Again!")

/ / Prevents the Double spawn glitch in HUD
user_spawn (id)
user_spawn (id)

/ / Respawned by Phoenix, it's ok to set cooldown now.
new Float: = phoenixCooldown get_cvar_float ("phoenix_cooldown")
if (phoenixCooldown> 0.0) {
set_task (phoenixCooldown, "enable_phoenix", id)
g_phoenixPowerUsed [id] = true
}

emit_sound (id, CHAN_STATIC, "ambience/3dmeagle.wav", 0.6, ATTN_NORM, 0, PITCH_NORM)

shGlow (id, 248, 20, 25)
set_task (3.0, "phoenix_unglow", 0, parm, 1)
set_task (1.0, "phoenix_teamcheck", 0, parm, 1)

set_user_health (ID 75)
phoenix_teleport (id)
}
/ / ------------------------------------------------ ----------------------------------------------
public phoenix_unglow (parm [])
{
new id = parm [0]
shUnglow (id)
}
/ / ------------------------------------------------ ----------------------------------------------
public phoenix_teamcheck (parm [])
{
new id = parm [0]

if (g_userTeam [id]! get_user_team = (id)) {
client_print (id, print_chat, "[SH] (Phoenix) You changed teams and used Phoenix Respawn, now you Shall die")

user_kill (id, 1)

/ / Stop Until Phoenix from respawning round ends
remove_task (id)
g_phoenixPowerUsed [id] = false
}
}
/ / ------------------------------------------------ ----------------------------------------------
public round_start ()
{
g_betweenRounds = false
}
/ / ------------------------------------------------ ----------------------------------------------
public round_end ()
{
if (! shModActive ()) return

g_betweenRounds = true

/ / Reset the cooldown on round end, to start fresh for a new round
for (new id = 1; id <= SH_MAXSLOTS; id + +) {
if (g_hasPhoenix [id]) {
/ / Reset the cooldown on round end, to start fresh for a new round
remove_task (id)
g_phoenixPowerUsed [id] = false
}
}
}
/ / ------------------------------------------------ ----------------------------------------------
public enable_phoenix (id)
{
g_phoenixPowerUsed [id] = false
}
/ / ------------------------------------------------ ----------------------------------------------
public phoenix_teleport (id)
{
/ / Teleport the player
set_user_origin (id, g_savedOrigin [id])

/ / Teleport Effects
message_begin (MSG_BROADCAST, SVC_TEMPENTITY)
write_byte (11) / / TE_TELEPORT
write_coord (g_savedOrigin [id] [0]) / / start position
write_coord (g_savedOrigin [id] [1])
write_coord (g_savedOrigin [id] [2])
message_end ()

positionChangeTimer (id)

Blowup (id)
}
/ / ------------------------------------------------ ----------------------------------------------
public positionChangeTimer (id)
{
if (! is_user_alive (id)) return

get_user_origin (id, g_lastPosition [id])

new Float: velocity [3]
Entvars_Get_Vector (id, EV_VEC_velocity, velocity)

if (velocity [0] == 0.0 && velocity [1] == 0.0) {
/ / Force a Move (small jump)
velocity [0] + = 20.0
velocity [2] + = 100.0
Entvars_Set_Vector (id, EV_VEC_velocity, velocity)
}

set_task (0.4, "positionChangeCheck", id +100)
}
/ / ------------------------------------------------ ----------------------------------------------
public positionChangeCheck (id)
{
id - = 100

if (! is_user_alive (id)) return

new origin [3]
get_user_origin (id, origin)

/ / Kill this player if Stuck in Wall!
if (g_lastPosition [id] [0] == origin [0] && g_lastPosition [id] [1] == origin [1] && g_lastPosition [id] [2] == origin [2] && is_user_alive (id)) {
user_kill (id, 1)
client_print (id, print_chat, "[SH] (Phoenix) You Were Killed for Being stuck in the wall")
}
}
/ / ------------------------------------------------ ----------------------------------------------
public Blowup (id)
{
new Float: DRatio, damage, distanceBetween
new origin [3], origin1 [3], name [32]
new dmgRadius = get_cvar_num ("phoenix_radius")
new MaxDamage = get_cvar_num ("phoenix_maxdamage")
new FFOn = get_cvar_num ("mp_friendlyfire")

get_user_origin (id, origin)

get_user_name (id, name, 31)

/ / Blowup even if dead
explode_effect (origin, dmgRadius)

is (a = new one, a <= SH_MAXSLOTS; to + +) {
if (is_user_alive (a) && a! = id && (get_user_team (id)! get_user_team = (a) | | FFOn)) {

get_user_origin (a, origin1)

distanceBetween get_distance = (origin, origin1)

if (distanceBetween <dmgRadius) {
set_hudmessage (248, 20, 25, 0.05, 0.65, 2, 0.02, 3.0, 0.01, 0.1, 85)
show_hudmessage (a, "% s Re-Born was using the power of the Phoenix", name)

DRatio = float (distanceBetween) / float (dmgRadius)
damage = MaxDamage - floatround (MaxDamage DRatio *)
shExtraDamage (a, id, damage, "Phoenix Re-Birth")
}
}
}
}
/ / ------------------------------------------------ ----------------------------------------------
public explode_effect (vec1 [3], dmgRadius)
{
/ / Ring
message_begin (MSG_BROADCAST, SVC_TEMPENTITY, vec1)
write_byte (21) / / TE_BEAMCYLINDER
write_coord (vec1 [0]) / / center position
write_coord (vec1 [1])
write_coord (vec1 [2] + 10)
write_coord (vec1 [0]) / / axis and radius
write_coord (vec1 [1])
write_coord (vec1 [2] + floatround (dmgRadius * 3.5))
write_short (g_spriteRing) / / sprite index
write_byte (0) / / frame starting
write_byte (0) / / frame rate in 0.1 's
write_byte (2) / / life in 0.1 's
write_byte (20) / / line width in 0.1 's
write_byte (0) / / noise amplitude in 12:01's
write_byte (24 / / color
write_byte (20)
write_byte (25)
write_byte (255) / / brightness
write_byte (0) / / scroll speed in 0.1 's
message_end ()

/ / Explosion2
message_begin (MSG_BROADCAST, SVC_TEMPENTITY)
write_byte (12) / / TE_EXPLOSION2
write_coord (vec1 [0]) / / start position
write_coord (vec1 [1])
write_coord (vec1 [2])
write_byte (18 / / starting color
write_byte (10) / / in colors
message_end ()

/ / Explosion
message_begin (MSG_BROADCAST, SVC_TEMPENTITY, vec1)
write_byte (3) / / TE_EXPLOSION
write_coord (vec1 [0]) / / start position
write_coord (vec1 [1])
write_coord (vec1 [2])
write_short (g_spriteExplosion) / / sprite index
write_byte (dmgRadius / 9) / / scale in 0.1 's
write_byte (10) / / framerate
write_byte (0) / / flags
message_end ()

/ / Smoke
message_begin (MSG_BROADCAST, SVC_TEMPENTITY, vec1)
write_byte (5) / / TE_SMOKE
write_coord (vec1 [0]) / / start position
write_coord (vec1 [1])
write_coord (vec1 [2])
write_short (g_spriteSmoke) / / sprite index
write_byte (dmgRadius/14) / / scale in 0.1 's
write_byte (10) / / framerate
message_end ()
}
/ / ------------------------------------------------ ----------------------------------------------
public phoenix_admincheck (id) {
new accessLevel [10];
get_cvar_string ("phoenix_adminflag" accessLevel, 9);
/ / Trim (accessLevel);
console_print (1, "% s", accessLevel);
if (accessLevel [0]! = '0 ') {
if (gSelected [id] &&! (get_user_flags (id) & read_flags (accessLevel))) {
client_print (id, print_chat, "[SH] You do not have access to this command, Type More information / vip chat." gHeroName)
gHasPowers [id] = false;
client_cmd (id, "say drop% s", gHeroName);

}
}
DJ Fox is offline
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 04-08-2012 , 06:38   Re: Phoenix (VIP)
Reply With Quote #2

If you want to restrict a hero to only be used by people with a certain access flag, use G-Dog's awesome plugin instead:

http://forums.alliedmods.net/showthread.php?t=172501

Delete the "custom access flag restriction code" you added to the hero and simply use the simple plugin!

P.S: If you want people to look at the code you post it's much easier to read if you wrap it in
PHP Code:
php 
or
Code:
code
tags.
__________________

Last edited by The Art of War; 04-08-2012 at 06:38.
The Art of War is offline
DJ Fox
BANNED
Join Date: Jun 2010
Old 04-09-2012 , 13:49   Re: Phoenix (VIP)
Reply With Quote #3

thank you !
DJ Fox is offline
Reply


Thread Tools
Display Modes

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 09:01.


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