[ _ikac @ 21.06.2013. 17:16 ] @
Drustvo znam da je noob pitanje ali ja stvarno sam probao da debagujem i da sredim ovaj pocetnicki ERROR ali neide. Ja iskreno nisam vise svestan sta da probam ili jednostavno da malo ohladim glavu pa za 2 dana da dovrsim. VS 2012. Radim skriptu za World of Warcraft igricu, skripta je teleport pocu koje ce igraci moci da se teleportuju na odredjene zone na mapi i povezana je sa trinitycore engine. Greska : Error 1 error C2059: syntax error : '{' c:\users\ikac\desktop\teleporter\teleporter\my_teleporter.cpp 66 1 teleporter Microsoft kaze sledece za ovu gresku: http://msdn.microsoft.com/en-us/library/vstudio/t8xe60cf.aspx Kod koji izaziva gresu je : Code: /* * Definig zone for capital cities * * @params <int> City #ID * @params <int> Side #ID * @params <int> Icon #ID * @params <str> City Name * @param <float> X Cords * @param <float> Y Cords * * @return <array> */ typedef struct Zone; Zone city [] = { // Horde { 1, 1, 5, "Ogrimar", 44.9, 14.9 }, { 2, 1, 5, "Thunder Bluff", 50.0, 49.5 }, { 3, 1, 5, "Undercity", 61.5, 64.6 }, { 4, 1, 5, "Ogrimar", 56.4, 52.1 }, // Alliance { 5, 2, 6, "Stormwind", 32.6, 52.2 }, { 6, 2, 6, "Ironforge" , 52.8, 37.2 }, { 7, 2, 6, "Darnassus" , 68.3 37.4 }, { 7, 2, 6, "Exodar" , 80.5, 55.6 }, }; Full kod je : Code: #include "ScriptPCH.h" // Teleport data struct Eric { uint32 menu_id, next_menu_id; uint8 icon; std::string name; uint32 cost; uint8 level, faction; // 0 Both, 1 Horde, 2 Ally uint32 map; float x, y, z, o; }; /* * Definig zone for capital cities * * @params <int> City #ID * @params <int> Side #ID * @params <int> Icon #ID * @params <str> City Name * @param <float> X Cords * @param <float> Y Cords * * @return <array> */ typedef struct Zone; Zone city [] = { // Horde { 1, 1, 5, "Ogrimar", 44.9, 14.9 }, { 2, 1, 5, "Thunder Bluff", 50.0, 49.5 }, { 3, 1, 5, "Undercity", 61.5, 64.6 }, { 4, 1, 5, "Ogrimar", 56.4, 52.1 }, // Alliance { 5, 2, 6, "Stormwind", 32.6, 52.2 }, { 6, 2, 6, "Ironforge" , 52.8, 37.2 }, { 7, 2, 6, "Darnassus" , 68.3 37.4 }, { 7, 2, 6, "Exodar" , 80.5, 55.6 }, }; // TextIDs from npc_text enum eEnums { TEXT_MAIN_H = 300000, //Horde main menu text TEXT_MAIN_A = 300001, //Alliance main menu text TEXT_DUNGEON = 300002, //Dungeon teleport menu texts TEXT_RAID = 300003, //Raid teleport menu text TEXT_AREA = 300004, //Area teleport location menu texts TELEPORT_COUNT = sizeof TeLe/sizeof(*TeLe), }; #define ARE_YOU_SURE "Are you sure, that you want to go to " #define ERROR_COMBAT "|cffff0000You are in combat|r" bool Custom_FactCheck (uint32 Fact, unsigned char Key) { bool Show = false; switch (TeLe[Key].faction) { case 0: Show = true; break; case 1: if (Fact == HORDE) Show = true; break; case 2: if (Fact == ALLIANCE) Show = true; break; } return (Show); } uint32 Custom_GetText (unsigned int menu, Player* pPlayer) { uint32 TEXT = TEXT_AREA; switch (menu) { case 0: switch (pPlayer->GetTeam()) { case ALLIANCE: TEXT = TEXT_MAIN_A; break; case HORDE: TEXT = TEXT_MAIN_H; break; } case 1: case 2: case 3: TEXT = TEXT_DUNGEON; break; case 4: TEXT = TEXT_RAID; break; } return (TEXT); } void Custom_GetMenu (Player* pPlayer, Creature* pCreature, uint32 Key) { bool ENDMENU = false; for(uint32 i = 0; i < TELEPORT_COUNT; i++) { if (ENDMENU && TeLe[i].menu_id != Key) break; if (TeLe[i].menu_id == Key && pPlayer->getLevel() >= TeLe[i].level && Custom_FactCheck(pPlayer->GetTeam(), i)) { if (TeLe[i].next_menu_id != 0) pPlayer->ADD_GOSSIP_ITEM_EXTENDED(TeLe[i].icon, TeLe[i].name, GOSSIP_SENDER_MAIN, i, "", TeLe[i].cost, false); else pPlayer->ADD_GOSSIP_ITEM_EXTENDED(TeLe[i].icon, TeLe[i].name, GOSSIP_SENDER_MAIN, i, ARE_YOU_SURE+TeLe[i].name, TeLe[i].cost, false); ENDMENU = true; } } pPlayer->PlayerTalkClass->SendGossipMenu(Custom_GetText(Key, pPlayer), pCreature->GetGUID()); } class TeLe_gossip_codebox : public CreatureScript { public: TeLe_gossip_codebox() : CreatureScript("TeLe_gossip_codebox") { } bool OnGossipHello(Player* pPlayer, Creature* pCreature) { Custom_GetMenu(pPlayer, pCreature, 1); return true; } bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { pPlayer->PlayerTalkClass->ClearMenus(); // clear the menu pPlayer->ModifyMoney(-1 * TeLe[uiAction].cost); // take cash uint32 Key = TeLe[uiAction].next_menu_id; if (Key == 0) // if no next_menu_id, then teleport to coords { if (!pPlayer->isInCombat()) { pPlayer->CLOSE_GOSSIP_MENU(); pPlayer->TeleportTo(TeLe[uiAction].map, TeLe[uiAction].x, TeLe[uiAction].y, TeLe[uiAction].z, TeLe[uiAction].o); return true; } pPlayer->GetSession()->SendAreaTriggerMessage(ERROR_COMBAT); Key = TeLe[uiAction].menu_id; } Custom_GetMenu(pPlayer, pCreature, Key); return true; } }; void AddSC_TeLe_gossip_codebox() { new TeLe_gossip_codebox(); } |