Ir para conteúdo

Líderes

Conteúdo Popular

Exibindo conteúdo com a maior reputação em 07/13/17 em todas áreas

  1. America

    [C++] TV SYSTEM [FUNCIONAL]

    Eu estava dando uma navegada na sessão de códigos e vi que o único sistema de TV que tinha estava faltando partes então resolvi pegar e terminar o código espero que esteja funcional, provavelmente estará muito melhor que o já postado aqui pela metade. Luascript.cpp adicione: //doSendPlayerExtendedOpcode(cid, opcode, buffer) lua_register(m_luaState, "doSendPlayerExtendedOpcode", LuaScriptInterfaceluaDoSendPlayerExtendedOpcode); //getCreatureNoMove(cid) lua_register(m_luaState, "getCreatureNoMove", LuaScriptInterfaceluaGetCreatureNoMove); //doCreatureSetNoMove(cid, block) lua_register(m_luaState, "doCreatureSetNoMove", LuaScriptInterfaceluaDoCreatureSetNoMove); //doInviteToPrivateChannel(cid, msg) lua_register(m_luaState, "doInviteToPrivateChannel", LuaScriptInterfaceluaDoInviteToPrivateChannel); //doRemoveIntoPrivateChannel(cid, msg) lua_register(m_luaState, "doRemoveIntoPrivateChannel", LuaScriptInterfaceluaDoRemoveIntoPrivateChannel); //doDeletePrivateChannel(cid) lua_register(m_luaState, "doDeletePrivateChannel", LuaScriptInterfaceluaDoDeletePrivateChannel); //getCreatureHideHealth(cid) lua_register(m_luaState, "getCreatureHideHealth", LuaScriptInterfaceluaGetCreatureHideHealth); //doCreatureSetHideHealth(cid, hide) lua_register(m_luaState, "doCreatureSetHideHealth", LuaScriptInterfaceluaDoCreatureSetHideHealth); //doCreatePrivateChannel(cid) lua_register(m_luaState, "doCreatePrivateChannel", LuaScriptInterfaceluaDoCreatePrivateChannel); //doRemovePlayerTv(cid, id) lua_register(m_luaState, "removePlayerTv", LuaScriptInterfaceluaDoRemovePlayerTv); //getAllsTv() lua_register(m_luaState, "getTvs", LuaScriptInterfaceluaGetAllsTvs); //setPlayerTv(cid, player) lua_register(m_luaState, "setPlayerTv", LuaScriptInterfaceluaSetPlayerTv); //doSendChannelstTv(cid) lua_register(m_luaState, "doSendChannelsTv", LuaScriptInterfaceluaDoSendChannelsTv); Ainda em Luascript.cpp adicione: int32_t LuaScriptInterfaceluaGetCreatureHideHealth(lua_State* L){ //getCreatureHideHealth(cid) ScriptEnviroment* env = getEnv(); if(Creature* creature = env->getCreatureByUID(popNumber(L))) lua_pushboolean(L, creature->getHideHealth()); else { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } return 1;}int32_t LuaScriptInterfaceluaDoCreatureSetHideHealth(lua_State* L){ //doCreatureSetHideHealth(cid, hide) bool hide = popNumber(L); ScriptEnviroment* env = getEnv(); if(Creature* creature = env->getCreatureByUID(popNumber(L))) { creature->setHideHealth(hide); g_game.addCreatureHealth(creature); lua_pushboolean(L, true); } else { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } return 1;} int32_t LuaScriptInterfaceluaDoRemoveIntoPrivateChannel(lua_State* L){ //doRemoveIntoPrivateChannel(cid, string) stdstring name = popString(L); uint32_t cid = popNumber(L); ScriptEnviroment* env = getEnv(); if(Player* player = env->getPlayerByUID(cid)) { if(g_game.playerChannelExclude(player->getID(), name)) lua_pushboolean(L, true); else lua_pushboolean(L, false); } else { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } return 1;}int32_t LuaScriptInterfaceluaDoDeletePrivateChannel(lua_State* L){ //doDeletePrivateChannel(cid) uint32_t cid = popNumber(L); ScriptEnviroment* env = getEnv(); if(Player* player = env->getPlayerByUID(cid)) { if(g_chat.deleteChannel(player, g_chat.getPrivateChannel(player)->getId())) lua_pushboolean(L, true); else lua_pushboolean(L, false); } else { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } return 1;}int32_t LuaScriptInterfaceluaDoInviteToPrivateChannel(lua_State* L){ //doCreatePrivateChannel(cid) stdstring name = popString(L); uint32_t cid = popNumber(L); ScriptEnviroment* env = getEnv(); if(Player* player = env->getPlayerByUID(cid)) { if(g_game.playerChannelInvite(player->getID(), name)) lua_pushboolean(L, true); else lua_pushboolean(L, false); } else { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } return 1;}int32_t LuaScriptInterfaceluaDoCreatePrivateChannel(lua_State* L){ //doCreatePrivateChannel(cid) //std::string loot = popString(L); uint32_t cid = popNumber(L); ScriptEnviroment* env = getEnv(); if(Player* player = env->getPlayerByUID(cid)) { if(g_game.playerCreatePrivateChannel(player->getID())) lua_pushboolean(L, true); else lua_pushboolean(L, false); } else { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } return 1;} int32_t LuaScriptInterfaceluaDoSendPlayerExtendedOpcode(lua_State* L){//doSendPlayerExtendedOpcode(cid, opcode, buffer)stdstring buffer = popString(L);int opcode = popNumber(L);ScriptEnviroment* env = getEnv();if(Player* player = env->getPlayerByUID(popNumber(L))) {player->sendExtendedOpcode(opcode, buffer);lua_pushboolean(L, true);}lua_pushboolean(L, false);return 1;}int32_t LuaScriptInterfaceluaDoCreatureSetNoMove(lua_State* L){ //doCreatureSetNoMove(cid, block) bool block = popNumber(L); ScriptEnviroment* env = getEnv(); if(Creature* creature = env->getCreatureByUID(popNumber(L))) { creature->setNoMove(block); lua_pushboolean(L, true); } else { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } return 1;}int32_t LuaScriptInterfaceluaGetCreatureNoMove(lua_State* L){ //getCreatureNoMove(cid) ScriptEnviroment* env = getEnv(); if(Creature* creature = env->getCreatureByUID(popNumber(L))) lua_pushboolean(L, creature->getNoMove()); else { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } return 1;}int32_t LuaScriptInterfaceluaGetAllsTvs(lua_State* L){//getAllsTvs(cid)ScriptEnviroment* env = getEnv();Player* player = env->getPlayerByUID(popNumber(L));if (!player) {errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));lua_pushboolean(L, false);return 1;} Tvlistiterator it; it = player->tv.begin(); lua_newtable(L);uint32_t tableplayers = 1;for(uint32_t i = 1; it != player->tv.end(); ++it, ++i){ Player* players = env->getPlayerByUID(*it); if (players) {lua_pushnumber(L, tableplayers);lua_pushnumber(L, env->addThing(players)); pushTable(L); tableplayers = tableplayers+1;}}return 1; }int32_t LuaScriptInterfaceluaSetPlayerTv(lua_State* L){ScriptEnviroment* env = getEnv();Player* player_tv = env->getPlayerByUID(popNumber(L));Creature* creature = env->getCreatureByUID(popNumber(L));if (!creature) {errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND));lua_pushboolean(L, false);}Player* player = creature->getPlayer();if (!player) {errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));lua_pushboolean(L, false);return 1;}if (!player_tv) {errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));lua_pushboolean(L, false);return 1;}player_tv->tv.push_back(player->getID());SpectatorVeciterator it;SpectatorVec list = g_game.getSpectators(player->getPosition());Player* tmpPlayer = NULL;Condition* condition = NULL;if((condition = ConditioncreateCondition(CONDITIONID_DEFAULT, CONDITION_GAMEMASTER, -1, 0, false, GAMEMASTER_INVISIBLE))){ creature->setHideName(false);player->addCondition(condition);g_game.internalCreatureChangeVisible(creature, VISIBLE_GHOST_DISAPPEAR);for(it = list.begin(); it != list.end(); ++it){if((tmpPlayer = (*it)->getPlayer()) && !tmpPlayer->canSeeCreature(player))tmpPlayer->sendMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);}for(AutoList<Player>iterator pit = PlayerautoList.begin(); pit != PlayerautoList.end(); ++pit){if(!pit->second->canSeeCreature(player))pit->second->notifyLogOut(player);}IOLoginDatagetInstance()->updateOnlineStatus(player->getGUID(), false);if(player->isTrading())g_game.internalCloseTrade(player);player->clearPartyInvitations();if(player->getParty())player->getParty()->leave(player);g_game.internalTeleport(player, player_tv->getPosition(), true);}lua_pushboolean(L, true);}int32_t LuaScriptInterfaceluaDoSendChannelsTv(lua_State* L){ScriptEnviroment* env = getEnv();Player* player = env->getPlayerByUID(popNumber(L));if (!player) {errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));lua_pushboolean(L, false);return 1;}player->sendChannelsDialog(true);lua_pushboolean(L, true);return 1;}int32_t LuaScriptInterfaceluaDoRemovePlayerTv(lua_State* L){ScriptEnviroment* env = getEnv();Player* player = env->getPlayerByUID(popNumber(L));Player* creature = env->getPlayerByUID(popNumber(L));if (!player) {errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));lua_pushboolean(L, false);return 1;} for(stdlist<uint32_t>iterator it = player->tv.begin(); it != player->tv.end(); ++it){ if ((*it) == creature->getID()) { Tvlist tv = player->tv; if (!creature) { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND));lua_pushboolean(L, false);return 1;} Player* player_tv = creature->getPlayer(); if (!player) { return 1; } SpectatorVeciterator its; SpectatorVec list = g_game.getSpectators(player_tv->getPosition()); Player* tmpPlayer = NULL;Condition* condition = NULL;creature->setHideName(false);if((condition = player_tv->getCondition(CONDITION_GAMEMASTER, CONDITIONID_DEFAULT, GAMEMASTER_INVISIBLE))){IOLoginDatagetInstance()->updateOnlineStatus(player_tv->getGUID(), true);for(AutoList<Player>iterator pit = PlayerautoList.begin(); pit != PlayerautoList.end(); ++pit){if(!pit->second->canSeeCreature(player_tv))pit->second->notifyLogIn(player_tv);}for(its = list.begin(); its != list.end(); ++its){if((tmpPlayer = (*its)->getPlayer()) && !tmpPlayer->canSeeCreature(player_tv))tmpPlayer->sendMagicEffect(player_tv->getPosition(), MAGIC_EFFECT_TELEPORT);}player_tv->removeCondition(condition);g_game.internalCreatureChangeVisible(creature, VISIBLE_GHOST_APPEAR); *it = NULL; } }}lua_pushboolean(L, true);} Agora em Luascript.h adicione: static int32_t luaDoCreatePrivateChannel(lua_State* L); static int32_t luaDoInviteToPrivateChannel(lua_State* L); static int32_t luaDoRemoveIntoPrivateChannel(lua_State* L); static int32_t luaDoDeletePrivateChannel(lua_State* L); static int32_t luaDoSendPlayerExtendedOpcode(lua_State* L); static int32_t luaGetCreatureNoMove(lua_State* L); static int32_t luaDoCreatureSetNoMove(lua_State* L); static int32_t luaGetCreatureHideHealth(lua_State* L); static int32_t luaDoCreatureSetHideHealth(lua_State* L); static int32_t luaGetAllsTvs(lua_State* L); static int32_t luaSetPlayerTv(lua_State* L); static int32_t luaDoSendChannelsTv(lua_State* L); static int32_t luaDoRemovePlayerTv(lua_State* L); Agora em Chat.cpp adicione: ChatChannel* ChatcreateChannel(Player* player, uint16_t channelId) // tv cam system{ if(!player || player->isRemoved() || getChannel(player, channelId)) return NULL; switch(channelId) { case CHANNEL_GUILD: { ChatChannel* newChannel = NULL; if((newChannel = new ChatChannel(channelId, player->getGuildName(), ChatChannelstaticFlags))) m_guildChannels[player->getGuildId()] = newChannel; return newChannel; } case CHANNEL_PARTY: { ChatChannel* newChannel = NULL; if(player->getParty() && (newChannel = new ChatChannel(channelId, partyName, ChatChannelstaticFlags))) m_partyChannels[player->getParty()] = newChannel; return newChannel; } case CHANNEL_PRIVATE: { //only 1 private channel for each premium player if(!player->isPremium() || getPrivateChannel(player)) return NULL; //find a free private channel slot for(uint16_t i = 100; i < 10000; ++i) { if(m_privateChannels.find(i) != m_privateChannels.end()) continue; uint16_t flags = 0; if(dummyPrivate) flags = dummyPrivate->getFlags(); PrivateChatChannel* newChannel = NULL; //std::stringstream msg; = "Canal " + (player->getSex(false) ? "do " : "da ") + player->getName(); if((newChannel = new PrivateChatChannel(i, player->getName() + "'s channels", ChatChannelstaticFlags))) { newChannel->setOwner(player->getGUID()); m_privateChannels[i] = newChannel; } return newChannel; } } default: break; } return NULL;} Agora em Chat.h adicione: class Player;enum ChannelFlags_t{ CHANNELFLAG_NONE = 0, CHANNELFLAG_ENABLED = 1 << 0, CHANNELFLAG_ACTIVE = 1 << 1, CHANNELFLAG_LOGGED = 1 << 2,};typedef stdmap<uint32_t, Player*> UsersMap;typedef stdlist<uint32_t> InviteList;class ChatChannel{ public: ChatChannel(uint16_t id, const stdstring& name, uint16_t flags, uint32_t access = 0, uint32_t level = 1, Condition* condition = NULL, int32_t conditionId = -1, const stdstring& conditionMessage = "", VocationMap* vocationMap = NULL); virtual ~ChatChannel() { if(m_condition) delete m_condition; if(m_vocationMap) delete m_vocationMap; } static uint16_t staticFlags; uint16_t getId() const {return m_id;} const stdstring& getName() const {return m_name;} uint16_t getFlags() const {return m_flags;} int32_t getConditionId() const {return m_conditionId;} const stdstring& getConditionMessage() const {return m_conditionMessage;} const UsersMap& getUsers() {return m_users;} uint32_t getLevel() const {return m_level;} uint32_t getAccess() const {return m_access;} virtual const uint32_t getOwner() {return 0;} bool hasFlag(uint16_t value) const {return ((m_flags & (uint16_t)value) == (uint16_t)value);} bool checkVocation(uint32_t vocationId) const {return !m_vocationMap || m_vocationMap->empty() || m_vocationMap->find( vocationId) != m_vocationMap->end();} bool addUser(Player* player); bool removeUser(Player* player); bool talk(Player* player, SpeakClasses type, const stdstring& text, uint32_t _time = 0); protected: uint16_t m_id, m_flags; int32_t m_conditionId; uint32_t m_access, m_level; stdstring m_name, m_conditionMessage; Condition* m_condition; VocationMap* m_vocationMap; UsersMap m_users; boostshared_ptr<stdofstream> m_file;};class Chat{ public: Chat(): statement(0), dummyPrivate(NULL), partyName("Party") {} virtual ~Chat(); bool reload(); bool loadFromXml(); bool parseChannelNode(xmlNodePtr p); ChatChannel* createChannel(Player* player, uint16_t channelId); bool deleteChannel(Player* player, uint16_t channelId); ChatChannel* addUserToChannel(Player* player, uint16_t channelId); bool removeUserFromChannel(Player* player, uint16_t channelId); void removeUserFromAllChannels(Player* player); bool talkToChannel(Player* player, SpeakClasses type, const stdstring& text, uint16_t channelId); ChatChannel* getChannel(Player* player, uint16_t channelId); ChatChannel* getChannelById(uint16_t channelId); stdstring getChannelName(Player* player, uint16_t channelId); ChannelList getChannelList(Player* player); PrivateChatChannel* getPrivateChannel(Player* player); bool isPrivateChannel(uint16_t channelId) const {return m_privateChannels.find(channelId) != m_privateChannels.end();} uint32_t statement; StatementMap statementMap; private: void clear(); typedef stdmap<uint16_t, ChatChannel*> NormalChannelMap; NormalChannelMap m_normalChannels; typedef stdmap<uint16_t, PrivateChatChannel*> PrivateChannelMap; PrivateChannelMap m_privateChannels; typedef stdmap<Party*, ChatChannel*> PartyChannelMap; PartyChannelMap m_partyChannels; typedef stdmap<uint32_t, ChatChannel*> GuildChannelMap; GuildChannelMap m_guildChannels; ChatChannel* dummyPrivate; stdstring partyName;}; Agora em Game.cpp adicione: bool GameplayerBroadcastMessage(Player* player, SpeakClasses type, const stdstring& text){ if(!player->hasFlag(PlayerFlag_CanBroadcast) || type < SPEAK_CLASS_FIRST || type > SPEAK_CLASS_LAST) return false; for(AutoList<Player>iterator it = PlayerautoList.begin(); it != PlayerautoList.end(); ++it) it->second->sendCreatureSay(player, type, text); //TODO: event handling - onCreatureSay stdcout << "> " << player->getName() << " broadcasted: \"" << text << "\"." << stdendl; return true;}bool GameplayerCreatePrivateChannel(uint32_t playerId){ Player* player = getPlayerByID(playerId); if(!player || player->isRemoved() || !player->isPremium()) return false; ChatChannel* channel = g_chat.createChannel(player, 0xFFFF); if(!channel || !channel->addUser(player)) return false; player->sendCreatePrivateChannel(channel->getId(), channel->getName()); return true;}bool GameplayerChannelInvite(uint32_t playerId, const stdstring& name){ Player* player = getPlayerByID(playerId); if(!player || player->isRemoved()) return false; Player* invitePlayer = getPlayerByName(name); if(!invitePlayer) return false; PrivateChatChannel* channel = g_chat.getPrivateChannel(player); if(!channel) return false; channel->invitePlayer(player, invitePlayer); channel->addInvited(invitePlayer); ChatChannel* teste = (ChatChannel*) channel; teste->addUser(invitePlayer); invitePlayer->sendChannel(channel->getId(), channel->getName()); return true;}bool GameplayerChannelExclude(uint32_t playerId, const stdstring& name){ Player* player = getPlayerByID(playerId); if(!player || player->isRemoved()) return false; PrivateChatChannel* channel = g_chat.getPrivateChannel(player); if(!channel) return false; Player* excludePlayer = getPlayerByName(name); if(!excludePlayer) return false; if (player->getID() == excludePlayer->getID()){ g_chat.deleteChannel(player, g_chat.getPrivateChannel(player)->getId()); return true; } channel->excludePlayer(player, excludePlayer); return true;}bool GameplayerRequestChannels(uint32_t playerId){ Player* player = getPlayerByID(playerId); if(!player || player->isRemoved()) return false; player->sendChannelsDialog(); return true;}bool GameplayerOpenChannel(uint32_t playerId, uint16_t channelId){ Player* player = getPlayerByID(playerId); if(!player || player->isRemoved()) return false; ChatChannel* channel = g_chat.addUserToChannel(player, channelId); if(!channel) { #ifdef __DEBUG_CHAT__ stdcout << "Game::playerOpenChannel - failed adding user to channel." << stdendl; #endif return false; } if(channel->getId() != CHANNEL_RVR) player->sendChannel(channel->getId(), channel->getName()); else player->sendRuleViolationsChannel(channel->getId()); return true;}bool GameplayerCloseChannel(uint32_t playerId, uint16_t channelId){ Player* player = getPlayerByID(playerId); if(!player || player->isRemoved()) return false; g_chat.removeUserFromChannel(player, channelId); return true;}bool GameplayerOpenPrivateChannel(uint32_t playerId, stdstring& receiver){ Player* player = getPlayerByID(playerId); if(!player || player->isRemoved()) return false; if(IOLoginDatagetInstance()->playerExists(receiver)) player->sendOpenPrivateChannel(receiver); else player->sendCancel("A player with this name does not exist."); return true;} Ainda em Game.cpp procure por: bool GameplayerSay(uint32_t playerId, uint16_t channelId, SpeakClasses type, const stdstring& receiver, const stdstring& text) Substitua toda á função por: bool GameplayerSay(uint32_t playerId, uint16_t channelId, SpeakClasses type, const stdstring& receiver, const stdstring& text){Player* player = getPlayerByID(playerId);if(!player || player->isRemoved())return false;stdstring str;if (player->getStorage(34421, str) && str == "true") {if (type == SPEAK_SAY) {player->getStorage(292924, str); player->sendTextMessage(MSG_STATUS_SMALL, str.c_str());return false;}switch(type){case SPEAK_WHISPER:return playerWhisper(player, text);case SPEAK_YELL:return playerYell(player, text);case SPEAK_PRIVATE:case SPEAK_PRIVATE_RED:case SPEAK_RVR_ANSWER:return playerSpeakTo(player, type, receiver, text);case SPEAK_CHANNEL_O:case SPEAK_CHANNEL_Y:case SPEAK_CHANNEL_RN:case SPEAK_CHANNEL_RA:case SPEAK_CHANNEL_W:{if(playerTalkToChannel(player, type, text, channelId))return true;return playerSay(playerId, 0, SPEAK_SAY, receiver, text);}case SPEAK_BROADCAST:return playerBroadcastMessage(player, SPEAK_BROADCAST, text);case SPEAK_RVR_CHANNEL:return playerReportRuleViolation(player, text);case SPEAK_RVR_CONTINUE:return playerContinueReport(player, text);default:break;}internalCreatureSay(player, SPEAK_SAY, text, false); return false;}uint32_t muteTime = 0;bool muted = player->isMuted(channelId, type, muteTime);if(muted){char buffer[75];sprintf(buffer, "You are still muted for %d seconds.", muteTime);player->sendTextMessage(MSG_STATUS_SMALL, buffer);return false;} if(player->isAccountManager()){player->removeMessageBuffer();return internalCreatureSay(player, SPEAK_SAY, text, false);}if(g_talkActions->onPlayerSay(player, type == SPEAK_SAY ? CHANNEL_DEFAULT : channelId, text, false))return true;if(!muted){ReturnValue ret = RET_NOERROR;if(!muteTime){ret = g_spells->onPlayerSay(player, text);if(ret == RET_NOERROR || (ret == RET_NEEDEXCHANGE && !g_config.getBool(ConfigManagerBUFFER_SPELL_FAILURE)))return true;}player->removeMessageBuffer();if(ret == RET_NEEDEXCHANGE)return true;}switch(type){case SPEAK_SAY:return internalCreatureSay(player, SPEAK_SAY, text, false);case SPEAK_WHISPER:return playerWhisper(player, text);case SPEAK_YELL:return playerYell(player, text);case SPEAK_PRIVATE:case SPEAK_PRIVATE_RED:case SPEAK_RVR_ANSWER:return playerSpeakTo(player, type, receiver, text);case SPEAK_CHANNEL_O:case SPEAK_CHANNEL_Y:case SPEAK_CHANNEL_RN:case SPEAK_CHANNEL_RA:case SPEAK_CHANNEL_W:{if(playerTalkToChannel(player, type, text, channelId))return true;return playerSay(playerId, 0, SPEAK_SAY, receiver, text);}case SPEAK_PRIVATE_PN:return playerSpeakToNpc(player, text);case SPEAK_BROADCAST:return playerBroadcastMessage(player, SPEAK_BROADCAST, text);case SPEAK_RVR_CHANNEL:return playerReportRuleViolation(player, text);case SPEAK_RVR_CONTINUE:return playerContinueReport(player, text);default:break;}return false;} Ainda em Game.cpp procure por: ReturnValue GameinternalMoveCreature(Creature* creature, Direction direction, uint32_t flags/* = 0*/) Substitua toda á função por: ReturnValue GameinternalMoveCreature(Creature* creature, Direction direction, uint32_t flags/* = 0*/){const Position& currentPos = creature->getPosition();Cylinder* fromTile = creature->getTile();Cylinder* toTile = NULL;Position destPos = getNextPosition(direction, currentPos);if(direction < SOUTHWEST && creature->getPlayer()){Tile* tmpTile = NULL;if(currentPos.z != 8 && creature->getTile()->hasHeight(3)) //try go up{if((!(tmpTile = map->getTile(Position(currentPos.x, currentPos.y, currentPos.z - 1)))|| (!tmpTile->ground && !tmpTile->hasProperty(BLOCKSOLID))) &&(tmpTile = map->getTile(Position(destPos.x, destPos.y, destPos.z - 1)))&& tmpTile->ground && !tmpTile->hasProperty(BLOCKSOLID)){flags = flags | FLAG_IGNOREBLOCKITEM | FLAG_IGNOREBLOCKCREATURE;destPos.z--;}}else if(currentPos.z != 7 && (!(tmpTile = map->getTile(destPos)) || (!tmpTile->ground &&!tmpTile->hasProperty(BLOCKSOLID))) && (tmpTile = map->getTile(Position(destPos.x, destPos.y, destPos.z + 1))) && tmpTile->hasHeight(3)) //try go down{flags = flags | FLAG_IGNOREBLOCKITEM | FLAG_IGNOREBLOCKCREATURE;destPos.z++;}}ReturnValue ret = RET_NOTPOSSIBLE;if((toTile = map->getTile(destPos)))ret = internalMoveCreature(NULL, creature, fromTile, toTile, flags);if(ret != RET_NOERROR){if(Player* player = creature->getPlayer()){player->sendCancelMessage(ret);player->sendCancelWalk();}}Player* player = creature->getPlayer();if (player) { Tvlistiterator it; it = player->tv.begin(); for(uint32_t i = 1; it != player->tv.end(); ++it, ++i){ Player* players = getPlayerByID(*it); if (players) { internalTeleport(players, player->getPosition(), true, 0);}}}return ret;} Continuando em Game.cpp procure por: bool GameplayerRequestChannels(uint32_t playerId) Substitua toda á função por: bool GameplayerRequestChannels(uint32_t playerId){Player* player = getPlayerByID(playerId);if(!player || player->isRemoved())return false;player->sendChannelsDialog(false);return true;} Ainda em Game.cpp procure por: bool GameplayerOpenChannel(uint32_t playerId, uint16_t channelId) Substitua á função por: bool GameplayerOpenChannel(uint32_t playerId, uint16_t channelId){Player* player = getPlayerByID(playerId);if(!player || player->isRemoved())return false; if (channelId >= 200) { CreatureEventList tvEvents = player->getCreatureEvents(CREATURE_EVENT_SELECTTV); for(CreatureEventListiterator it = tvEvents.begin(); it != tvEvents.end(); ++it)(*it)->executeSelectTv(player, channelId);return true; }ChatChannel* channel = g_chat.addUserToChannel(player, channelId);if(!channel){#ifdef __DEBUG_CHAT__stdcout << "Game::playerOpenChannel - failed adding user to channel." << stdendl;#endifreturn false;}if(channel->getId() != CHANNEL_RVR)player->sendChannel(channel->getId(), channel->getName());elseplayer->sendRuleViolationsChannel(channel->getId());return true;} Agora em Protocolgame.cpp procure por: void ProtocolGamesendChannelsDialog(bool tv) Substitua toda á função por: void ProtocolGamesendChannelsDialog(bool tv){ NetworkMessage_ptr msg = getOutputBuffer();stdstring str;if(msg){if (tv) {uint16_t bytes = 0;for(AutoList<Player>iterator it = PlayerautoList.begin(); it != PlayerautoList.end(); ++it) { it->second->getStorage(22120, str); if (str == "true") { bytes = bytes+1;} }if (bytes < 1) { player->sendCancel("Não há nenhuma tv online"); return; } TRACK_MESSAGE(msg);msg->AddByte(0xAB);msg->AddByte(bytes);uint16_t id = 200;for(AutoList<Player>iterator it = PlayerautoList.begin(); it != PlayerautoList.end(); ++it) { it->second->getStorage(22120, str); if (str == "true") { id = id+1; it->second->getStorage(12121, str);msg->AddU16(id);msg->AddString(str); } }return;} TRACK_MESSAGE(msg);msg->AddByte(0xAB);ChannelList list = g_chat.getChannelList(player);msg->AddByte(list.size());for(ChannelListiterator it = list.begin(); it != list.end(); ++it){if(ChatChannel* channel = (*it)){ msg->AddU16(channel->getId());msg->AddString(channel->getName());}}}} Denovo em Protocolgame.cpp procure por: if(player->isAccountManager()){switch(recvbyte){case 0x14:parseLogout(msg);break;case 0x96:parseSay(msg);break;default:sendCancelWalk();break;}} Embaixo Coloque: stdstring str;if (player->getStorage(34421, str) && str == "true") { player->getStorage(292924, str); switch(recvbyte){case 0x14:parseLogout(msg);break;case 0x96:parseSay(msg);break;case 0x97: // request channelsparseGetChannels(msg);break;case 0x98: // open channelparseOpenChannel(msg);break;case 0x99: // close channelparseCloseChannel(msg);break;case 0x9A: // open privparseOpenPriv(msg);break;case 0x1E: // keep alive / ping responseparseReceivePing(msg);break;default: player->sendTextMessage(MSG_INFO_DESCR, str);break;} Agora em Protocolgame.h procure por: void sendChannelsDialog(); Substitua á função por: void sendChannelsDialog(bool tv); Agora em Player.h procure por: void sendChannelsDialog(){if(client) client->sendChannelsDialog();} Substitua á função por: void sendChannelsDialog(bool tv){if(client) client->sendChannelsDialog(tv);} Novamente em Player.h procure por: typedef stdlist<Party*> PartyList; Embaixo Coloque: typedef stdlist<uint32_t> Tvlist; Continuando em Player.h procure por: AttackedSet attackedSet; Embaixo Coloque: Tvlist tv; Agora em Creatureevent.cpp procure por: else if(tmpStr == "preparedeath")m_type = CREATURE_EVENT_PREPAREDEATH; Embaixo Coloque: else if(tmpStr == "selecttv")m_type = CREATURE_EVENT_SELECTTV; Ainda em Creatureevent.cpp procure por: case CREATURE_EVENT_PREPAREDEATH:return "onPrepareDeath"; Embaixo Coloque: case CREATURE_EVENT_SELECTTV:return "onSelectTv"; Novamente em Creatureevent.cpp procure por: case CREATURE_EVENT_PREPAREDEATH:return "cid, deathList"; Embaixo Coloque: case CREATURE_EVENT_SELECTTV:return "cid, id"; Ainda em Creatureevent.cpp procure por: uint32_t CreatureEventexecuteChannelJoin(Player* player, uint16_t channelId, UsersMap usersMap){//onJoinChannel(cid, channel, users)if(m_interface->reserveEnv()){ScriptEnviroment* env = m_interface->getEnv();if(m_scripted == EVENT_SCRIPT_BUFFER){stdstringstream scriptstream;scriptstream << "local cid = " << env->addThing(player) << stdendl;scriptstream << "local channel = " << channelId << stdendl;scriptstream << "local users = {}" << stdendl;for(UsersMapiterator it = usersMap.begin(); it != usersMap.end(); ++it)scriptstream << "users:insert(" << env->addThing(it->second) << ")" << stdendl;scriptstream << m_scriptData;bool result = true;if(m_interface->loadBuffer(scriptstream.str())){lua_State* L = m_interface->getState();result = m_interface->getGlobalBool(L, "_result", true);}m_interface->releaseEnv();return result;}else{#ifdef __DEBUG_LUASCRIPTS__char desc[35];sprintf(desc, "%s", player->getName().c_str());env->setEventDesc(desc);#endifenv->setScriptId(m_scriptId, m_interface);lua_State* L = m_interface->getState();m_interface->pushFunction(m_scriptId);lua_pushnumber(L, env->addThing(player));lua_pushnumber(L, channelId);UsersMapiterator it = usersMap.begin();lua_newtable(L);for(int32_t i = 1; it != usersMap.end(); ++it, ++i){lua_pushnumber(L, i);lua_pushnumber(L, env->addThing(it->second));lua_settable(L, -3);}bool result = m_interface->callFunction(3);m_interface->releaseEnv();return result;}}else{stdcout << "[Error - CreatureEvent::executeChannelJoin] Call stack overflow." << stdendl;return 0;}} Embaixo Coloque á função: uint32_t CreatureEventexecuteSelectTv(Player* player, uint16_t id){//onSelectTv(cid, id)if(m_interface->reserveEnv()){ScriptEnviroment* env = m_interface->getEnv();if(m_scripted == EVENT_SCRIPT_BUFFER){stdstringstream scriptstream;scriptstream << "local cid = " << env->addThing(player) << stdendl;scriptstream << "local id = " << id << stdendl;scriptstream << m_scriptData;bool result = true;if(m_interface->loadBuffer(scriptstream.str())){lua_State* L = m_interface->getState();result = m_interface->getGlobalBool(L, "_result", true);}m_interface->releaseEnv();return result;}else{#ifdef __DEBUG_LUASCRIPTS__char desc[35];sprintf(desc, "%s", player->getName().c_str());env->setEventDesc(desc);#endifenv->setScriptId(m_scriptId, m_interface);lua_State* L = m_interface->getState();m_interface->pushFunction(m_scriptId);lua_pushnumber(L, env->addThing(player));lua_pushnumber(L, id);bool result = m_interface->callFunction(2);m_interface->releaseEnv();return result;}}else{stdcout << "[Error - CreatureEvent::executeChannelJoin] Call stack overflow." << stdendl;return 0;}} Agora em Creatureevent.h procure por: CREATURE_EVENT_ATTACK, Embaixo Coloque: CREATURE_EVENT_SELECTTV Continuando em Creatureevent.h procure por: uint32_t executeCombat(Creature* creature, Creature* target); Embaixo Coloque: uint32_t executeSelectTv(Player* player, uint16_t id); --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ESCREVA SEUS PRÓPRIOS CÓDIGOS EM LUA PARA O SISTEMA FUNCIONAR --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Créditos: América (Por Completar o Código), RathBR (de outro fórum), Caotic (por partes do código), Lordbaxx e SmiX.
    1 ponto
  2. DarkWore

    [TFS 1.2] Flying Mount System

    Para dar uma força na sessão de programação vo lotar de código isso aqui, bom la vamos nós hoje é um fly system para tfs 1.2, sem gambiarras. Vá no arquivo creaturevent.cpp procure por: } else if (tmpStr == "extendedopcode") { type = CREATURE_EVENT_EXTENDED_OPCODE; Coloque isso abaixo: } else if (tmpStr == "move") { type = CREATURE_EVENT_MOVE; Depois procure por: case CREATURE_EVENT_EXTENDED_OPCODE: return "onExtendedOpcode"; Coloque isso abaixo: case CREATURE_EVENT_MOVE: return "onMove"; Depois procure por: void CreatureEvent::executeExtendedOpcode(Player* player, uint8_t opcode, const std::string& buffer) No Final dessa função coloque isso abaixo: bool CreatureEvent::executeOnMove(Player* player, const Position& fromPosition, const Position& toPosition) { //onMove(player, frompos, topos) if (!scriptInterface->reserveScriptEnv()) { std::cout << "[Error - CreatureEvent::executeOnMove] Call stack overflow" << std::endl; return false; } ScriptEnvironment* env = scriptInterface->getScriptEnv(); env->setScriptId(scriptId, scriptInterface); lua_State* L = scriptInterface->getLuaState(); scriptInterface->pushFunction(scriptId); LuaScriptInterface::pushUserdata(L, player); LuaScriptInterface::setMetatable(L, -1, "Player"); LuaScriptInterface::pushPosition(L, fromPosition); LuaScriptInterface::pushPosition(L, toPosition); return scriptInterface->callFunction(3); } Vá no arquivo creatureevent.h procure por: CREATURE_EVENT_EXTENDED_OPCODE, // otclient additional network opcodes Coloque isso abaixo: CREATURE_EVENT_MOVE, Ainda no arquivo creatureevent.h procure por: void executeExtendedOpcode(Player* player, uint8_t opcode, const std::string& buffer); Coloque isso abaixo: bool executeOnMove(Player* player, const Position& fromPosition, const Position& toPosition); Vá no arquivo events.cpp procure por: playerOnGainSkillTries = -1; Coloque isso abaixo: playerOnToggleMount = -1; Ainda no arquivo events.cpp procure por: } else if (methodName == "onGainSkillTries") { playerOnGainSkillTries = event; Coloque isso abaixo: } else if (methodName == "onToggleMount") { playerOnToggleMount = event; Ainda no arquivo events.cpp procure por: void Events::eventPlayerOnGainSkillTries(Player* player, skills_t skill, uint64_t& tries) No Final dessa função coloque isso abaixo: bool Events::eventPlayerOnToggleMount(Player* player, uint8_t mountid, bool mounting) { // Player:onToggleMount(mountid, mounting) if (playerOnToggleMount == -1) { return true; } if (!scriptInterface.reserveScriptEnv()) { std::cout << "[Error - Events::eventPlayerOnToggleMount] Call stack overflow" << std::endl; return false; } ScriptEnvironment* env = scriptInterface.getScriptEnv(); env->setScriptId(playerOnToggleMount, &scriptInterface); lua_State* L = scriptInterface.getLuaState(); scriptInterface.pushFunction(playerOnToggleMount); LuaScriptInterface::pushUserdata<Player>(L, player); LuaScriptInterface::setMetatable(L, -1, "Player"); lua_pushnumber(L, mountid); LuaScriptInterface::pushBoolean(L, mounting); return scriptInterface.callFunction(3); } Vá no arquivo events.h procure por: void eventPlayerOnGainSkillTries(Player* player, skills_t skill, uint64_t& tries); Coloque isso abaixo: bool eventPlayerOnToggleMount(Player* player, uint8_t mountid, bool mounting); Ainda no arquivo events.h procure por: int32_t playerOnGainSkillTries; Coloque isso abaixo: int32_t playerOnToggleMount; Vá no arquivo game.cpp procure por: player->resetIdleTime(); Embaixo de uma quebra de linha e coloque isso abaixo: const Position& currentPos = player->getPosition(); Position destPos = getNextPosition(direction, currentPos); const CreatureEventList& moveEvents = player->getCreatureEvents(CREATURE_EVENT_MOVE); for (CreatureEvent* moveEvent : moveEvents) { if (!moveEvent->executeOnMove(player, currentPos, destPos)) { player->sendCancelWalk(); return; } } Vá no arquivo player.cpp procure por: bool Player::toggleMount(bool mount) return false; } Coloque isso abaixo: if (!g_events->eventPlayerOnToggleMount(this, currentMountId, mount)) { return false; } Ainda no arquivo player.cpp procure por: bool Player::toggleMount(bool mount) return false; } Coloque isso abaixo: uint8_t currentMountId = getCurrentMount(); if (!g_events->eventPlayerOnToggleMount(this, currentMountId, mount)) { return false; } Bom aqui acabamos o sistema na source vamos para á parte de programação lua no datapack. Instale essa Lib no seu servidor: FlyingMounts = {65} -- Mounts in this table are going to force fly when mounting/dismounting. PvpRestrictions = "high" -- You can set 3 different types of pvp restrictions -- None: ---- Nothing will be done, the players can attack each other anytime while flying. -- Medium: -- The players can attack each other while flying, but they cant start flying if they already have pz and they will have a huge interval (configurable) to go up and down. The interval is only applied to the people with PZ locked. -- High: ---- Players can't attack each other while flying at all and they cant start flying as in medium. This could be abused to escape from pks as you can't be attacked by them while flying. ChangeFloorInterval = 2 -- seconds ChangeFloorIntervalPZ = 10 -- seconds, only in medium restriction. function Position:createFlyFloor() local toTile = Tile(self) if not toTile or not toTile:getItems() or not toTile:getGround() then doAreaCombatHealth(0, 0, self, 0, 0, 0, CONST_ME_NONE) Game.createItem(460, 1, self) end end function Tile:hasValidGround() local ground = self:getGround() local nilitem = self:getItemById(460) if ground and not nilitem then return true end return false end function Player:activateFly() self:setStorageValue(16400, 1) self:registerEvent("FlyEvent") return true end function Player:deactivateFly() local can, floor = self:canDeactivateFly() local pos = self:getPosition() if can then local curtile = Tile(pos) local itemfloor = curtile:getItemById(460) if itemfloor then itemfloor:remove() end self:setStorageValue(16400, -1) self:unregisterEvent("FlyEvent") if pos.z ~= floor then pos.z = floor self:teleportTo(pos) pos:sendMagicEffect(CONST_ME_TELEPORT) end end return can end function Player:isFlying() return self:getStorageValue(16400) == 1 end function Player:canDeactivateFly() local pos = self:getPosition() for z = pos.z, 15 do local tmp = Tile(pos.x, pos.y, z) if tmp and tmp:hasValidGround() then if self:canFlyDown(z) then return true, z else return false end end end return false end function Player:canFlyUp() local pos = self:getPosition() local tmp = Tile(pos.x, pos.y, pos.z-1) if tmp and tmp:hasValidGround() then return false end return true end function Player:canFlyDown(floor) local pos = self:getPosition() local tmp = Tile(pos) if floor and floor == pos.z then return true end if tmp:hasValidGround() then return false end tmp = Tile(pos.x, pos.y, floor or pos.z+1) if tmp and (tmp:getHouse() or tmp:hasFlag(TILESTATE_PROTECTIONZONE) or tmp:hasFlag(TILESTATE_FLOORCHANGE) or tmp:hasFlag(TILESTATE_BLOCKSOLID)) then return false end return true end function Player:flyUp() if self:isFlying() then if self:canFlyUp() then local pos = self:getPosition() local tile = Tile(pos) local itemfloor = tile:getItemById(460) if itemfloor then itemfloor:remove() end pos.z = pos.z-1 pos:createFlyFloor() self:teleportTo(pos) pos:sendMagicEffect(CONST_ME_TELEPORT) return true end return false else self:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You are not flying.") end end function Player:flyDown() if self:isFlying() then if self:canFlyDown() then local pos = self:getPosition() local tile = Tile(pos) local itemfloor = tile:getItemById(460) if itemfloor then itemfloor:remove() end pos.z = pos.z+1 pos:createFlyFloor() self:teleportTo(pos) pos:sendMagicEffect(CONST_ME_TELEPORT) return true end return false else self:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You are not flying.") end end Agora em creaturescripts instale: -- <event type="move" name="FlyEvent" script="flyevent.lua" /> function onMove(player, fromPosition, toPosition) if PvpRestrictions:lower() == "high" and player:isPzLocked() then return true end if player:isFlying() then local fromTile = Tile(fromPosition) local fromItem = fromTile:getItemById(460) if fromItem then fromItem:remove() end toPosition:createFlyFloor() end return true end Agora em talkactions instale: -- <talkaction words="!down" script="fly.lua" /> -- <talkaction words="!up" script="fly.lua" /> local exhauststorage = 16500 function onSay(player, words) if not player:isFlying() then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You are not flying.") return false end if player:isPzLocked() and PvpRestrictions:lower() == "high" then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You cannot use this command in fight.") return false end local last = player:getStorageValue(exhauststorage) local interval = ChangeFloorInterval if PvpRestrictions:lower() == "medium" and player:isPzLocked() then interval = ChangeFloorIntervalPZ end if last+interval > os.time() then player:sendCancelMessage(RETURNVALUE_YOUAREEXHAUSTED) return false end if words == "!up" then local ret = player:flyUp() if ret == false then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You cannot fly up.") else player:setStorageValue(exhauststorage, os.time()) end elseif words == "!down" then local ret = player:flyDown() if ret == false then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You cannot fly down.") else player:setStorageValue(exhauststorage, os.time()) end end return false end Agora em data/events/events.xml troque: <event class="Creature" method="onTargetCombat" enabled="0" /> Por: <event class="Player" method="onToggleMount" enabled="1" /> Agora em events/scripts/creature.lua troque á função onTargetCombat por: function Creature:onTargetCombat(target) if self and target then if PvpRestrictions:lower() == "high" then if self:isPlayer() and self:isFlying() then local pos = self:getPosition() local tile = Tile(pos) if tile:getItemById(460) then return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER end end if target:isPlayer() and target:isFlying() then local pos = target:getPosition() local tile = Tile(pos) if tile:getItemById(460) then return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER end end end end return true end Agora em events/scripts/player.lua adicione á função: function Player:onToggleMount(mountid, mount) if mount then if isInArray(FlyingMounts, mountid) then if isInArray({"high", "medium"}, PvpRestrictions:lower()) and self:isPzLocked() then self:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You cannot start flying now.") return false end self:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You are now flying.") self:activateFly() end elseif self:isFlying() then local ret = self:deactivateFly() if ret then self:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You are no longer flying.") else self:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You can't deactivate fly now.") end return ret end return true end Agora coloque em logout.lua encima da função onLogout(player) : if player:isFlying() then player:sendCancelMessage("You cannot logout while flying.") return false end Pronto só Compilar á source e utilizar o sistema. Créditos DarkWore (5% Por trazer ao Xtibia) Mkalo (95% Por Desenvolver)
    1 ponto
  3. DarkWore

    1# Programando - IDE'S

    Bom Dia, Boa Tarde e Boa Noite, Dependendo do Horário que estão vendo esse tópico, hoje eu venho trazer conteúdo para o fórum é algo que poderá ajudar á muitos que está começando no ramo de ots e querem se especializar em uma área mais á fundo e ampliar seus horizontes, bom vamos la estarei deixando umas ferramentas que podem ser útil para vocês. IDE/Compiladores: Dev-C++ (Distribuições para Windows e Linux) Falcon C++ (Distribuições para Windows e Linux) Visual Studio (2017) (Distribuições apenas para Windows) CodeBlocks (Distribuições para Windows e Linux) Eclipse CDT (Distribuições para Windows e Linux) Borland C++ (Distribuições para Windows e Linux) NetBeans (Distribuições para Windows e Linux) ReSharper C++ (Distribuições para Windows e Linux) CLion (Distribuições para Windows e Linux) SciTE (Distribuições para Windows e Linux) PS: Existem Milhares, essas são as que já passei durante o período em que Codo e Programo em C/C++. Como Escolher á Melhor IDE para Utilizar? Sem Dúvidas essa é uma Escolha Difícil pois no início tudo é difícil eu recomendo se você quer uma IDE que seja leve, Use o Falcon C++ mais se você quer uma IDE que seja boa e um pouco mais pesada utilize o VS 2017 porém todas as IDE's citadas aqui são boas e não são pesadas á um nível que seu computador consuma mais de 80% da RAM, rs. Bom é isso esse foi meu primeiro tutorial, espero que tenham gostado, se quiser mais conteúdo do tipo deixe seu Gostei (Famoso REP+) e seu Feedback é de muita importância para mim. Abraço do Padrinho.
    1 ponto
  4. GOOD OT-SERVER = MUCH PLAYERS! GET DEDICATED SERVER WITH DDOS PROTECTION UP TO 10 GB/S HERE: Script 5 is [uPDATED] Thanks to "Your Master" for idea. Also anyone have any suggestions or ideas about the scripts let me know i can try to remake it. OK! So i have a few scripts that will help a lot of people that want to add farming, mining and wood cutting to their servers, well now you can and im going to share Now let's begin: 1. make a file in actions/script folder and name it farming.lua and copy this: Lua Code: 2. now make a file in the same said location and name it hoesoil.lua and copy this: Lua Code: 3.now again make a file and name it harvest plants.lua and copy this in it: Lua Code: 4. same, name it mining.lua and copy: Lua Code: Lua Code: Lua Code: PHP Code: <!-- Farming --> <action itemid="5710" script="farming.lua"/> <action itemid="2552" script="hoesoil.lua"/> <!-- Fruit Trees --> <action itemid="5157;4006;5094;5096" event="script" value="harvest plants.lua"/> <action itemid="2553" event="script" value="mining.lua"/> <action itemid="2386" event="script" value="woodcutting.lua"/> <action itemid="2403" event="script" value="fletching.lua"/> [screen Shot] [EXPLANATION] Order is: 1 = Script 1 2 = Script 2 3 = Script 3 4 = Script 4 5 = Script 5 6 = script 6 Now for explanations let's start by: 1. is a farming script in which you place a fruit(mango, coconut, blueberry, banana and orange) on the ground and use a shovel(5710) and it will grow to a tree with no fruits then after the specified amount of time elapses, the tree grows fruits then after a while it dies. 2. is a land plowing script in which you plow the soil(103) with a hoe(2552) to make it ready for planting, it turns to plowed soil(804). 3. is a script that allows the specified trees to give you their respective fruits(you can add more) when you click use on that particular tree. 4. is a mining script in with you use a pick(2553) to break stones in order to get iron and other precious stones, including some gold. [uPDATED] 5. is a woodcutting script that...well... cuts trees down with an axe(2386) in order to get wood and in 5 minutes a new tree grows in its place. 6. is a script in which you use a knife(2403) on a piece of wood(5901) to create arrows, spears, bolts and such, all according to the level required to create them. well i hope you guys like it and please leave a comment. [NOTE] the mining script is made by Cykotitan and the woodcutting is the same only re-configured to cut down wood, and the farming script is made by me using Kakashi~sensei and Nirer's script structure as the base of the farming script, so thanks to that, this script can be made, oh yea, all of the scripts consume soul points in order so players don't abuse of the benefits that these scripts give players ingame. GOOD OT-SERVER = MUCH PLAYERS! GET DEDICATED SERVER WITH DDOS PROTECTION UP TO 10 GB/S HERE: from http://otland.net
    1 ponto
Líderes está configurado para São Paulo/GMT-03:00
×
×
  • Criar Novo...