Map name is not going to change while plugin is running, so better to check once at plugin_init().
Code:
new const MAPS_ALLOW_GODMODE[ ][ ] =
{
"slide_1",
"slide_2",
"map_name",
"another_map",
"etc",
"ggg"
};
new bool:g_bAllowGodmodeThisMap;
public plugin_init( )
{
new szCurrentMap[ 64 ];
get_mapname( szCurrentMap, charsmax( szCurrentMap ) );
for( new i = 0; i < sizeof( MAPS_ALLOW_GODMODE ) && !g_bAllowGodmodeThisMap; i++ )
{
g_bAllowGodmodeThisMap = bool:equali( szCurrentMap, MAPS_ALLOW_GODMODE[ i ] );
}
}
public GodMode(id)
{
if(!is_user_alive(id))
{
kz_chat(id, "%L", id, "KZ_NOT_ALIVE")
return PLUGIN_HANDLED
}
new godmode = !get_user_godmode(id)
set_user_godmode(id, godmode)
if(godmode && !g_bAllowGodmodeThisMap)
detect_cheat(id,"God Mode")
kz_chat(id, "%L", id, "KZ_GODMODE" , godmode ? "ON" : "OFF")
return PLUGIN_HANDLED
}
__________________