Raised This Month: $ Target: $400
 0% 

Zombie Ghost Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Merlin2010
Junior Member
Join Date: Apr 2013
Old 07-08-2014 , 11:15   Zombie Ghost Problem
Reply With Quote #1

I added to my server the Ghost Class.I took it from an old addons,so i can't post in original thread because i don't know if the thread it's here.

Can anybody help me?



PHP Code:
L 07/08/2014 21:07:23: [ZPInvalid Player (0)
L 07/08/2014 21:07:23: [AMXXDisplaying debug trace (plugin "zp_zcls_ghost.amxx")
L 07/08/2014 21:07:23: [AMXXRun time error 10native error (native "zp_get_user_zombie_class")
L 07/08/2014 21:07:23: [AMXX]    [0zp_zcls_ghost.sma::zp_user_infected_post (line 163

PHP Code:
#include <amxmodx>
#include <fun>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>
#include <engine>

#define PLUGIN "[ZP] Class - Ghost"
#define VERSION "1.3"
#define AUTHOR "HoRRoR, Fry!"

// Zombie Attributes
new g_zclass_ghost
new const zclass_name[] = "Ghost" // name
new const zclass_info[] = "- Can be invisible" // description
new const zclass_model[] = "ghost" // model
new const zclass_clawmodel[] = "v_knife_ghost.mdl" // claw model
const zclass_health 3300 // health
const zclass_speed 265 // speed
const Float:zclass_gravity 0.75 // gravity
const Float:zclass_knockback 1.5// knockback

new i_stealth_time_hud[33]
new 
g_cooldown[33]
new 
g_infections[33]
new 
Float:g_stealth_time[33]
new 
i_cooldown_time[33]
new 
g_maxplayers

// --- config ------------------------ //
new Float:g_stealth_time_standart 5.0 //first stealth time
new Float:g_stealth_cooldown_standart 45.0 //cooldown time
new const sound_ghost_stealth[] = "zombie_plague/spells/zombie_ghost/stealth.wav" //stealth sound
new const sound_ghost_stealth_end[] = "zombie_plague/spells/zombie_ghost/end_stealth.wav" //end stealth sound
// ----------------------------------- //



public plugin_init()
{    
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_cvar("zp_zclass_ghost_zombie",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
    
register_clcmd("ability1""use_ability_one")
    
register_concmd("ability1""use_ability_one")
    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink")
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
register_logevent("roundStart"2"1=Round_Start")
    
g_maxplayers get_maxplayers()
}

public 
plugin_precache()
{
    
g_zclass_ghost zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)
    
precache_sound(sound_ghost_stealth)
    
precache_sound(sound_ghost_stealth_end)
}

public 
roundStart()
{
    for (new 
1<= g_maxplayersi++)
    {
        
i_cooldown_time[i] = floatround(g_stealth_cooldown_standart)
        
g_cooldown[i] = 0
        remove_task
(i)
    }
}

public 
use_ability_one(id)
{
    if(
is_valid_ent(id) && is_user_alive(id) && zp_get_user_zombie(id) && !zp_get_user_nemesis(id) && zp_get_user_zombie_class(id) == g_zclass_ghost)
    {
        if(
g_cooldown[id] == 0)
        {
            
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha0)
            
emit_sound(idCHAN_STREAMsound_ghost_stealth1.0ATTN_NORM0PITCH_NORM)
            
set_task(g_stealth_time[id],"ghost_make_visible",id)
            
set_task(g_stealth_cooldown_standart,"reset_cooldown",id)
            
g_cooldown[id] = 1
            
            i_cooldown_time
[id] = floatround(g_stealth_cooldown_standart)
            
i_stealth_time_hud[id] = floatround(g_stealth_time[id])
            
            
set_task(1.0"ShowHUD"id__"a",i_cooldown_time[id])
            
set_task(1.0"ShowHUDstealthes"id__"a",i_stealth_time_hud[id])
        }
    }
}


public 
ShowHUD(id)
{
    if(
is_valid_ent(id) && is_user_alive(id))
    {
        
i_cooldown_time[id] = i_cooldown_time[id] - 1;
        
set_hudmessage(20010000.750.9201.01.10.00.0, -1)
        
show_hudmessage(id"Stealth cooldown: %d",i_cooldown_time[id])
    }else{
        
remove_task(id)
    }
}

public 
ShowHUDstealthes(id)
{
    if(
is_valid_ent(id) && is_user_alive(id))
    {
        
i_stealth_time_hud[id] = i_stealth_time_hud[id] - 1;
        
set_hudmessage(2001000, -1.00.9201.01.10.00.0, -1)
        
show_hudmessage(id"Stealth time: %d",i_stealth_time_hud[id])
    }else{
        
remove_task(id)
    }
}

public 
ghost_make_visible(id)
{
    if(
is_valid_ent(id) && zp_get_user_zombie(id) && !zp_get_user_nemesis(id) && zp_get_user_zombie_class(id) == g_zclass_ghost)
    {
        
set_user_rendering(idkRenderFxHologram000kRenderTransAlpha125)
        
emit_sound(idCHAN_STREAMsound_ghost_stealth_end1.0ATTN_NORM0PITCH_NORM)
    }
}

public 
reset_cooldown(id)
{
    if(
is_valid_ent(id) && zp_get_user_zombie(id) && !zp_get_user_nemesis(id) && zp_get_user_zombie_class(id) == g_zclass_ghost)
    {
        
g_cooldown[id] = 0
        
        
new text[100]
        
format(text,99,"^x04[ZombiMod.Com]^x01 Your ability ^x04Stealth^x01 is ready.")
        
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id
        
write_byte(id
        
write_string(text
        
message_end()
    }
}

public 
zp_user_infected_post(idinfector)
{
    if ((
zp_get_user_zombie_class(id) == g_zclass_ghost) && !zp_get_user_nemesis(id))
    {
        
set_user_rendering(idkRenderFxHologram000kRenderTransAlpha125)
        
        new 
text[100]
        new 
note_cooldown floatround(g_stealth_cooldown_standart)
        new 
note_stealthtime floatround(g_stealth_time_standart)
        
format(text,99,"^x04[ZombiMod.Com]^x01 Your ability is ^x04Stealth^x01. Cooldown:^x04 %d ^x01seconds. Stealth time: ^x04%d^x01 seconds.",note_cooldown,note_stealthtime)
        
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id
        
write_byte(id
        
write_string(text
        
message_end()
        
        
i_cooldown_time[id] = floatround(g_stealth_cooldown_standart)
        
remove_task(id)
        
        
g_stealth_time[id] = g_stealth_time_standart
        g_cooldown
[id] = 0
        g_infections
[id] = 0
        
        client_cmd
(id,"bind F1 ability1")
    }
    
    if((
zp_get_user_zombie_class(infector) == g_zclass_ghost) && !zp_get_user_nemesis(infector))
    {
        
g_stealth_time[infector] = g_stealth_time[infector] + 1;
        
infections_hud(infector)
    }
}

public 
infections_hud(id)
{
    if(
is_valid_ent(id) && zp_get_user_zombie(id) && !zp_get_user_nemesis(id) && zp_get_user_zombie_class(id) == g_zclass_ghost)
    {
        new 
i_stealth_time floatround(g_stealth_time[id])
        new 
text[100]
        
format(text,99,"^x04[ZombiMod.Com]^x01 Your stealth time is^x04 %d ^x01seconds.",i_stealth_time)
        
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id
        
write_byte(id
        
write_string(text
        
message_end() 
    }
}

public 
zp_user_humanized_post(id)
{
    
set_user_rendering(idkRenderFxNone000kRenderTransAlpha255)
    
remove_task(id)
}

public 
zp_user_unfrozen(id)
{
    if(
is_valid_ent(id) && is_user_alive(id) && zp_get_user_zombie(id) && !zp_get_user_nemesis(id) && zp_get_user_zombie_class(id) == g_zclass_ghost)
    {
        
set_user_rendering(idkRenderFxHologram000kRenderTransAlpha125)
    }
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    if (!(
damage_type DMG_FALL) || !zp_get_user_zombie(victim) || zp_get_user_zombie_class(victim) != g_zclass_ghost)
        return 
HAM_IGNORED
    
    SetHamParamFloat
(40.0)
    return 
HAM_HANDLED
}

public 
fw_PlayerPreThink(player)
{
    if(!
is_user_alive(player))
        return 
FMRES_IGNORED
        
    
if(zp_get_user_zombie(player) && zp_get_user_zombie_class(player) == g_zclass_ghost)
        
set_pev(playerpev_flTimeStepSound999)
        
    return 
FMRES_IGNORED
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/ 
Merlin2010 is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Vińa del Mar, Chile
Old 07-08-2014 , 13:41   Re: Zombie Ghost Problem
Reply With Quote #2

PHP Code:
if(infector && (zp_get_user_zombie_class(infector) == g_zclass_ghost) && !zp_get_user_nemesis(infector)) 
"infector" would not be always a player id. What about if you get infected by console? Where's the "infector" player id? Some things that you need to ask you before coding something.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
Merlin2010
Junior Member
Join Date: Apr 2013
Old 07-09-2014 , 04:00   Re: Zombie Ghost Problem
Reply With Quote #3

so what i need to do?i don't understand...i'm from romania,i'm not very good with english
i want only to dissappear that error...to get infected like the other plugins...the zombie hit you till you have 0 armor then u get infected...i don't understand what you mean with infected by console
Merlin2010 is offline
Mario AR.
Senior Member
Join Date: May 2011
Location: Lima, Perú
Old 07-09-2014 , 04:42   Re: Zombie Ghost Problem
Reply With Quote #4

Quote:
Originally Posted by meTaLiCroSS View Post
PHP Code:
if(infector && (zp_get_user_zombie_class(infector) == g_zclass_ghost) && !zp_get_user_nemesis(infector)) 
"infector" would not be always a player id. What about if you get infected by console? Where's the "infector" player id? Some things that you need to ask you before coding something.
He meant that the infector could be something else than a player, so you must validate the player.
PHP Code:
if((<= infector <= 32) && (zp_get_user_zombie_class(infector) == g_zclass_ghost) && !zp_get_user_nemesis(infector)) 
Mario AR. is offline
Merlin2010
Junior Member
Join Date: Apr 2013
Old 07-09-2014 , 05:16   Re: Zombie Ghost Problem
Reply With Quote #5

so i change this

PHP Code:
if ((zp_get_user_zombie_class(id) == g_zclass_ghost) && !zp_get_user_nemesis(id)) 
with this
PHP Code:
if((<= infector <= 32) && (zp_get_user_zombie_class(infector) == g_zclass_ghost) && !zp_get_user_nemesis(infector)) 
??
Merlin2010 is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 07-09-2014 , 07:34   Re: Zombie Ghost Problem
Reply With Quote #6

That's what they're saying, yes.
mottzi is offline
Send a message via MSN to mottzi
Merlin2010
Junior Member
Join Date: Apr 2013
Old 07-09-2014 , 13:38   Re: Zombie Ghost Problem
Reply With Quote #7

no changes,still get the same error
Merlin2010 is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 07-09-2014 , 16:43   Re: Zombie Ghost Problem
Reply With Quote #8

PHP Code:
if (!is_user_connected(id))
{
  return;

__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Merlin2010
Junior Member
Join Date: Apr 2013
Old 07-10-2014 , 05:16   Re: Zombie Ghost Problem
Reply With Quote #9

can you give me the right sma?i dont know what to change with this...i'm not good with scripting...


Quote:
Originally Posted by claudiuhks View Post
PHP Code:
if (!is_user_connected(id))
{
  return;

Merlin2010 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-10-2014 , 05:56   Re: Zombie Ghost Problem
Reply With Quote #10

You are in Scripting Help, which means that you can script. If you do not know where to put that, why are you seeking Scripting Help?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
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 21:04.


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