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

Problem with blocking command on custom maps.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 04-12-2020 , 08:49   Problem with blocking command on custom maps.
Reply With Quote #1

Hi,
I made something to prevent getting weapons on custom maps from a menu.
Here is the defined const:
PHP Code:
new const g_Maps[ ][ ] =
{
    
"awp_45",
    
"awp_battle",
    
"awp_brasov",
    
"awp_bycastor32",
    
"awp_bycastor64",
    
"awp_bycastor_32",
    
"awp_circular",
    
"awp_csgamers",
    
"awp_distancia",
    
"awp_dry",
    
"awp_dunhill",
    
"awp_dust",
    
"awp_dust32",
    
"awp_wall",
    
"awp_garden",
    
"awp_india",
    
"awp_india2",
    
"awp_zigzag"
}; 
And this is the code:
PHP Code:
    new map[32];
    
get_mapname(mapcharsmax(map))
    if(
equali(mapsizeof(g_Maps))
    {
        
color_chat(id,"!g%s!y: You can't access this menu on AWP Maps!"tag)
        return 
1;
    }
    else
    {
        new 
szMenu menu_create("\y[\rVIP\y] Menu","vip_menu_handler")
        
menu_additem(szMenu,"\rWeapons")
        
        
menu_display(idszMenu0)
    } 
I can acces this menu even if the map is one from constant g_Maps[] and when I choose the weapons, it prints me this message
PHP Code:
        color_chat(id,"!g%s!y: You can't access this menu on AWP Maps!"tag
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 04-12-2020 , 09:01   Re: Problem with blocking command on custom maps.
Reply With Quote #2

PHP Code:
new const g_Maps[][] =
{
    
"awp_45",
    
"awp_battle",
    
"awp_brasov",
    
"awp_bycastor32",
    
"awp_bycastor64",
    
"awp_bycastor_32",
    
"awp_circular",
    
"awp_csgamers",
    
"awp_distancia",
    
"awp_dry",
    
"awp_dunhill",
    
"awp_dust",
    
"awp_dust32",
    
"awp_wall",
    
"awp_garden",
    
"awp_india",
    
"awp_india2",
    
"awp_zigzag"
};

new 
g_bMapBanned;

public 
plugin_init()
{
    new 
szMapName[32];
    
get_mapname(szMapNamecharsmax(szMapName))
    
    for (new 
isizeof g_Mapsi++)
    {
        if (!
equali(szMapNameg_Maps[i])
            continue;
        
        
g_bMapBanned 1;
        
        break;
    }

PHP Code:
    if(g_bMapBanned)
    {
        
color_chat(id,"!g%s!y: You can't access this menu on AWP Maps!"tag)
        return 
1;
    }
    else
    {
        new 
szMenu menu_create("\y[\rVIP\y] Menu","vip_menu_handler")
        
menu_additem(szMenu,"\rWeapons")
        
        
menu_display(idszMenu0)
    } 
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-12-2020 , 09:18   Re: Problem with blocking command on custom maps.
Reply With Quote #3

Isn't it easier to check only if the map starts with "awp_"?
Or you can simply use this - https://forums.alliedmods.net/showthread.php?t=303605
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 04-12-2020 , 09:20   Re: Problem with blocking command on custom maps.
Reply With Quote #4

he said custom maps so i assumed he needs to read them from a list
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 04-12-2020 , 09:47   Re: Problem with blocking command on custom maps.
Reply With Quote #5

I tried your way, georgik and it throws this error:
PHP Code:
 error 001excepted token">"but found "contiune" 
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-12-2020 , 09:57   Re: Problem with blocking command on custom maps.
Reply With Quote #6

Quote:
Originally Posted by georgik57 View Post
he said custom maps so i assumed he needs to read them from a list
True, although the printed message says "AWP maps".

Quote:
Originally Posted by Shadows Adi View Post
I tried your way, georgik and it throws this error:
PHP Code:
 error 001excepted token">"but found "contiune" 
You misspelled "continue".
__________________

Last edited by OciXCrom; 04-12-2020 at 09:58.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 04-12-2020 , 10:22   Re: Problem with blocking command on custom maps.
Reply With Quote #7

Same error:
PHP Code:
error 001excepted token">"but found "continue" 
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 04-12-2020 , 11:39   Re: Problem with blocking command on custom maps.
Reply With Quote #8

PHP Code:
if (!equali(szMapNameg_Maps[i]) 
->
PHP Code:
if (!equali(szMapNameg_Maps[i])) 
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
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:54.


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