Question about APIs available for LUA scripts.

Hello.

First of all, let me apologize if this is the wrong place to post this question.

I’m playing with the Single Player Project server for 3.3.5. I’m trying to do a script that would teleport the player whenever the user points on the map inside the game.

I modified the Carbonite addon to add an item to the right click menu of the map so it would send the gm command .go zonexy [zonecoordinate X] [zonecoordinate Y].

This works very well with one snag however. It only works for the player’s current zone. I want it to work for all zones I can see on the map. For this I need a zoneId located at the AreaTableID. (Which is an optional argument to the .go zonexy command)

For the life of me, I can’t figure out how to get the current map zoneid on the client side. I looked it up and only found GetCurrentMapZone() which gives me a number that I don’t really know what to do with. And GetRealZoneText() which returns the zone name of where the cursor points in the map . Which is almost what I need. I need the zone ID and not the zone name. And GetCurrentMapAreaID() which also gives me a mapID but it doesn’t match the zoneID i need.

So I thought to make a lua script on the server side that takes the [zonecoordinate X] [zonecoordinate Y] [zone name] from the client and converts the zone name to zone id. Or alternatively somehow figures out the zoneid from GetCurrentMapZone() and GetCurrentMapAreaID().

However I didn’t find any documentation of what APIs are available in the lua script. I looked at some scripts that came along with the Single Player Project. One of them is ‘System_Group_commands.lua’(Attached below) which I hooked up to. I successfully passed the information from the client but I don’t know if it’s possible to look up the string zone name and get it’s id from the AreaTableID from LUA. Furthermore another problem is that I pass zone coordinates. Yet the 'Player: Teleport function in LUA wants absolute map coordinates. I looked at the c++ source code for the Teleport functions and for the ‘.go zonexy’ function and it seems that the .go zonexy function converts the local coordinates to global coordinates. Using


Zone2MapCoordinates(x, y, zoneEntry->ID); //line 454 in cs_go.cpp attached below

However I don’t know if this function is exposed to the LUA scripts.

I would really appreciate if someone would help me out. Maybe there is an easy way to get the zone id from the client side or something else that I’m missing…

Thank you

PS. A picture worth a 1000 words… Here is how this works so far. I would be great to extend it to other areas of the map.

[ATTACH]2480._xfImport[/ATTACH] [ATTACH]2481._xfImport[/ATTACH]

Bump