Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- The following example will create and show a MapDialog when typing the "/telemap" command.
- When selecting a position, the script will teleport you to that position.
- Note that this is just an example, and you will fall through the ground when teleporting to a not yet streamed location. To avoid this, you could e.g. use MapAndreas.
- */
- // General:
- #define MAPDIALOG_TELEPORT_TO_TARGET 17
- public OnMapDialogResponse(MapDialog:dialog, msg, Float:x, Float:y, response)
- {
- if (msg == MAPDIALOG_TELEPORT_TO_TARGET)
- {
- if (response == MAPDIALOG_RESPONSE_EXIT) DestroyMapDialog(dialog);
- if (response == MAPDIALOG_RESPONSE_CLICK)
- {
- MapDialogSetPlayerPos(dialog, x, y, 50.0);
- DestroyMapDialog(dialog);
- }
- }
- return 1;
- }
- // In OnPlayerCommandText:
- if(strcmp(cmd, "/telemap", true) == 0) {
- new MapDialog:md = CreateMapDialog(playerid, false, true, true, MAPDIALOG_TELEPORT_TO_TARGET);
- SetMapDialogVisible(md, true);
- return 1;
- }
- // -----------------------------------------------------------
- /*
- This callback code will prevent all players from scrolling beyond x>2000, and zooming too near to the map
- */
- public OnMapDialogNavigation(MapDialog:dialog, msg, Float:oldx, Float:oldy, Float:oldzoom,
- Float:newx, Float:newy, Float:newzoom)
- {
- return (newzoom < 10.0) && (x <= 2000.0);
- }
Advertisement
Add Comment
Please, Sign In to add comment