Jump to content
  • 0

script:implode @go


Question

Posted (edited)

Hey guys, so ive modified my src/map/atcommand.c file.

 

Ive disabled some @go numbers since im pre-renewal, i dont want them being able to get to them maps.

 

Normally when i use @go on its own it brings up a list of numbers with maps etc

 

After the edit, when i do @go it just takes me straight to prontera, i get no list and then i get this warning message via SSH / Putty.
 

[Warning]: script:implode: array length = 0

 

Anything ive done wrong?

 

Here is what ive edited.

 

src/map/atcommand.c

/*==========================================
 * @go [city_number or city_name] - Updated by Harbin
 *------------------------------------------*/
ACMD_FUNC(go)
{
	int i;
	int town;
	char map_name[MAP_NAME_LENGTH];
	int16 m;

	const struct {
		char map[MAP_NAME_LENGTH];
		int x, y;
	} data[] = {
		{ MAP_PRONTERA,    156, 191 }, //  0=Prontera
		{ MAP_MORROC,      156,  93 }, //  1=Morroc
		{ MAP_GEFFEN,      120,  67 }, //  2=Geffen
		{ MAP_PAYON,       172, 100 }, //  3=Payon
		{ MAP_ALBERTA,     28, 235 }, //  4=Alberta
#ifdef RENEWAL
		{ MAP_IZLUDE,      128, 146 }, //  5=Izlude (Renewal)
#else
		{ MAP_IZLUDE,      128, 96 }, //  5=Izlude
#endif
		{ MAP_ALDEBARAN,   140, 116 }, //  6=Al de Baran
		{ MAP_LUTIE,       147, 134 }, //  7=Lutie
		{ MAP_COMODO,      189, 159 }, //  8=Comodo
		{ MAP_YUNO,        158,  181 }, //  9=Yuno
		{ MAP_AMATSU,      111,  152 }, // 10=Amatsu
		{ MAP_GONRYUN,     160, 121 }, // 11=Gonryun
		{ MAP_UMBALA,       123, 133 }, // 12=Umbala
		{ MAP_NIFLHEIM,     194, 185 }, // 13=Niflheim
		{ MAP_LOUYANG,     217,  98 }, // 14=Louyang
		//{ MAP_NOVICE,       53, 111 }, // 15=Training Grounds
		{ MAP_JAIL,         23,  61 }, // 15=Prison
		//{ MAP_JAWAII,      249, 127 }, // 17=Jawaii
		{ MAP_AYOTHAYA,    218, 175 }, // 16=Ayothaya
		{ MAP_EINBROCH,     158, 311 }, // 17=Einbroch
		{ MAP_LIGHTHALZEN, 159,  95 }, // 18=Lighthalzen
		{ MAP_EINBECH,      43,  208 }, // 19=Einbech
		{ MAP_HUGEL,        96, 115 }, // 20=Hugel
		{ MAP_RACHEL,      130, 102 }, // 21=Rachel
		{ MAP_VEINS,       218, 129 }, // 22=Veins
		{ MAP_MOSCOVIA,    223, 187 }, // 23=Moscovia
		{ MAP_MIDCAMP,     180, 240 }, // 24=Midgard Camp
		{ MAP_MANUK,       311, 180 }, // 25=Manuk
		{ MAP_SPLENDIDE,   198, 175 }, // 26=Splendide
		//{ MAP_BRASILIS,    182, 239 }, // 29=Brasilis
		//{ MAP_DICASTES,    198, 187 }, // 30=El Dicastes
		//{ MAP_MORA,         44, 151 }, // 31=Mora
		//{ MAP_DEWATA,      200, 180 }, // 32=Dewata
		//{ MAP_MALANGDO,    140, 114 }, // 33=Malangdo Island
		//{ MAP_MALAYA,      242, 211 }, // 34=Malaya Port
		//{ MAP_ECLAGE,      110,  39 }, // 35=Eclage
	};

	nullpo_retr(-1, sd);

	if( map[sd->bl.m].flag.nogo && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE) ) {
		clif_displaymessage(sd->fd,msg_txt(sd,995)); // You cannot use @go on this map.
		return 0;
	}

	memset(map_name, '\0', sizeof(map_name));
	memset(atcmd_output, '\0', sizeof(atcmd_output));

	// get the number
	town = atoi(message);

	if (!message || !*message || sscanf(message, "%11s", map_name) < 1 || town < 0 || town >= ARRAYLENGTH(data))
	{// no value matched so send the list of locations
		const char* text;

		// attempt to find the text help string
		text = atcommand_help_string( command );

		clif_displaymessage(fd, msg_txt(sd,38)); // Invalid location number, or name.

		if( text )
		{// send the text to the client
			clif_displaymessage( fd, text );
		}

		return -1;
	}

	// get possible name of the city
	map_name[MAP_NAME_LENGTH-1] = '\0';
	for (i = 0; map_name[i]; i++)
		map_name[i] = TOLOWER(map_name[i]);
	// try to identify the map name
	if (strncmp(map_name, "prontera", 3) == 0) {
		town = 0;
	} else if (strncmp(map_name, "morocc", 4) == 0 ||
	           strncmp(map_name, "morroc", 4) == 0) {
		town = 1;
	} else if (strncmp(map_name, "geffen", 3) == 0) {
		town = 2;
	} else if (strncmp(map_name, "payon", 3) == 0) {
		town = 3;
	} else if (strncmp(map_name, "alberta", 3) == 0) {
		town = 4;
	} else if (strncmp(map_name, "izlude", 3) == 0) {
		town = 5;
	} else if (strncmp(map_name, "aldebaran", 3) == 0) {
		town = 6;
	} else if (strncmp(map_name, "lutie", 3) == 0 ||
	           strcmp(map_name,  "christmas") == 0 ||
	           strncmp(map_name, "xmas", 3) == 0 ||
	           strncmp(map_name, "x-mas", 3) == 0) {
		town = 7;
	} else if (strncmp(map_name, "comodo", 3) == 0) {
		town = 8;
	} else if (strncmp(map_name, "juno", 3) == 0 ||
	           strncmp(map_name, "yuno", 3) == 0) {
		town = 9;
	} else if (strncmp(map_name, "amatsu", 3) == 0) {
		town = 10;
	} else if (strncmp(map_name, "kunlun", 3) == 0 ||
	           strncmp(map_name, "gonryun", 3) == 0) {
		town = 11;
	} else if (strncmp(map_name, "umbala", 3) == 0) {
		town = 12;
	} else if (strncmp(map_name, "niflheim", 3) == 0) {
		town = 13;
	} else if (strncmp(map_name, "louyang", 3) == 0) {
		town = 14;
	} else if (strncmp(map_name, "new_1-1", 3) == 0 ||
	           strncmp(map_name, "startpoint", 3) == 0 ||
	           strncmp(map_name, "beginning", 3) == 0) {
		town = 0;
	} else if (strncmp(map_name, "sec_pri", 3) == 0 ||
	           strncmp(map_name, "prison", 3) == 0 ||
	           strncmp(map_name, "jail", 3) == 0) {
		town = 15;
	} else if (strncmp(map_name, "jawaii", 3) == 0) {
		town = 0;
	} else if (strncmp(map_name, "ayothaya", 3) == 0) {
		town = 16;
	} else if (strncmp(map_name, "einbroch", 5) == 0) {
		town = 17;
	} else if (strncmp(map_name, "lighthalzen", 3) == 0) {
		town = 18;
	} else if (strncmp(map_name, "einbech", 5) == 0) {
		town = 19;
	} else if (strncmp(map_name, "hugel", 3) == 0) {
		town = 20;
	} else if (strncmp(map_name, "rachel", 3) == 0) {
		town = 21;
	} else if (strncmp(map_name, "veins", 3) == 0) {
		town = 22;
	} else if (strncmp(map_name, "moscovia", 3) == 0) {
		town = 23;
	} else if (strncmp(map_name, "mid_camp", 3) == 0) {
		town = 24;
	} else if (strncmp(map_name, "manuk", 3) == 0) {
		town = 25;
	} else if (strncmp(map_name, "splendide", 3) == 0) {
		town = 26;
	} else if (strncmp(map_name, "brasilis", 3) == 0) {
		town = 0;
	} else if (strncmp(map_name, "dicastes01", 3) == 0) {
		town = 0;
	} else if (strcmp(map_name,  "mora") == 0) {
		town = 0;
	} else if (strncmp(map_name, "dewata", 3) == 0) {
		town = 0;
	} else if (strncmp(map_name, "malangdo", 5) == 0) {
		town = 0;
	} else if (strncmp(map_name, "malaya", 5) == 0) {
		town = 0;
	} else if (strncmp(map_name, "eclage", 3) == 0) {
		town = 0;
	}

