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

ZM Class Admin Only


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tedaimlocks
Member
Join Date: Jan 2024
Old 03-08-2024 , 13:02   ZM Class Admin Only
Reply With Quote #1

May anyone help me make this for only a flag ( ADMIN_LEVEL_D) ?

I know its zp user infected but i tried several times and failed.

PHP Code:
public zp_user_infected_post(idinfector)
{
    if (
zp_get_user_zombie_class(id) == g_cerberus)
    {
        
client_print(idprint_chat"[SPK ZM] [Ability: %d Fury | Cooldown: 1 round]"get_pcvar_num(cvar_fury))
        
        
g_veces[id] = get_pcvar_num(cvar_fury)
        
i_fury_time[id] = get_pcvar_num(cvar_furytime)
        
emit_sound(idCHAN_STREAMidle1.0ATTN_NORM0PITCH_HIGH)
        
remove_task(id)
    }

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

#define ID_FURY (taskid - TASK_FURY)

// Task offsets
enum (+= 100)
{
    
TASK_FURY
}

/*================================================================================
 [Customizations]
=================================================================================*/

// Zombie Attributes
new const zclass10_name[] = { "Cerberus Dog"}
new const 
zclass10_info[] = { "You have a fury" }
new const 
zclass10_model[] = { "Cerberus_frk_14" }
new const 
zclass10_clawmodel[] = { "v_doghands.mdl" }

const 
zclass10_health 1200
const zclass10_speed 275

const Float:zclass10_gravity 0.8
const Float:zclass10_knockback 0.5

new const idle[] = "zombie_plague/cerberus_idle.wav"
new const fury[] = "zombie_plague/cerberus_fury.wav"
new const normaly[] = "zombie_plague/cerberus_normaly.wav"

/*================================================================================
 Customization ends here!
 Any edits will be your responsibility
=================================================================================*/  

// Plugin info.
#define PLUGIN "[ZP] Zombie Class: Cerberus Dog"
#define VERSION "0.1"
#define AUTHOR "DJHD!"

// Variables
new g_cerberusg_veces[33], i_fury_time[33], g_maxplayers

// Cvar Pointers
new cvar_furycvar_furytime

/*================================================================================
 [Init, CFG and Precache]
=================================================================================*/

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
cvar_fury register_cvar("zp_cerberus_fury""1")
    
cvar_furytime register_cvar("zp_cerberus_fury_time""30„.0")
    
    static 
szCvar[30]
    
formatex(szCvarcharsmax(szCvar), "v%s by %s"VERSIONAUTHOR)
    
register_cvar("zp_zclass_cerberus"szCvarFCVAR_SERVER|FCVAR_SPONLY)
    
    
register_logevent("roundStart"2"1=Round_Start")
    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink")
    
    
g_maxplayers get_maxplayers()
}

public 
plugin_precache()
{
    
g_cerberus zp_register_zombie_class(zclass10_namezclass10_infozclass10_modelzclass10_clawmodelzclass10_healthzclass10_speedzclass10_gravityzclass10_knockback)
    
    
precache_sound(idle)
    
precache_sound(fury)
    
precache_sound(normaly)
}

/*================================================================================
 [Zombie Plague Forwards]
=================================================================================*/

public zp_user_infected_post(idinfector)
{
    if (
zp_get_user_zombie_class(id) == g_cerberus)
    {
        
client_print(idprint_chat"[SPK ZM] [Ability: %d Fury | Cooldown: 1 round]"get_pcvar_num(cvar_fury))
        
        
g_veces[id] = get_pcvar_num(cvar_fury)
        
i_fury_time[id] = get_pcvar_num(cvar_furytime)
        
emit_sound(idCHAN_STREAMidle1.0ATTN_NORM0PITCH_HIGH)
        
remove_task(id)
    }
}

public 
zp_user_humanized_post(taskid)
{
    new 
id ID_FURY
    remove_task
(id+TASK_FURY)
    
set_user_godmode(id0)
}


/*================================================================================
 [Main Forwards]
=================================================================================*/

public fw_PlayerPreThink(id)
{
    if (!
is_user_alive(id))
        return 
FMRES_IGNORED
    
    
new button get_user_button(id)
    new 
oldbutton get_user_oldbutton(id)
    
    if (
zp_get_user_zombie(id) && (zp_get_user_zombie_class(id) == g_cerberus))
    {
        if (!(
oldbutton IN_RELOAD) && (button IN_RELOAD))
            
clcmd_furia(id)
    }
    
    return 
PLUGIN_CONTINUE
}

