- What's New?
- Forum
- Become Premium
- Join us on Discord
- MMOCoin
- 🛒Marketplace
- Join our Telegram
- 💸Buy MMOCoin
- 💱MMOSwap
- Forum
- World of Warcraft Emulators
- Coding
- C++ scripts & patches
- Friend Porter

Results 1 to 3 of 3
Thread: Friend Porter
Threaded View
-
27-01-09, 01:52 PM #2Friend Porter
Description:
This gossip script lets players teleport to other players for a set amount of gold. When they use this item, a text box shows up, in which they input the name of the player they wish to port to. Then, if the rules allow it, they will port to his location.
This is the script you've seen in countless repacks and servers.
Made by Spidey @ Aspiredev
Code:* Friend Porter * Copyright (C) 2008 Spidey <http://www.aspiredev.org/> * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ #include "StdAfx.h" #include "Setup.h" // This determines the cost of the port in copper #define FRIENDCOST 100000 // The ID of the item used #define FRIENDPORTID 61000 #define FP_ERR(s)\ Plr->BroadcastMessage(s);\ Plr->Gossip_Complete();\ return; class SCRIPT_DECL FriendGrab : public GossipScript { public: void GossipHello(Object * pObject, Player* Plr, bool AutoSend); void GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code); void GossipEnd(Object * pObject, Player* Plr); void Destroy() { delete this; } }; void FriendGrab::GossipHello(Object * pObject, Player* Plr, bool AutoSend) { if(Plr->GetUInt32Value(PLAYER_FIELD_COINAGE) < FRIENDCOST) { Plr->BroadcastMessage("You don't have enough gold to teleport to another player."); return; } GossipMenu *Menu; objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr); Menu->AddItem(1, "Teleport to friend", 1, 1); //Note: // When menus have only one item, the one item gets auto-picked; // The text "Teleport to friend" will not show up ingame unless you add at least one other item. // Instead, the item will automatically pop the code request window. if(AutoSend) Menu->SendTo(Plr); } void FriendGrab::GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code) { switch(IntId) { case 0: { GossipHello(pObject, Plr, true); }break; case 1: { if(!Code) return; if(Plr->GetUInt32Value(PLAYER_FIELD_COINAGE) < FRIENDCOST) return; Player * pTarget = objmgr.GetPlayer(Code, false); if(!pTarget) FP_ERR("Player does not exist or is offline."); if(pTarget->GetSession()->HasGMPermissions()) FP_ERR("Player does not exist or is offline."); //As to not expose GMs if(Plr->CombatStatus.IsInCombat()) FP_ERR("You cannot teleport while in combat."); if(Plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAG_FREE_FOR_ALL_PVP)) FP_ERR("You can't port while in a PvP zone."); if(pTarget->GetTeam() != Plr->GetTeam()) FP_ERR("Player is from the opposing faction."); if(pTarget->CombatStatus.IsInCombat()) FP_ERR("Your friend is in combat, you cannot teleport to him now."); if(pTarget->HasFlag(PLAYER_FLAGS, PLAYER_FLAG_FREE_FOR_ALL_PVP)) FP_ERR("You can't port to a player in a PvP zone."); uint32 pMap = pTarget->GetMapId(); if(pMap != 0 && pMap != 1 && pMap != 530) //Assume that all other maps are instances FP_ERR("Cannot port to a player inside an instance"); //if we reached so far, the player can port Plr->SetUInt32Value(PLAYER_FIELD_COINAGE, Plr->GetUInt32Value(PLAYER_FIELD_COINAGE)-FRIENDCOST); float pX = pTarget->GetPositionX(); float pY = pTarget->GetPositionY(); float pZ = pTarget->GetPositionZ(); float pO = pTarget->GetOrientation(); Plr->Gossip_Complete(); pTarget->BroadcastMessage("%s is porting to your location.", Plr->GetName()); Plr->EventTeleport(pMap, pX, pY, pZ); Plr->SetOrientation(pO); }break; } }; void FriendGrab::GossipEnd(Object * pObject, Player* Plr) { GossipScript::GossipEnd(pObject, Plr); } void SetupFriendPorter(ScriptMgr * mgr) { GossipScript * gs = (GossipScript*) new FriendGrab(); mgr->register_item_gossip_script(FRIENDPORTID, gs); }
Related Threads - Scroll Down after related threads if you are only interested to view replies for above post/thread
Quick Navigation
C++ scripts & patches
Top
- Site Areas
- Settings
- Private Messages
- Subscriptions
- Who's Online
- Search Forums
- Forums Home
- Forums
- MMOPro Portal
- MMOCoin
- Marketplace & Services
- WoW Buy, Sell, Trade
- Dota 2 Buy, Sell, Trade
- Apex Legends Buy, Sell, Trade
- Counter-Strike Buy, Sell, Trade
- LoL Buy, Sell, Trade
- Blade & Soul Buy, Sell, Trade
- Lineage 2 Buy, Sell, Trade
- Hosting
- Playsation, Xbox and Nintendo
- SEO Link Building, SEO Services
- Artists Market
- Reddit Buy, Sell, Trade
- Advertising
- CryptoCurrencies
- Partner Links, Top Listings and Recruitment
- World of Warcraft Emulators
- World of Warcraft
- MMO and MMORPG
- Other Online Games
- Softwares & Programming
- Archive
«
Previous Thread
|
Next Thread
»
Visitors found this page by searching for:
mangos c friend porter
Welcome to the best MMORPGs Gaming Forum
Grab everything you need to play like a pro
Mmopro.org is a free community of players from all over the world that strive to share everything they experience from MMORPGs genre. So if you are looking for an independent web portal to discuss the free MMORPG games, search no further. Here you can talk about the most popular free-to-play multiplayer games including World of Warcraft, Diablo 3, Age of Conan, Counter-Strike, Dota 2, and much more. On top of that, you can read or even take part in the various software discussions to help people become more detail-oriented in the extensive world of IT technologies.
Versatility and convenience
More than just a forum, Mmopro.org provides you with the top MMO servers ranking list as well as with an appropriate market place to trade or share game codes, gold guides and trusted hacks for your favorite WoW, Blade & Soul, or League of Legends. With Mmopro.org, you can easily keep your gaming experience evolving.
Become our register user. Thus, you will get such benefits as:
Great community to join
To start, just pick out the forum that you would like to visit from the published list. Whether you are seeking a new RPG to play or running into some mechanical or content issues with the chosen game, make sure you can find the proper answer on our website. Our MMORPGs gaming forum is filled with opportunity for members, publishers, or programmers. Here you can release your WoW repacks, hire a highly skilled developer, or spread the word about game bugs.