conf/help.txt

go: "Params: <city name|number>\n" "Warps you to a city.\n"
	"  -3: (Memo point 2)  14: louyang\n"
	"  -2: (Memo point 1)  15: prison/jail\n"
	"  -1: (Memo point 0)  16: ayothaya\n"
	"   0: prontera              17: einbroch\n"
	"   1: morocc                18: lighthalzen\n"
	"   2: geffen                  19: einbech\n"
	"   3: payon                  20: hugel\n"
	"   4: alberta                 21: rachel\n"
	"   5: izlude                   22: veins\n"
	"   6: aldebaran           23: moscovia\n"
	"   7: xmas (lutie)        24: midgard camp\n"
	"   8: comodo               25: manuk\n"
	"   9: yuno                     26: splendide\n"
	"  10: amatsu\n"
	"  11: gonryun\n"
	"  12: umbala\n"
	"  13: niflheim\n"
Edited by Shindu

2 answers to this question

Recommended Posts

Posted (edited)

have you comment the map on  src/common/mapindex.h?

// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder

#ifndef _MAPINDEX_H_
#define _MAPINDEX_H_

//File in charge of assigning a numberic ID to each map in existance for space saving when passing map info between servers.
extern char mapindex_cfgfile[80];

#define MAX_MAPINDEX 2000

