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

Solved define ADMIN_LEVEL


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
artYY
Member
Join Date: May 2020
Location: Brazil, Curitiba, PR
Old 07-18-2020 , 13:59   define ADMIN_LEVEL
Reply With Quote #1

Hi guys,

I cannot define that, to use this command, you need administrator access.

I already put the command #define.

Can someone help me?

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

#define PLUGIN "CS Revo: Camera New"
#define VERSION "1.0"
#define AUTHOR "Nani | Wilian M."

#define PREFIX "\r[\dTK'CLAN\r]"
#define PREFIXCHAT "!t[!gTK'CLAN!t]"

#define CAMERA_OWNER EV_INT_iuser1
#define CAMERA_CLASSNAME "trigger_camera"
#define CAMERA_MODEL "models/rpgrocket.mdl"
#define ADMIN_KICK

new cvar_camera_distance
new bool:g_inthird_person[33]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_say("/cam""camera_menu")
    
register_say("cam""camera_menu")
    
register_say("/camera""camera_menu")
    
register_say("camera""camera_menu")
    
    
RegisterHam(Ham_Spawn"player""fw_player_spawn_post"true)
    
    
register_think(CAMERA_CLASSNAME"fw_camera_think")
    
    
cvar_camera_distance register_cvar("cam_distance""150")
}

public 
camera_menu(id)
{
    new 
szmenu[300]
    
    
formatex(szmenu299"%s \wCamera Menu"PREFIX)
    
    new 
menu menu_create(szmenu"_camera_menu")
    
    
menu_additem(menug_inthird_person[id] ? "Terceira Pessoa \r[Ativado]" "Terceira Pessoa")
    
menu_additem(menu, !g_inthird_person[id] ? "Normal \r[Ativado]" "Normal")
    
    
menu_setprop(menuMPROP_EXITNAME"Sair")
    
menu_display(idmenu0)
}

public 
_camera_menu(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        
        return 
PLUGIN_HANDLED
    
}

    switch(
item)
    {
        case 
0:
        {
            if(
g_inthird_person[id])
            {
                
client_print_color(id"%s !yVoce ja esta com a camera em !tTerceira Pessoa!y."PREFIXCHAT)
                
                return 
PLUGIN_HANDLED
            
}
            else 
set_cam_ent(id)
        }
        
        case 
1:
        {
            
remove_cam_ent(id1)
        }
    }
    
    return 
PLUGIN_HANDLED
}


