mirror of
https://github.com/icewind1991/sm-sourcenav.git
synced 2026-06-03 09:04:12 +02:00
basic nav height query
This commit is contained in:
parent
f54177a2e1
commit
94d7095a06
5 changed files with 158 additions and 6 deletions
31
plugin/example.sp
Normal file
31
plugin/example.sp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#include <sourcenav>
|
||||
|
||||
new SourceNav:sourceNav = null;
|
||||
|
||||
public void OnPluginStart() {
|
||||
new String:map[128];
|
||||
GetCurrentMap(map, sizeof(map));
|
||||
|
||||
new String:nav[128];
|
||||
Format(nav, sizeof(nav), "tf/maps/%s.nav", map);
|
||||
PrintToServer("Loading %s", nav);
|
||||
sourceNav = new SourceNav(nav);
|
||||
|
||||
RegServerCmd("sm_nav_query", Query, "Query the nav file at x/y point");
|
||||
}
|
||||
|
||||
public Action:Query(args) {
|
||||
new String:x_str[128];
|
||||
GetCmdArg(1, x_str, sizeof(x_str));
|
||||
new String:y_str[128];
|
||||
GetCmdArg(2, y_str, sizeof(y_str));
|
||||
float x = StringToFloat(x_str);
|
||||
float y = StringToFloat(y_str);
|
||||
|
||||
PrintToServer("x: %f, y: %f", x, y);
|
||||
|
||||
float z = sourceNav.query(x, y, 0.0);
|
||||
|
||||
PrintToServer("Z: %f", z);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue