Заказать игровой сервер Контакты (заказать плагин/исправить ошибки/другое) Поиск

[ вход ]
[ последние сообщения ]

  • Страница 1 из 1
  • 1
Форум » SourceMod >> CS:Source >> CSGO » Обсуждение » Конфигурации для отдельных карт (Посоветуйте плагин)
Конфигурации для отдельных карт
MeDestroyer Дата: Вторник, 10.03.2015, 15:09:40 | Сообщение # 1
Сообщений: 55
Репутация: -1 [ +/- ]
Помогите с плагином для разной настройки некоторых карт. У меня просто карты из мастерской, хотел Map and Maps Prefixs Configs использовать, там надо создать тестовик с названием карты. Мои карты содержат символы, которые нельзя использовать в названии текстовика workshop/326263228/de_xpecm.
Есть ли альтернатива плагину?
Или возможно кто-нибудь поможет сделать в плагине допустим чтобы / читался как ! Например: workshop!326263228!de_xpecm.txt
Или так, чтобы искало совпадение?
Код
#include <sourcemod>

#pragma semicolon 1

#define PLUGIN_VERSION "1.2"

// Plugin definitions
public Plugin:myinfo =  
{
  name = "Maps and Prefix Maps Configs",
  author = "graczu",
  description = "Execing configs for map, and maps prefixs",
  version = PLUGIN_VERSION,
  url = "http://sourcemod.net"
};

//#define debugmsg false; // debugmsg mode, logs adding
new bool:debugmsg = false;

new String:breaker[] = "_";
new String:prefix[12];
new String:mapfile[PLATFORM_MAX_PATH];
new String:mapprefixfile[PLATFORM_MAX_PATH];

public OnMapStart(){
  CreateTimer(2.0, Read_Files);
}

public Action:Read_Files(Handle:timer){
  decl String:currentMap[64];
  GetCurrentMap(currentMap, 64);
  if(strlen(currentMap) > 2 && !(StrContains(currentMap,breaker) == -1)){
   SplitString(currentMap, breaker, prefix, sizeof(prefix));
   BuildPath(Path_SM,mapfile,sizeof(mapfile),"configs/mapscfg/%s.cfg", currentMap);
   BuildPath(Path_SM,mapprefixfile,sizeof(mapprefixfile),"configs/mapscfg/%s_.cfg", prefix);
   if(debugmsg == true){
    LogMessage("0 Patch mapfile: %s",mapfile);
    LogMessage("0 Patch prefix: %s",mapprefixfile);
   }
   if(FileExists(mapprefixfile)){
    readFileConfig(mapprefixfile);
   } else if(debugmsg == true){
    LogMessage("0 Map Prefix dosent exist: %s",mapprefixfile);
   }
   if(FileExists(mapfile)){
    readFileConfig(mapfile);
   } else if(debugmsg == true){
    LogMessage("0 Mapfile dosent exists: %s",mapfile);
   }
  } else if(strlen(currentMap) > 1){
   BuildPath(Path_SM,mapfile,sizeof(mapfile),"configs/mapscfg/%s.cfg", currentMap);
   if(debugmsg == true){
    LogMessage("1 Patch mapfile: %s",mapfile);
   }
   if(FileExists(mapfile)){
    readFileConfig(mapfile);
   } else if(debugmsg == true){
    LogMessage("1 Mapfile dosent exists: %s",mapfile);
   }
  }
}

public readFileConfig(String:file[]){

  new Handle:hFile = OpenFile(file, "rt");
  new String:szReadData[128];
  if(hFile == INVALID_HANDLE)
  {
   return;
  }
  while(!IsEndOfFile(hFile) && ReadFileLine(hFile, szReadData, sizeof(szReadData)))
  {
   ServerCommand("%s", szReadData);
   if(debugmsg == true){
    LogMessage("Execute: %s", szReadData);
   }
  }
  CloseHandle(hFile);
}
 
