EOSERV Forum > Programming > Need Warp Command
Topic is locked.
Page: << 1 >>
Need Warp Command
Author Message
Post #196059 Need Warp Command

I've searched around looking for it, but most of them are un-stable/I get errors.

I need a warp command for players(Ex. #warp <map name>). If someone can post one it would be appreciated. 

10 years, 15 weeks ago
Post #196069 Re: Need Warp Command

Credits to Ryouken for this:

void GoWarp(const std::vector<std::string>& arguments, Character* from)

{

    std::string loc = arguments[0];


    if (from->mapid != util::to_int(from->world->config["JailMap"]))

    {

        if(util::to_int(from->world->warps_config[loc + ".map"]) > 0)

        {

            int item = util::to_int(from->world->warps_config[loc + ".item"]);

            EIF_Data *itemd = from->world->eif->Get(item);

            int amount = util::to_int(from->world->warps_config[loc + ".amount"]);

            int level = util::to_int(from->world->warps_config[loc + ".level"]);

            int mapid = util::to_int(from->world->warps_config[loc + ".map"]);

            int xloc = util::to_int(from->world->warps_config[loc + ".x"]);

            int yloc = util::to_int(from->world->warps_config[loc + ".y"]);

            int truelevel = from->level + (from->rebirth * util::to_int(from->world->config["RebirthReq"]));


            if(xloc > 0 && yloc > 0)

            {

                if (from->HasItem(item) >= amount || item == 0)

                {

                    if (truelevel >= level)

                    {

                        from->Warp(mapid, xloc, yloc, WARP_ANIMATION_ADMIN);

                    }

                    else

                    {

                        from->StatusMsg("You need to be level " + util::to_string(level) + " to warp there.");

                    }

                }

                else

                {

                    from->StatusMsg("You need " + util::to_string(amount) + " " + itemd->name + " to warp there.");

                }


                if (from->HasItem(item) >= amount && amount > 0)

                {

                    from->DelItem(item, amount);


                    PacketBuilder builder(PACKET_ITEM, PACKET_KICK, 7);

                    builder.AddShort(item);

                    builder.AddInt(from->HasItem(item));

                    builder.AddChar(from->weight);

                    from->Send(builder);

                }

            }

        }

        else

        {

            from->StatusMsg("This location does not exsist.");

        }

    }

    else

    {

        from->StatusMsg("Warping is not allowed on this map.");

    }

}


Oh and don't forget this ;o

RegisterCharacter({"goto", {"destination"}, {}, 2}, GoWarp);

10 years, 15 weeks ago
Post #196070 Re: Need Warp Command

How would I go about adding warps?

10 years, 15 weeks ago
Post #196075 Re: Need Warp Command

Might want to add this as well so you can have players use it: https://eoserv.net/forum/topic/20688

10 years, 15 weeks ago
Page: << 1 >>
Topic is locked.
EOSERV Forum > Programming > Need Warp Command