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

[H3LP] Opposing Force Map Type


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DarthMan
Veteran Member
Join Date: Aug 2011
Old 12-18-2018 , 08:00   [H3LP] Opposing Force Map Type
Reply With Quote #1

Hello. Is there a proper and good way of determining if the current map from an Opposing Force server is just a standard 1, like on HL1 or, a capture the flag map? I am currently using a method that checks for info_ctfspawn and item_ctfbase classname using fakemeta EngFunc_FindEntityByString, but this method may not be reliable in all cases. I noticed that there can be cases when these entities exist, but the game is still not CTF, because there are no flags and no spawn points made for ctf game. I don't want to do the same method to check for all entities, so, is there a simple way to determine if it's a ctf map? Thanks !
DarthMan is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 12-18-2018 , 12:40   Re: [H3LP] Opposing Force Map Type
Reply With Quote #2

Hi, try :
Quote:
UTIL_FindEntityByClassname( pSpot, "info_player_team2" );
some maps don't have the same class-name, in this case you should cheak and add it also.
if you have pack of maps have the same name or prefix maybe this way will help you:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

new gameMode[32]
new 
g_szMap[64]

public 
plugin_init() {
        
    
get_cvar_string("sv_ag_gamemode"gameModecharsmax(gameMode));
    
get_mapname(g_szMapcharsmax(g_szMap))
    
RegisterHam(Ham_Spawn"player""player_spawn"1)
    
}
public 
player_spawn(id) {
    
    if (
equali(gameMode"ctf") || equali(gameMode"ctf2"))
    {
        if(
equalig_szMap"agctf_") )
        {
            return 
HAM_IGNORED;

        }else {
            
client_print(idprint_center"This is not a valid CTF map!"
        }  
    }
    return 
HAM_IGNORED;

__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
DarthMan
Veteran Member
Join Date: Aug 2011
Old 12-18-2018 , 12:57   Re: [H3LP] Opposing Force Map Type
Reply With Quote #3

Quote:
Originally Posted by abdobiskra View Post
Hi, try :

some maps don't have the same class-name, in this case you should cheak and add it also.
if you have pack of maps have the same name or prefix maybe this way will help you:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

new gameMode[32]
new 
g_szMap[64]

public 
plugin_init() {
        
    
get_cvar_string("sv_ag_gamemode"gameModecharsmax(gameMode));
    
get_mapname(g_szMapcharsmax(g_szMap))
    
RegisterHam(Ham_Spawn"player""player_spawn"1)
    
}
public 
player_spawn(id) {
    
    if (
equali(gameMode"ctf") || equali(gameMode"ctf2"))
    {
        if(
equalig_szMap"agctf_") )
        {
            return 
HAM_IGNORED;

        }else {
            
client_print(idprint_center"This is not a valid CTF map!"
        }  
    }
    return 
HAM_IGNORED;

This game is not AG btw, it's Opposing Force.
DarthMan is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 12-18-2018 , 13:39   Re: [H3LP] Opposing Force Map Type
Reply With Quote #4

Yes i see, I just share to you example to understand what I mean.
and you don't need to define the mod.
__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
DarthMan
Veteran Member
Join Date: Aug 2011
Old 12-18-2018 , 13:51   Re: [H3LP] Opposing Force Map Type
Reply With Quote #5

Quote:
Originally Posted by abdobiskra View Post
Yes i see, I just share to you example to understand what I mean.
and you don't need to define the mod.
But that cvar is not available on OP4. Also, there must be the 2 specified entities, plus the flags, plus the black mesa and squad force to have the game mode as CTF. So, in total, a number of 6 different entities. I need another method, to not have to check if all of these entities exist.

Last edited by DarthMan; 12-18-2018 at 13:51.
DarthMan is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-18-2018 , 15:43   Re: [H3LP] Opposing Force Map Type
Reply With Quote #6

Quote:
Originally Posted by DarthMan View Post
But that cvar is not available on OP4. Also, there must be the 2 specified entities, plus the flags, plus the black mesa and squad force to have the game mode as CTF. So, in total, a number of 6 different entities. I need another method, to not have to check if all of these entities exist.
What is wrong with checking all entities if they must all exist?
__________________
HamletEagle is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 12-19-2018 , 11:33   Re: [H3LP] Opposing Force Map Type
Reply With Quote #7

Quote:
Originally Posted by HamletEagle View Post
What is wrong with checking all entities if they must all exist?
Well, it's not a problem, but I'm sure there's a more reliable option to check the gamemode.
DarthMan is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 12-19-2018 , 11:58   Re: [H3LP] Opposing Force Map Type
Reply With Quote #8

Quote:
Originally Posted by DarthMan View Post
but I'm sure there's a more reliable option to check the gamemode.
https://www.amxmodx.org/api/amxmisc/is_running
__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-19-2018 , 12:13   Re: [H3LP] Opposing Force Map Type
Reply With Quote #9

Quote:
Originally Posted by DarthMan View Post
Well, it's not a problem, but I'm sure there's a more reliable option to check the gamemode.
If a map needs those 6 types of entities to exist to be treated as CTF, then that's the valid method.
__________________

Last edited by klippy; 12-19-2018 at 12:25.
klippy is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 12-19-2018 , 12:20   Re: [H3LP] Opposing Force Map Type
Reply With Quote #10

Quote:
Originally Posted by abdobiskra View Post
is_running is for checking if the game is valve, cstrike etc.
DarthMan is offline
Reply


Thread Tools
Display Modes

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 06:18.


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