- if (strcmp(command, "go")==0) // Use SQL by Likol
- {
- if(Config.Command_Go > thisclient->Session->accesslevel) return true;
- {
- DB->QFree( );
- return true;
- }
- if ((tmp = strtok(NULL, " ")) == NULL) tmp = 0;
- int loc = atoi(tmp);
- int x = 0;
- int y = 0;
- int map = 0;
- MYSQL_ROW row;
- MYSQL_RES *result = NULL;
- result = DB->QStore("SELECT lvlmin,map,locx,locy,mapname,lvlmax FROM list_golist WHERE isactive=1 AND loc=%i",loc);
- row = mysql_fetch_row(result);
- if (row==NULL)
- {
- SendPM(thisclient, "Please input a number after the go command, below is a list of places and their appropriate number");
- DB->QFree( );
- result = DB->QStore("SELECT loc,mapname FROM list_golist WHERE isactive=1");
- while(row = mysql_fetch_row(result)) SendPM(thisclient, "%i = %s",atoi(row[0]),row[1]);
- SendPM(thisclient, "Example; /go 1");
- DB->QFree( );
- return true;
- }
- else
- {
- if (thisclient->Stats->Level<atoi(row[0]))
- {
- SendPM(thisclient, "You need to be a least Level %i to visit %s!",atoi(row[0]),row[4]);
- DB->QFree( );
- return true;
- }
- if (thisclient->Stats->Level>atoi(row[5]))
- {
- SendPM(thisclient, "You need to be between Level %i and %i to visit %s !",atoi(row[0]),atoi(row[5]),row[4]);
- DB->QFree( );
- return true;
- }
- if ( thisclient->Stats->HP < (thisclient->Stats->MaxHP / 2) || thisclient->Stats->HP < 1 || thisclient->Session->inGame == false )
- {
- SendPM(thisclient, "You need at least 50% HP in order to warp");
- DB->QFree( );
- return true;
- }
- fPoint coord;
- int map = atoi(row[1]);
- coord.x = atoi(row[2]);
- coord.y = atoi(row[3]);
- SendPM(thisclient, "teleport to map: %i",map);
- MapList.Index[map]->TeleportPlayer( thisclient, coord, false );
- Log( MSG_GMACTION, " %s : /go %i" , thisclient->CharInfo->charname, loc);
- DB->QFree( );
- return true;
- }
- }
I pulled this code what was submitted for osRose years ago and finally for it to compile.
The one thing that does not work with this version....yet (someone will figure out why) is if you were to just type /go it should give a list. At this time it crashes the server.
But the SQL works and you can add/delete from the sql on the fly and test.
I will add the sql that I am currently using in the next message, but here is the code to replace the entire GO command in the gmcmds file