mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 18:38:26 +00:00
Generate .nav files
This commit is contained in:
parent
193ee1e052
commit
519a647a53
@ -45,7 +45,8 @@ a bhop server should be simple
|
|||||||
```
|
```
|
||||||
2. Copy the desired .smx files to your plugins (addons/sourcemod/plugins) folder
|
2. Copy the desired .smx files to your plugins (addons/sourcemod/plugins) folder
|
||||||
2.1. Copy shavit.games.txt to /gamedata if you have DHooks installed.
|
2.1. Copy shavit.games.txt to /gamedata if you have DHooks installed.
|
||||||
3. Restart your server.
|
3. Copy base.nav to the `maps` folder.
|
||||||
|
4. Restart your server.
|
||||||
|
|
||||||
# Required plugins:
|
# Required plugins:
|
||||||
shavit-core - no other plugin will work without it.
|
shavit-core - no other plugin will work without it.
|
||||||
|
|||||||
BIN
maps/base.nav
Normal file
BIN
maps/base.nav
Normal file
Binary file not shown.
@ -19,7 +19,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// I have no idea if this plugin will work with CS:S, sorry.
|
// I have no idea if this plugin will work with CS:S, sorry.
|
||||||
// USE WITH https://forums.alliedmods.net/showthread.php?t=231077
|
|
||||||
|
|
||||||
#include <sourcemod>
|
#include <sourcemod>
|
||||||
#include <cstrike>
|
#include <cstrike>
|
||||||
@ -118,6 +117,21 @@ public void OnClientPutInServer(int client)
|
|||||||
|
|
||||||
public void OnMapStart()
|
public void OnMapStart()
|
||||||
{
|
{
|
||||||
|
GetCurrentMap(gS_Map, 128);
|
||||||
|
RemoveMapPath(gS_Map, gS_Map, 128);
|
||||||
|
|
||||||
|
char sTempMap[140];
|
||||||
|
Format(sTempMap, 140, "maps/%s.nav", gS_Map);
|
||||||
|
|
||||||
|
if(!FileExists(sTempMap))
|
||||||
|
{
|
||||||
|
File_Copy("maps/base.nav", sTempMap);
|
||||||
|
|
||||||
|
ForceChangeLevel(gS_Map, ".nav file generate");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ConVar bot_zombie = FindConVar("bot_zombie");
|
ConVar bot_zombie = FindConVar("bot_zombie");
|
||||||
|
|
||||||
// idk if it exists in CS:S, safety check ;p
|
// idk if it exists in CS:S, safety check ;p
|
||||||
@ -154,9 +168,6 @@ public void OnMapStart()
|
|||||||
CreateDirectory(sPath, 511);
|
CreateDirectory(sPath, 511);
|
||||||
}
|
}
|
||||||
|
|
||||||
GetCurrentMap(gS_Map, 128);
|
|
||||||
RemoveMapPath(gS_Map, gS_Map, 128);
|
|
||||||
|
|
||||||
for(int i = 0; i < MAX_STYLES; i++)
|
for(int i = 0; i < MAX_STYLES; i++)
|
||||||
{
|
{
|
||||||
gA_Frames[i] = new ArrayList(5);
|
gA_Frames[i] = new ArrayList(5);
|
||||||
@ -496,3 +507,45 @@ stock bool RemoveMapPath(const char[] map, char[] destination, int maxlen)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copies file source to destination
|
||||||
|
* Based on code of javalia:
|
||||||
|
* http://forums.alliedmods.net/showthread.php?t=159895
|
||||||
|
*
|
||||||
|
* @param source Input file
|
||||||
|
* @param destination Output file
|
||||||
|
*/
|
||||||
|
stock bool File_Copy(const char[] source, const char[] destination)
|
||||||
|
{
|
||||||
|
Handle file_source = OpenFile(source, "rb");
|
||||||
|
|
||||||
|
if(file_source == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle file_destination = OpenFile(destination, "wb");
|
||||||
|
|
||||||
|
if(file_destination == null)
|
||||||
|
{
|
||||||
|
delete file_source;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int buffer[32];
|
||||||
|
int cache;
|
||||||
|
|
||||||
|
while(!IsEndOfFile(file_source))
|
||||||
|
{
|
||||||
|
cache = ReadFile(file_source, buffer, 32, 1);
|
||||||
|
|
||||||
|
WriteFile(file_destination, buffer, cache, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
delete file_source;
|
||||||
|
delete file_destination;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user