/*================================================================================
 [Internal Functions]
=================================================================================*/

public clcmd_furia(taskid)
{
    new 
id ID_FURY
    
    
if(!is_user_alive(id) || !is_user_connected(id)|| !zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_zombie_class(id) != g_cerberus)
        return 
PLUGIN_HANDLED
    
    
if(g_veces[id] > 0)
    {
        
g_veces[id] = g_veces[id] -1
        
        set_task
(0.1"effects"id+TASK_FURY__"b")
        
i_fury_time[id] = get_pcvar_num(cvar_furytime)
        
        
set_task(1.0"ShowHUD"id+TASK_FURY__"a"i_fury_time[id])
        
        
emit_sound(idCHAN_STREAMfury1.0ATTN_NORM0PITCH_HIGH)
    }
    else
    {
        return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_HANDLED
}

public 
effects(id)
{
    if(!
is_user_alive(id) || !is_user_connected(id)|| !zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_zombie_class(id) != g_cerberus)
        return
        
    static 
origin[3]
    
get_user_origin(idorigin)
    
    
message_begin(MSG_PVSSVC_TEMPENTITYorigin)
    
write_byte(TE_PARTICLEBURST// TE id
    
write_coord(origin[0]) // x
    
write_coord(origin[1]) // y
    
write_coord(origin[2]) // z
    
write_short(130// radius
    
write_byte(70// color
    
write_byte(3// duration (will be randomized a bit)
    
message_end()
    
    
message_begin(MSG_PVSSVC_TEMPENTITYorigin)
    
write_byte(TE_DLIGHT// TE id
    
write_coord(origin[0]) // x
    
write_coord(origin[1]) // y
    
write_coord(origin[2]) // z
    
write_byte(22// radius
    
write_byte(255// r
    
write_byte(0// g
    
write_byte(30// b
    
write_byte(2// life
    
write_byte(0// decay rate
    
message_end()
    
    
set_user_godmode(id1)
    
    
set_task(get_pcvar_float(cvar_furytime), "remove_fury"id)
}

public 
ShowHUD(id)
{
    if(
is_user_alive(id))
    {
        
i_fury_time[id] = i_fury_time[id] - 1;
        
set_hudmessage(2001000, -1.0, -0.4601.01.10.00.0, -1)
        
show_hudmessage(id"Fury: %d"i_fury_time[id]+1)
    }
    else
    {
        
remove_task(id+TASK_FURY)
    }
}

public 
remove_fury(taskid)
{
    new 
id ID_FURY
    
    remove_task
(id+TASK_FURY)
    
    
set_user_godmode(id0)
    
emit_sound(idCHAN_STREAMnormaly1.0ATTN_NORM0PITCH_HIGH)
}

public 
roundStart()
{
    for(new 
1<= g_maxplayersi++)
    {
        
i_fury_time[i] = get_pcvar_num(cvar_furytime)
        
remove_task(i)
    }


Last edited by tedaimlocks; 03-08-2024 at 13:02.
tedaimlocks is offline
Uzviseni Bog
Senior Member
Join Date: Jun 2020
Old 03-08-2024 , 13:10   Re: ZM Class Admin Only
Reply With Quote #2

Try
PHP Code:
public zp_user_infected_post(idinfector)
{
    if(
get_user_flags(id) & ADMIN_LEVEL_D)
    {
        if (
zp_get_user_zombie_class(id) == g_cerberus)
        {
            
client_print(idprint_chat"[SPK ZM] [Ability: %d Fury | Cooldown: 1 round]"get_pcvar_num(cvar_fury));
            
            
g_veces[id] = get_pcvar_num(cvar_fury);
            
i_fury_time[id] = get_pcvar_num(cvar_furytime);
            
emit_sound(idCHAN_STREAMidle1.0ATTN_NORM0PITCH_HIGH);
            
remove_task(id);
        }
    }
    else
    {
        
client_print(idprint_chat"You do not have the permissions.");
    }

Uzviseni Bog is offline
tedaimlocks
Member
Join Date: Jan 2024
Old 03-08-2024 , 13:25   Re: ZM Class Admin Only
Reply With Quote #3

Quote:
Originally Posted by Uzviseni Bog View Post
Try
PHP Code:
public zp_user_infected_post(idinfector)
{
    if(
get_user_flags(id) & ADMIN_LEVEL_D)
    {
        if (
zp_get_user_zombie_class(id) == g_cerberus)
        {
            
client_print(idprint_chat"[SPK ZM] [Ability: %d Fury | Cooldown: 1 round]"get_pcvar_num(cvar_fury));
            
            
g_veces[id] = get_pcvar_num(cvar_fury);
            
i_fury_time[id] = get_pcvar_num(cvar_furytime);
            
emit_sound(idCHAN_STREAMidle1.0ATTN_NORM0PITCH_HIGH);
            
remove_task(id);
        }
    }
    else
    {
        
client_print(idprint_chat"You do not have the permissions.");
    }

It kind of works, the message gets sent, but i still have the same class and cant use ability. i want to give them the first class using
PHP Code:
zp_set_user_zombie_class(id0

Last edited by tedaimlocks; 03-08-2024 at 13:26.
tedaimlocks is offline
Uzviseni Bog
Senior Member
Join Date: Jun 2020
Old 03-08-2024 , 13:34   Re: ZM Class Admin Only
Reply With Quote #4

Quote:
Originally Posted by tedaimlocks View Post
It kind of works, the message gets sent, but i still have the same class and cant use ability. i want to give them the first class using
PHP Code:
zp_set_user_zombie_class(id0

That could be done like this, if the player doesn't have the required flags, the first zombie class is automatically assigned to them?
Uzviseni Bog is offline
tedaimlocks
Member
Join Date: Jan 2024
Old 03-08-2024 , 13:36   Re: ZM Class Admin Only
Reply With Quote #5

Yeah thats that i want ,if player doesnt have flags the first zm class is assigned to them automatically

Tried this but aint working

PHP Code:
public zp_user_infected_post(idinfector)
{
    if(
get_user_flags(id) & ADMIN_LEVEL_D)
    {
        if (
zp_get_user_zombie_class(id) == g_cerberus)
        {
            
client_print(idprint_chat"[SPK ZM] [Ability: %d Fury | Cooldown: 1 round]"get_pcvar_num(cvar_fury));
            
            
g_veces[id] = get_pcvar_num(cvar_fury);
            
i_fury_time[id] = get_pcvar_num(cvar_furytime);
            
emit_sound(idCHAN_STREAMidle1.0ATTN_NORM0PITCH_HIGH);
            
remove_task(id);
        }
    }
    else
    {
        
zp_set_user_zombie_class(id0
        
client_print(idprint_chat"You do not have the permissions.");
    }

tedaimlocks is offline
Uzviseni Bog
Senior Member
Join Date: Jun 2020
Old 03-08-2024 , 13:59   Re: ZM Class Admin Only
Reply With Quote #6

Buddy, I can't guess, you asked for that class to be restricted and it has been restricted, that's why you can't use powers, the issue is that it shouldn't be restricted there, but in the Class Menu where players choose zombies, also which class is received as default upon infection?
Uzviseni Bog is offline
tedaimlocks
Member
Join Date: Jan 2024
Old 03-09-2024 , 00:19   Re: ZM Class Admin Only
Reply With Quote #7

What are u saying bruh, It didn't get restricted, players can still select the class and they have the zombie but they cant use the abillity of it. How can i make it so they get the first zombie ( predator )
tedaimlocks is offline
Uzviseni Bog
Senior Member
Join Date: Jun 2020
Old 03-09-2024 , 05:54   Re: ZM Class Admin Only
Reply With Quote #8

How many times do I have to tell you that you're sending the wrong .sma file? Just because you downloaded Zombie Plague from the internet doesn't mean you're its author. I told you nicely to upload the Class menu .sma file
Uzviseni Bog is offline
tedaimlocks
Member
Join Date: Jan 2024
Old 03-09-2024 , 08:28   Re: ZM Class Admin Only
Reply With Quote #9

bro what are u saying dude? u never told me to send a sma, plus i dont even think u know what youre saying. I never said i am the author of zombie plague aswell lmfao
tedaimlocks is offline
Uzviseni Bog
Senior Member
Join Date: Jun 2020
Old 03-09-2024 , 08:39   Re: ZM Class Admin Only
Reply With Quote #10

Quote:
Originally Posted by tedaimlocks View Post
bro what are u saying dude? u never told me to send a sma, plus i dont even think u know what youre saying. I never said i am the author of zombie plague aswell lmfao
LoL
Resolve it yourself.
Uzviseni Bog 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 17:32.


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