Sallcom Дата: Вторник, 10.03.2015, 20:28:47 | Сообщение # 2
Сообщений: 205
Репутация: 31 [ +/- ]
Цитата MeDestroyer ()
Или возможно кто-нибудь поможет сделать в плагине допустим чтобы / читался как !

ReplaceString(mapfile, sizeof(mapfile), "/", "!");


Сообщение отредактировал Sallcom - Вторник, 10.03.2015, 20:30:28
 
MeDestroyer Дата: Среда, 11.03.2015, 15:14:47 | Сообщение # 3
Сообщений: 55
Репутация: -1 [ +/- ]
Что-то я не понял куда вставить эту строчку.
Код
#include <sourcemod>
#pragma semicolon 1

#define PLUGIN_VERSION "1.2"

// Plugin definitions
public Plugin:myinfo =   
{
   name = "Maps and Prefix Maps Configs",
   author = "graczu",
   description = "Execing configs for map, and maps prefixs",
   version = PLUGIN_VERSION,
   url = "http://sourcemod.net"
};

//#define debugmsg false; // debugmsg mode, logs adding
new bool:debugmsg = false;

new String:breaker[] = "_";
new String:prefix[12];
new String:mapfile[PLATFORM_MAX_PATH];
new String:mapprefixfile[PLATFORM_MAX_PATH];

public OnMapStart(){
   CreateTimer(2.0, Read_Files);
}

public Action:Read_Files(Handle:timer){
   decl String:currentMap[64];
   GetCurrentMap(currentMap, 64);
   if(strlen(currentMap) > 2 && !(StrContains(currentMap,breaker) == -1)){
    SplitString(currentMap, breaker, prefix, sizeof(prefix));
    [b]ReplaceString(mapfile, sizeof(mapfile), "/", "!");[/b]
    BuildPath(Path_SM,mapfile,sizeof(mapfile),"configs/mapscfg/%s.cfg", currentMap);
    BuildPath(Path_SM,mapprefixfile,sizeof(mapprefixfile),"configs/mapscfg/%s_.cfg", prefix);
    if(debugmsg == true){
     LogMessage("0 Patch mapfile: %s",mapfile);
     LogMessage("0 Patch prefix: %s",mapprefixfile);
    }
    if(FileExists(mapprefixfile)){
     readFileConfig(mapprefixfile);
    } else if(debugmsg == true){
     LogMessage("0 Map Prefix dosent exist: %s",mapprefixfile);
    }
    if(FileExists(mapfile)){
     readFileConfig(mapfile);
    } else if(debugmsg == true){
     LogMessage("0 Mapfile dosent exists: %s",mapfile);
    }
   } else if(strlen(currentMap) > 1){
    BuildPath(Path_SM,mapfile,sizeof(mapfile),"configs/mapscfg/%s.cfg", currentMap);
    [b]ReplaceString(mapfile, sizeof(mapfile), "/", "!");[/b]
    if(debugmsg == true){
     LogMessage("1 Patch mapfile: %s",mapfile);
    }
    if(FileExists(mapfile)){
     readFileConfig(mapfile);
    } else if(debugmsg == true){
     LogMessage("1 Mapfile dosent exists: %s",mapfile);
    }
   }
}

public readFileConfig(String:file[]){

   new Handle:hFile = OpenFile(file, "rt");
   new String:szReadData[128];
   if(hFile == INVALID_HANDLE)
   {
    return;
   }
   while(!IsEndOfFile(hFile) && ReadFileLine(hFile, szReadData, sizeof(szReadData)))
   {
    ServerCommand("%s", szReadData);
    if(debugmsg == true){
     LogMessage("Execute: %s", szReadData);
    }
   }
   CloseHandle(hFile);
}


UPD:
Проблема решена.


Сообщение отредактировал MeDestroyer - Среда, 11.03.2015, 21:42:25
 
Форум » SourceMod >> CS:Source >> CSGO » Обсуждение » Конфигурации для отдельных карт (Посоветуйте плагин)
  • Страница 1 из 1
  • 1
Поиск: