Go command

if you have any modifications that you have made then please post them here where they can be evaluated and maybe incorporated into the repo and subsequent binary releases

Go command

Postby rl2171 on Mon Aug 29, 2016 4:42 pm

All,

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

  1.    
  2.     if (strcmp(command, "go")==0) // Use SQL by Likol
  3.     {
  4.         if(Config.Command_Go > thisclient->Session->accesslevel) return true;
  5.         {
  6.         DB->QFree( );
  7.         return true;
  8.         }
  9.         if ((tmp = strtok(NULL, " ")) == NULL) tmp = 0;
  10.         int loc = atoi(tmp);
  11.         int x = 0;
  12.         int y = 0;
  13.         int map = 0;
  14.         MYSQL_ROW row;
  15.         MYSQL_RES *result = NULL;
  16.         result = DB->QStore("SELECT lvlmin,map,locx,locy,mapname,lvlmax FROM list_golist WHERE isactive=1 AND loc=%i",loc);
  17.         row = mysql_fetch_row(result);
  18.         if (row==NULL)
  19.         {
  20.             SendPM(thisclient, "Please input a number after the go command, below is a list of places and their appropriate number");
  21.             DB->QFree( );
  22.             result = DB->QStore("SELECT loc,mapname FROM list_golist WHERE isactive=1");
  23.             while(row = mysql_fetch_row(result)) SendPM(thisclient, "%i = %s",atoi(row[0]),row[1]);
  24.             SendPM(thisclient, "Example; /go 1");
  25.             DB->QFree( );
  26.             return true;
  27.         }
  28.         else
  29.         {
  30.             if (thisclient->Stats->Level<atoi(row[0]))
  31.             {
  32.                 SendPM(thisclient, "You need to be a least Level %i to visit %s!",atoi(row[0]),row[4]);
  33.                 DB->QFree( );
  34.                 return true;
  35.             }
  36.             if (thisclient->Stats->Level>atoi(row[5]))
  37.             {
  38.                 SendPM(thisclient, "You need to be between Level %i and %i to visit %s !",atoi(row[0]),atoi(row[5]),row[4]);
  39.                 DB->QFree( );
  40.                 return true;
  41.             }
  42.             if ( thisclient->Stats->HP < (thisclient->Stats->MaxHP / 2) || thisclient->Stats->HP < 1 || thisclient->Session->inGame == false )
  43.             {
  44.                     SendPM(thisclient, "You need at least 50% HP in order to warp");
  45.                     DB->QFree( );
  46.                     return true;
  47.             }
  48.            fPoint coord;
  49.             int map = atoi(row[1]);
  50.             coord.x = atoi(row[2]);
  51.             coord.y = atoi(row[3]);
  52.             SendPM(thisclient, "teleport to map: %i",map);
  53.             MapList.Index[map]->TeleportPlayer( thisclient, coord, false );
  54.             Log( MSG_GMACTION, " %s : /go %i" , thisclient->CharInfo->charname, loc);
  55.             DB->QFree( );
  56.             return true;      
  57.         }
  58.     }
  59.  
  60.  
Image
rl2171
Admin
Admin
 
Posts: 1706
Joined: Mon Aug 06, 2007 5:17 pm
Location: Sacramento, CA USA - GMT-8

Re: Go command

Postby rl2171 on Tue Aug 30, 2016 12:52 am

Updated locations to better ones in other area, removed ones not in this version of Rose

list_golist.zip
(1.1 KiB) Downloaded 573 times
Image
rl2171
Admin
Admin
 
Posts: 1706
Joined: Mon Aug 06, 2007 5:17 pm
Location: Sacramento, CA USA - GMT-8

Re: Go command

Postby rl2171 on Tue Aug 30, 2016 12:54 am

If you type /go 19, it will show on your screen all the go locations for your character.

19 is now listed for any map.
Image
rl2171
Admin
Admin
 
Posts: 1706
Joined: Mon Aug 06, 2007 5:17 pm
Location: Sacramento, CA USA - GMT-8


Return to Submit code

Who is online

Users browsing this forum: No registered users and 2 guests