//Some definitions for the mayor city maps.
#define MAP_PRONTERA "prontera"
#define MAP_GEFFEN "geffen"
#define MAP_MORROC "morocc"
#define MAP_ALBERTA "alberta"
#define MAP_PAYON "payon"
#define MAP_IZLUDE "izlude"
#define MAP_ALDEBARAN "aldebaran"
#define MAP_LUTIE "xmas"
#define MAP_COMODO "comodo"
#define MAP_YUNO "yuno"
#define MAP_AMATSU "amatsu"
#define MAP_GONRYUN "gonryun"
#define MAP_UMBALA "umbala"
#define MAP_NIFLHEIM "niflheim"
#define MAP_LOUYANG "louyang"
//#define MAP_JAWAII "jawaii"
#define MAP_AYOTHAYA "ayothaya"
#define MAP_EINBROCH "einbroch"
#define MAP_LIGHTHALZEN "lighthalzen"
#define MAP_EINBECH "einbech"
#define MAP_HUGEL "hugel"
#define MAP_RACHEL "rachel"
#define MAP_VEINS "veins"
#define MAP_JAIL "sec_pri"
//#define MAP_NOVICE "new_1-1"
#define MAP_MOSCOVIA "moscovia"
#define MAP_MIDCAMP "mid_camp"
#define MAP_MANUK "manuk"
#define MAP_SPLENDIDE "splendide"
//#define MAP_BRASILIS "brasilis"
//#define MAP_DICASTES "dicastes01"
//#define MAP_MORA "mora"
//#define MAP_DEWATA "dewata"
//#define MAP_MALANGDO "malangdo"
//#define MAP_MALAYA "malaya"
//#define MAP_ECLAGE "eclage"
//#define MAP_ECLAGE_IN "ecl_in01"

// When a map index search fails, return results from what map?
#define MAP_DEFAULT MAP_PRONTERA
#define MAP_DEFAULT_X 150
#define MAP_DEFAULT_Y 150

const char* mapindex_getmapname(const char* string, char* output);
const char* mapindex_getmapname_ext(const char* string, char* output);
unsigned short mapindex_name2id(const char*);
const char* mapindex_id2name(unsigned short);
void mapindex_init(void);
void mapindex_final(void);

int mapindex_addmap(int index, const char* name);
int mapindex_removemap(int index);

#endif /* _MAPINDEX_H_ */

Edited by painrugi

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...