public 
plugin_precache() precache_model(CAMERA_MODEL)
public 
client_disconnect(idremove_cam_ent(id0)

public 
fw_camera_think(ient)
{
    new 
iowner entity_get_int(ientCAMERA_OWNER)
    
    if(!
is_user_alive(iowner) || is_user_bot(iowner))
        return
        
    if(!
is_valid_ent(ient))
        return

    new 
Float:fplayerorigin[3], Float:fcameraorigin[3], Float:vangles[3], Float:vback[3]

    
entity_get_vector(iownerEV_VEC_originfplayerorigin)
    
entity_get_vector(iownerEV_VEC_view_ofsvangles)
        
    
fplayerorigin[2] += vangles[2];
            
    
entity_get_vector(iownerEV_VEC_v_anglevangles)

    
angle_vector(vanglesANGLEVECTOR_FORWARDvback)
    
    
fcameraorigin[0] = fplayerorigin[0] + (-vback[0] * float(get_pcvar_num(cvar_camera_distance)))
    
fcameraorigin[1] = fplayerorigin[1] + (-vback[1] * float(get_pcvar_num(cvar_camera_distance)))
    
fcameraorigin[2] = fplayerorigin[2] + (-vback[2] * float(get_pcvar_num(cvar_camera_distance)))  

    
engfunc(EngFunc_TraceLinefplayeroriginfcameraoriginIGNORE_MONSTERSiowner0
    
    new 
Float:flFractionget_tr2(0TR_flFractionflFraction)
    
    if(
flFraction != 1.0)
    {
        
flFraction *= get_pcvar_float(cvar_camera_distance)
    
        
fcameraorigin[0] = fplayerorigin[0] + (-vback[0] * flFraction)
        
fcameraorigin[1] = fplayerorigin[1] + (-vback[1] * flFraction)
        
fcameraorigin[2] = fplayerorigin[2] + (-vback[2] * flFraction)
    } 
    
    
entity_set_vector(ientEV_VEC_originfcameraorigin)
    
entity_set_vector(ientEV_VEC_anglesvangles)

    
entity_set_float(ientEV_FL_nextthinkget_gametime())
}

public 
fw_player_spawn_post(id

    if(!
is_user_alive(id)) 
        return 
HAM_IGNORED
    
    
if(g_inthird_person[id])
        
set_cam_ent(id)
    
    return 
HAM_HANDLED
}  

public 
set_cam_ent(id)
{
    new 
ient create_entity(CAMERA_CLASSNAME)
    
    if(!
is_valid_ent(ient))
        return

    
entity_set_model(ientCAMERA_MODEL)
    
entity_set_int(ientCAMERA_OWNERid)
    
entity_set_string(ientEV_SZ_classnameCAMERA_CLASSNAME)
    
entity_set_int(ientEV_INT_solidSOLID_NOT)
    
entity_set_int(ientEV_INT_movetypeMOVETYPE_FLY)
    
entity_set_int(ientEV_INT_rendermodekRenderTransTexture)

    
attach_view(idient)
    
    
g_inthird_person[id] = true
    
    entity_set_float
(ientEV_FL_nextthinkget_gametime())
}

public 
remove_cam_ent(idattachview)
{
    if(
attachviewattach_view(idid)

    new 
ient = -1
    
    
while((ient find_ent_by_class(ientCAMERA_CLASSNAME)))
    {
        if(!
is_valid_ent(ient))
            continue
        
        if(
entity_get_int(ientCAMERA_OWNER) == id)
        {
            
g_inthird_person[id] = false
            
            entity_set_int
(ientEV_INT_flagsFL_KILLME)
            
dllfunc(DLLFunc_Thinkient)
        }
    }
}

stock client_print_color(const id, const input[], any:...)
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4")
    
replace_all(msg190"!y""^1")
    
replace_all(msg190"!t""^3")
    
replace_all(msg190"!t2""^0")
    
    if (
idplayers[0] = id; else get_players(playerscount"ch")

    for (new 
0counti++)
    {
        if (
is_user_connected(players[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
            
write_byte(players[i])
            
write_string(msg)
            
message_end()
        }
    }
}

stock register_say(szsay[], szfunction[])
{
    new 
sztemp[64]
    
formatex(sztemp63 "say /%s"szsay)
    
register_clcmd(sztempszfunction)
    
    
formatex(sztemp63 "say .%s"szsay)
    
register_clcmd(sztempszfunction)
    
    
formatex(sztemp63 "say_team /%s"szsay)
    
register_clcmd(sztempszfunction )
    
    
formatex(sztemp63 "say_team .%s"szsay)
    
register_clcmd(sztempszfunction)

__________________

Last edited by artYY; 07-19-2020 at 11:30.
artYY is offline
tom .
Member
Join Date: May 2016
Old 07-18-2020 , 14:04   Re: define ADMIN_LEVEL
Reply With Quote #2

PHP Code:
#define*ADMIN_KICK 
==>
PHP Code:
#define ADMIN_ACCES ADMIN_KICK 
Quote:
register_say("/cam",*"camera_menu", ADMIN_ACCES)
****register_say("cam",*"camera_menu", ADMIN_ACCES)
****register_say("/camera",*"camera_menu", ADMIN_ACCES)
****register_say("camera",*"camera_menu", ADMIN_ACCES)
****

Last edited by tom .; 07-18-2020 at 14:06.
tom . is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-18-2020 , 14:26   Re: define ADMIN_LEVEL
Reply With Quote #3

That's not going to do anything without a proper check for the flag. I don't know why people think that adding #define somewhere in the code will magically limit the command access.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
artYY
Member
Join Date: May 2020
Location: Brazil, Curitiba, PR
Old 07-19-2020 , 11:28   Re: define ADMIN_LEVEL
Reply With Quote #4

Quote:
Originally Posted by tom . View Post
PHP Code:
#define*ADMIN_KICK 
==>
PHP Code:
#define ADMIN_ACCES ADMIN_KICK 
Tks a lot man! I didn't know how to do

Quote:
Originally Posted by OciXCrom View Post
That's not going to do anything without a proper check for the flag. I don't know why people think that adding #define somewhere in the code will magically limit the command access.
Now I know.
__________________
artYY 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 15:01.


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