Raised This Month: $32 Target: $400
 8% 

Plugin's commands and hud messages arent shown


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AnimalMonster
Senior Member
Join Date: May 2020
Old 08-02-2020 , 22:48   Plugin's commands and hud messages arent shown
Reply With Quote #1

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

#define PLUGIN "Regular Zombie CSO-LIKE"
#define VERSION "1.0"
#define AUTHOR "DeclineD"

new cooldown[33]
new 
cooldown2[33]
new const 
hp 15000
new const speed 240
new Float:gravity 0.300
new Float:knockback 1.0
new Ready[33]
new 
Ready2[33]
new 
abilityended[33]
new 
abilitystarted[33]
new 
Float:ability1cooldown 20.0
new Float:ability2cooldown 10.0

new g_ent_playermodel[33
new 
regular

new const zombieh[] = { "v_regular.mdl" }
new const 
zombiemodel1[] = { "regularzombie" }
new const 
zombiemodel2[] = { "regularzombiehost"}
new const 
bothmodels[] = { "regularzombie""regularzombiehost" }
new const 
ability1start[] = { "csolike/start.wav" }
new const 
ability2sound[] = { "csolike/ability2.wav" }
new const 
ability1end[] = { "csolike/end.wav" }
new const 
infectsound[] = { "csolike/regularinfect.wav" }
new const 
hit[] = { "csolike/hit1.wav""csolike/hit2.wav"}
new const 
deathsound[] = { "csolike/death1.wav""csolike/death2.wav" }
new const 
health[] = {
    
2000,
    
3000,
    
4000,
    
5000
}

public 
plugin_init() {

    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("+drop","ability1")
    
register_clcmd("+reload","ability2")
    
register_concmd("+drop","ability1")
    
register_concmd("+reload","ability2")
    
RegisterHam(Ham_TakeDamage,"player","dmg")
    
register_event("DeathMsg","death","a")
    
    
regular zp_register_zombie_class("Regular Zombie","\r[\yCSO-LIKE\r] [\yBerserk\r|\yReproduce\r]",bothmodels ,zombieh,hp,speed,gravity,knockback)
    
}
public 
plugin_precache()
{
    
precache_sound(ability1start)
    
precache_sound(ability1end)
    
precache_sound(ability2sound)
    
precache_sound(infectsound)
    
precache_sound(hit)
    
precache_sound(deathsound)
    
precache_model("models/player/regularzombiehost/regularzombiehost.mdl")
    
precache_model("models/player/regularzombie/regularzombie.mdl")
}

public 
ability1(id)
{
    if(
is_user_alive(id) && zp_get_user_zombie(id) && zp_get_user_zombie_class(id) == regular && !zp_get_user_nemesis(id))
    {
        new 
Float:uspeed 1000.0

        
if(Ready[id] == 1)
        {
            
client_cmd(id,"cl_forwardspeed 1600")
            
client_cmd(id,"cl_backspeed 1600")
            
set_user_maxspeed(iduspeed)
            
            
cooldown[id] = 21
            Ready
[id] = 0
            abilitystarted
[id] = 1
            abilityended
[id] = 0
            
            set_task
(ability1cooldown,"ready",id)
        }
        else 
client_print(id,print_chat,"[Ability] Wait 'till ability is ready")
    }
}
public 
ability2(id)
{
    if(
zp_get_user_zombie(id) && zp_get_user_zombie_class(id) == regular && zp_get_user_nemesis(id))
    {
        new 
healthnum
        
        
if(Ready2[id] == 1)
        {
            
healthnum random_num(0,charsmax(health))
            
set_pev(idpev_healthfloat(pev(idpev_health) + health[healthnum]))
            
            
Ready2[id] = 0
        
            emit_sound
(idCHAN_STREAMability1start1.0ATTN_NORM0PITCH_NORM)
    
            
set_task(ability2cooldown,"ready2",id)
        }
        else 
client_print(id,print_chat,"[Ability] Wait 'till ability is ready")
    }
}

public 
hud(id)
{
    if(
Ready[id] == 1)
    {
        
set_hudmessage(17025585, -1.00.8506.00.4,0.1,0.1)
        
show_hudmessage(id"[Berserk - Ready] [G]")
    }

    if(
Ready[id] == 0)
    {
        
set_hudmessage(17025585, -1.00.8506.00.5,0.1,0.1)
        
show_hudmessage(id"[Berserk - %d] [G]",cooldown[id] - 1)
    }
    
    if(
Ready2[id] == 1)
    {
        
set_hudmessage(25500, -1.00.9106.00.4,0.1,0.1)
        
show_hudmessage(id"[Reproduce - Ready] [R]")
    }

    if(
Ready2[id] == 0)
    {
        
set_hudmessage(25500, -1.00.9106.00.4,0.1,0.1)
        
show_hudmessage(id"[Reproduce - %d] [R]",cooldown2[id] - 1)
    }
    
    if(
abilityended[id] == 1)
    {
        
abilityended[id] = 0
        emit_sound
(idCHAN_STREAMability1end1.0ATTN_NORM0PITCH_NORM)
    }
}
public 
ready(id)
{
    
Ready[id] = 1
    abilityended
[id] = 1
    abilitystarted
[id] = 0
}
public 
ready2(id)
{
    
Ready2[id] = 1
}
public 
death(id)
{
    if(
is_user_alive(id) && zp_get_user_zombie(id) && zp_get_user_zombie_class(id) == regular && !zp_get_user_nemesis(id))
    {
        
emit_sound(idCHAN_STREAMdeathsound1.0ATTN_NORM0PITCH_NORM)
    }
}
    
public 
zp_user_infected_post(id)
{
    if(
zp_get_user_zombie_class(id) == regular && zp_get_user_zombie(id) && zp_get_user_nemesis(id))
    {    
        if(
zp_get_user_first_zombie(id))
        {
            
fm_set_playermodel_ent(id,zombiemodel2,0)
        }
        else 
fm_set_playermodel_ent(id,zombiemodel1,0)
    
        
Ready[id] = 1
        Ready2
[id] = 1
    
        set_task
(0.5,"hud",id,_,_,"b")
        
emit_sound(id,CHAN_STREAM,infectsound,1.0,ATTN_NORM,0,PITCH_NORM)
    }
}

public 
dmg(victiminflictoridFloat:damagedamagebits)
{
    new 
Zombie[33]
    new class[
33]
    new 
Human[33]

    
Zombie[id] = zp_get_user_zombie(id)
    
Human[id] = !zp_get_user_zombie(id)
    class[
id] = zp_get_user_zombie_class(id) == regular
    
    
if(Zombie[id] == inflictor && class[id])
    {
        if(
abilityended[id] == 0)
        {
            
SetHamParamFloat(4,damage 2.0)
        }
        else if(
abilityended[id] == 1)
        {
            
SetHamParamFloat(4,damage 1.0)
        }
        
    }
    
    if(
Human[id] == inflictor)
    {    
            
emit_sound(id,CHAN_STREAM,hit,1.0,ATTN_NORM,0,PITCH_NORM)
    }
}

stock fm_set_rendering(entityfx kRenderFxNone255255255render kRenderNormalamount 16)
{
    static 
Float:color[3]
    
color[0] = float(r)
    
color[1] = float(g)
    
color[2] = float(b)
    
    
set_pev(entitypev_renderfxfx)
    
set_pev(entitypev_rendercolorcolor)
    
set_pev(entitypev_rendermoderender)
    
set_pev(entitypev_renderamtfloat(amount))
}
stock fm_set_playermodel_ent(id, const modelname[],anim

    
fm_set_rendering(idkRenderFxNone255255255kRenderTransTexture1)
    
    static 
modelpath[100
    
formatex(modelpathsizeof modelpath 1"models/player/%s/%s.mdl"modelnamemodelname
    
    if (!
pev_valid(g_ent_playermodel[id]))
    { 
        
g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target")) 
        
        if (!
pev_valid(g_ent_playermodel[id])) return
        
        
set_pev(g_ent_playermodel[id], pev_classname"regular_classname"
        
set_pev(g_ent_playermodel[id], pev_movetypeMOVETYPE_FOLLOW
        
set_pev(g_ent_playermodel[id], pev_aimentid)
        
set_pev(g_ent_playermodel[id], pev_animtimeget_gametime()+0.1)
        
set_pev(g_ent_playermodel[id], pev_framerate1.0)
        
set_pev(g_ent_playermodel[id], pev_sequenceanim)
        
set_pev(g_ent_playermodel[id], pev_ownerid
        
    } 
    
    
engfunc(EngFunc_SetModelg_ent_playermodel[id], modelpath

idk what to do now, i even upgraded to amxx 1.8.3... but nothing

SO
the plugin's commands doesn t work idk why and the plugin's hud messages aren t shown.
The code seems to be fine but when i try use it doesn't work,
I want to mention that im using zp 4.3 patched from moddb , i will try use zp 4.3 fix5a instead to see if that s the problem

Last edited by AnimalMonster; 08-03-2020 at 00:17.
AnimalMonster is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-03-2020 , 00:54   Re: Plugin's commands and hud messages arent shown
Reply With Quote #2

Here's what I do when I debug code.
Print EVERYTHING
Code:
public ability1(id) {     server_print("ability1() called, id: %d", id)     server_print("is_user_alive(id): %s", is_user_alive(id) ? "true" : "false");     server_print("zp_get_user_zombie(id): %s", zp_get_user_zombie(id) ? "true" : "false");     server_print("zp_get_user_zombie_class(id) == regular: %s", zp_get_user_zombie(id) == regular ? "true" : "false");     server_print("zp_get_user_nemesis(id): %s", zp_get_user_nemesis(id) ? "true" : "false");     server_print("Ready[id]: %d", Ready[id]);     if(is_user_alive(id) && zp_get_user_zombie(id) && zp_get_user_zombie_class(id) == regular && !zp_get_user_nemesis(id))     {         new Float:uspeed = 1000.0         if(Ready[id] == 1)         {             client_cmd(id,"cl_forwardspeed 1600")             client_cmd(id,"cl_backspeed 1600")             set_user_maxspeed(id, uspeed)                         cooldown[id] = 21             Ready[id] = 0             abilitystarted[id] = 1             abilityended[id] = 0                         set_task(ability1cooldown,"ready",id)         }         else client_print(id,print_chat,"[Ability] Wait 'till ability is ready")     } }
__________________
Black Rose is offline
AnimalMonster
Senior Member
Join Date: May 2020
Old 08-03-2020 , 04:08   Re: Plugin's commands and hud messages arent shown
Reply With Quote #3

Quote:
Originally Posted by Black Rose View Post
Here's what I do when I debug code.
Print EVERYTHING
Code:
public ability1(id) {     server_print("ability1() called, id: %d", id)     server_print("is_user_alive(id): %s", is_user_alive(id) ? "true" : "false");     server_print("zp_get_user_zombie(id): %s", zp_get_user_zombie(id) ? "true" : "false");     server_print("zp_get_user_zombie_class(id) == regular: %s", zp_get_user_zombie(id) == regular ? "true" : "false");     server_print("zp_get_user_nemesis(id): %s", zp_get_user_nemesis(id) ? "true" : "false");     server_print("Ready[id]: %d", Ready[id]);     if(is_user_alive(id) && zp_get_user_zombie(id) && zp_get_user_zombie_class(id) == regular && !zp_get_user_nemesis(id))     {         new Float:uspeed = 1000.0         if(Ready[id] == 1)         {             client_cmd(id,"cl_forwardspeed 1600")             client_cmd(id,"cl_backspeed 1600")             set_user_maxspeed(id, uspeed)                         cooldown[id] = 21             Ready[id] = 0             abilitystarted[id] = 1             abilityended[id] = 0                         set_task(ability1cooldown,"ready",id)         }         else client_print(id,print_chat,"[Ability] Wait 'till ability is ready")     } }
Thx imma try
Edit: didn't even call the function wtf, nothing in my server console aka. Console with bots

Last edited by AnimalMonster; 08-03-2020 at 04:19.
AnimalMonster is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-03-2020 , 04:53   Re: Plugin's commands and hud messages arent shown
Reply With Quote #4

I'm guessing you can't hook +reaload and +drop. I'm generally a server side programmer, I know very little of the engine itself.

Reload:
Quote:
Originally Posted by Bugsy View Post
If you only care about the button press then this will work:
PHP Code:

#include <amxmodx>
#include <fakemeta>

public plugin_init() 
{
    
register_forwardFM_CmdStart "CmdStart" );
}

public 
CmdStartid uc_handle seed 
{
    static 
Buttons OldButtons;
    
    
Buttons get_ucuc_handle UC_Buttons );
    
OldButtons pevid pev_oldbuttons );
    
    if ( !( 
OldButtons IN_RELOAD ) && ( Buttons IN_RELOAD ) )
    {
        
//Reload pressed
    
}
    else if ( ( 
OldButtons IN_RELOAD ) && !( Buttons IN_RELOAD ) )
    {
        
//Reload released
    
}

Not sure about drop.

Look at other plugins you know of that are hooking those buttons and see how they do it.
__________________

Last edited by Black Rose; 08-03-2020 at 04:54.
Black Rose is offline
AnimalMonster
Senior Member
Join Date: May 2020
Old 08-03-2020 , 05:32   Re: Plugin's commands and hud messages arent shown
Reply With Quote #5

Quote:
Originally Posted by Black Rose View Post
Look at other plugins you know of that are hooking those buttons and see how they do it.
i already did, i did it as a sma smilar to mine but made by HoRRoR

and now watching this sma
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

#define heal_sound        "heal.wav"

new const zclass_name[] = "Heal"
new const zclass_info[] = "Zombie"
new const zclass_model[] = "heal"
new const zclass_clawmodel[] = "v_heal_knife.mdl"
const zclass_health 4500
const zclass_speed 250
const Float:zclass_gravity 0.8
const Float:zclass_knockback 0.0

new g_zclass_heal;
new 
Float:last_use[33];

public 
plugin_init()
{
    
register_plugin("[ZP] Zombie Class: Heal Zombie""0.1""WPMG Team")
    
register_clcmd("drop""use_skill")
}

public 
plugin_precache()
{
    
g_zclass_heal zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)

    
precache_sound(heal_sound)
}

public 
zp_user_infected_post(idinfector)
{
    if(
zp_get_user_zombie_class(id) == g_zclass_heal)
    {
        
client_printcolor(id"^4[ZP] ^1Press ^4^"G^" ^1for cure all your health.")
        
last_use[id] = 0.0
    
}
}

public 
use_skill(id)
{
    if(
is_user_alive(id) && !zp_get_user_nemesis(id) && zp_get_user_zombie(id) && (zp_get_user_zombie_class(id) == g_zclass_heal))
    {
        if((
pev(idpev_health) < float(zp_get_zombie_maxhealth(id))) && (last_use[id] + 20.0 <= get_gametime()))
        {
            
last_use[id] = get_gametime();

            
set_pev(idpev_healthfloat(zp_get_zombie_maxhealth(id)))
            
emit_sound(idCHAN_ITEMheal_sound1.0ATTN_NORM0PITCH_NORM)

            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("ScreenFade"), { 00}, id)
            
write_short(1<<10)
            
write_short(1<<12)
            
write_short(0x0000
            
write_byte(50
            
write_byte(150)    
            
write_byte(50
            
write_byte(200)
            
message_end()

            return 
PLUGIN_HANDLED;
        }
    }
    return 
PLUGIN_CONTINUE;
}

stock client_printcolor(const id, const input[], any:...)
{
    new 
iCount 1iPlayers[32]
    static 
szMsg[191]

    
vformat(szMsgcharsmax(szMsg), input3)
    
replace_all(szMsg190"/g""^4")
    
replace_all(szMsg190"/y""^1")
    
replace_all(szMsg190"/t""^3")
    
replace_all(szMsg190"/w""^0")

    if(
idiPlayers[0] = id
    
else get_players(iPlayersiCount"ch")

    for(new 
0iCounti++)
    {
        if(
is_user_connected(iPlayers[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _iPlayers[i])
            
write_byte(iPlayers[i])
            
write_string(szMsg)
            
message_end()
        }
    }

and yeah, you're right afterall, can't hook on +drop or +reload or i think that on any +<command> since i tested and with drop works perfectly. but with + drop nope.

Edit : What About hUdMeSSaGes?

Nevermind , imma go code another things then try again code zombies..

Last edited by AnimalMonster; 08-03-2020 at 06:39.
AnimalMonster is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 08-03-2020 , 07:46   Re: Plugin's commands and hud messages arent shown
Reply With Quote #6

There is no "+drop" command. You can hook "drop" just fine. You can't hook client-side commands like +"reload".
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
ZaX
Senior Member
Join Date: Jan 2015
Old 08-03-2020 , 10:20   Re: Plugin's commands and hud messages arent shown
Reply With Quote #7

Code:
 if(zp_get_user_zombie_class(id) == regular && zp_get_user_zombie(id) && zp_get_user_nemesis(id))
I believe you want to check here if user has the zombie class and he is a zombie. OR has the zombie class and he is nemesis.
this code above checks if user has the zombie class AND he is a zombie AND he is nemesis. All of them must be true to execute the function

Last edited by ZaX; 08-03-2020 at 10:21.
ZaX is offline
AnimalMonster
Senior Member
Join Date: May 2020
Old 08-03-2020 , 13:22   Re: Plugin's commands and hud messages arent shown
Reply With Quote #8

Quote:
Originally Posted by ZaX View Post
Code:
 if(zp_get_user_zombie_class(id) == regular && zp_get_user_zombie(id) && zp_get_user_nemesis(id))
I believe you want to check here if user has the zombie class and he is a zombie. OR has the zombie class and he is nemesis.
this code above checks if user has the zombie class AND he is a zombie AND he is nemesis. All of them must be true to execute the function
Already tried but didn't work , the sane was for the plugin from HoRRoR
+ as @ocixcrom said

Last edited by AnimalMonster; 08-03-2020 at 14:08.
AnimalMonster is offline
AnimalMonster
Senior Member
Join Date: May 2020
Old 08-03-2020 , 14:14   Re: Plugin's commands and hud messages arent shown
Reply With Quote #9

Quote:
Originally Posted by OciXCrom View Post
There is no "+drop" command. You can hook "drop" just fine. You can't hook client-side commands like +"reload".
Btw , there is no way to hook on buttons with every command?
I mean to hook on g even if it has +use for example

Edit: i know woth engine but i found only with IN_RELOAD but something like IN_DROP nope



Edit2: i have an idea what if i use client_command to detect if the client used the +drop command??

Last edited by AnimalMonster; 08-03-2020 at 14:47.
AnimalMonster is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 08-03-2020 , 16:02   Re: Plugin's commands and hud messages arent shown
Reply With Quote #10

Like I said, there is no +drop command. It's a single action command and it's just "drop". And no, you can't hook buttons. IN_RELOAD isn't the R button, it's the +reload command.
__________________

Last edited by OciXCrom; 08-03-2020 at 16:03.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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 04:36.


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