Raised This Month: $ Target: $400
 0% 

Block Button ID


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 06-16-2018 , 16:42   Block Button ID
Reply With Quote #1

I made a plugin to block using block with button ID. But It's not working. I guess it doesn't get file or something like that. Could you fix my mistake? Thanks for helping

Example file is "configs/block_buttons/mapname.ini"
There are IDs in the file.
Like;
Code:
213
230
102
PHP Code:
#include <amxmodx>
#include <reapi>
#include <hamsandwich>

#pragma semicolon 1

new komutdosyasi[250], satirsayisisonucpurposeless[250][250],LeaderGM[250][250],
PurposeLess;

public 
plugin_init() {
    
register_plugin("Buton Engel""1.0""PurposeLess");

    
register_clcmd("say /info""button_info");
    
RegisterHam(Ham_Use"func_button""RHam_Use");
    
LoadButtons();
}

public 
RHam_Use(entid)
{
    if(
get_user_team(id) == 1)
    {
        if(
get_godmode())
        {
            
client_print(idprint_center"[LeaderGaming] You cannot use buttons while godmode is on");
            return 
4;
        }
        if(
ent == PurposeLess)
        {
            
client_print(idprint_center"[LeaderGaming] You cannot use this button");
            return 
4;
        }
    }
    return 
1;
}

public 
LoadButtons()
{
    static 
filename[64], mapname[32];
    
get_localinfo("amxx_configsdir"filenamecharsmax(filename));
    
get_mapname(mapnamecharsmax(mapname));
    
format(filenamecharsmax(filename), "%s/block_buttons/%s.ini"filenamemapname);

    for(new 
i=0degeri<250i++)
    {
        
sonuc read_file(komutdosyasiipurposeless[i], charsmax(purposeless), satirsayisi);
        if(
sonuc != 0)
        {
            
PurposeLess++;
            
LeaderGM[PurposeLess] = purposeless[i];
            
deger++;
        }
    }
}

public 
get_godmode()
{
    new 
a=0b=0;
    for(new 
id 1id <= MAX_CLIENTSid++)
    {
        if(!
is_user_connected(id)) continue;
        new 
team get_user_team(id);
        if(
team == && is_user_alive(id))
        {
            
a++;
            if(!
get_entvar(idvar_takedamage))
            {
                
b++;
            }
        }
    }
    return (
&& 0) ? 1:0;
}

public 
button_info(id)
{
    if(
get_user_flags(id) & ADMIN_RCON)
    {
        new 
menu menu_create("Button Menu""button_info2");
        
menu_additem(menu"\yFind Button ID""1");
        
menu_additem(menu"\yBlock Button ID in map""2");
        
//menu_additem(menu, "\yUnBlock Button ID in map", "3");     ; I Couldn't have done.
        
menu_setprop(menuMPROP_EXITNAME"Exit");
        
menu_display(idmenu);
    }
    return 
PLUGIN_HANDLED;
}

public 
button_info2(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    static 
data[6], accesscallback;
    
menu_item_getinfo(menuitemaccessdatacharsmax(data), __callback);
    new 
key str_to_num(data);
    switch(
key)
    {
        case 
1: {
            new 
entaim;
            
get_user_aiming(identaim);

            if(
ent)
            {
                
client_print_color(idid"^1[^4LeaderGaming^1] ^3Button ID^1: ^4%d"ent);
            }
            
menu_display(idmenu);
        }
        case 
2: {
            new 
entaim;
            
get_user_aiming(identaim);

            if(
ent)
            {
                static 
filename[64], mapname[32], buttonID[10];
                
get_localinfo("amxx_configsdir"filenamecharsmax(filename));
                
get_mapname(mapnamecharsmax(mapname));
                
format(filenamecharsmax(filename), "%s/block_buttons/%s.ini"filenamemapname);
                
format(buttonIDcharsmax(buttonID), "%d"ent);
                
write_file(filenamebuttonID);
            }
        }
    }
    return 
PLUGIN_HANDLED;


Last edited by PurposeLessx; 06-16-2018 at 16:42.
PurposeLessx is offline
 



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:39.


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