• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ teleport to temple no log out

Jpstafe

Well-Known Member
Joined
Aug 8, 2011
Messages
507
Reaction score
68
Hello I-m attempting to add this code to my server

I use tfs 1.5 downgraded. Have added everything correctly, but im getting conversion issues with the compiler
Lua:
Rebuild started...
1>------ Rebuild All started: Project: theforgottenserver, Configuration: Release x64 ------
1>otpch.cpp
1>actions.cpp
1>ban.cpp
1>baseevents.cpp
1>bed.cpp
1>chat.cpp
1>combat.cpp
1>condition.cpp
1>configmanager.cpp
1>connection.cpp
1>container.cpp
1>creature.cpp
1>creatureevent.cpp
1>cylinder.cpp
1>database.cpp
1>databasemanager.cpp
1>databasetasks.cpp
1>depotchest.cpp
1>depotlocker.cpp
1>events.cpp
1>fileloader.cpp
1>game.cpp
1>globalevent.cpp
1>groups.cpp
1>guild.cpp
1>house.cpp
1>housetile.cpp
1>C:\Users\jpstafe\Documents\GitHub\tfs-1.x-8.0-graphics-7-4\src\game.cpp(729,61): error C2660: 'Player::sendCreatureAppear': function does not take 2 arguments
1>C:\Users\jpstafe\Documents\GitHub\tfs-1.x-8.0-graphics-7-4\src\player.h(752,8): message : see declaration of 'Player::sendCreatureAppear' (compiling source file ..\src\game.cpp)
1>inbox.cpp
1>ioguild.cpp
1>iologindata.cpp
1>iomap.cpp
1>iomapserialize.cpp
1>iomarket.cpp
1>item.cpp
1>items.cpp
1>luascript.cpp
1>mailbox.cpp
1>map.cpp
1>monster.cpp
1>monsters.cpp
1>mounts.cpp
1>movement.cpp
1>networkmessage.cpp
1>npc.cpp
1>otserv.cpp
1>outfit.cpp
1>outputmessage.cpp
1>party.cpp
1>player.cpp
1>position.cpp
1>protocol.cpp
1>protocolgame.cpp
1>protocollogin.cpp
1>protocolold.cpp
1>quests.cpp
1>C:\Users\jpstafe\Documents\GitHub\tfs-1.x-8.0-graphics-7-4\src\protocolgame.h(330,25): error C2665: 'createTaskWithStats': none of the 2 overloads could convert all the argument types (compiling source file ..\src\protocolgame.cpp)
1>C:\Users\jpstafe\Documents\GitHub\tfs-1.x-8.0-graphics-7-4\src\tasks.h(71,7): message : could be 'Task *createTaskWithStats(TaskFunc &&,const std::string &,const std::string &)' (compiling source file ..\src\protocolgame.cpp)
1>C:\Users\jpstafe\Documents\GitHub\tfs-1.x-8.0-graphics-7-4\src\protocolgame.h(330,25): message : 'Task *createTaskWithStats(TaskFunc &&,const std::string &,const std::string &)': cannot convert argument 1 from 'std::_Binder<std::_Unforced,_Ty,Game *>' to 'TaskFunc &&'
1>        with
1>        [
1>            _Ty=ProtocolGame::parsePacket::<lambda_bc1f1f5bf3254bfc04f541e8a2b30644>
1>        ] (compiling source file ..\src\protocolgame.cpp)
1>C:\Users\jpstafe\Documents\GitHub\tfs-1.x-8.0-graphics-7-4\src\protocolgame.h(329,130): message : Reason: cannot convert from 'std::_Binder<std::_Unforced,_Ty,Game *>' to 'TaskFunc'
1>        with
1>        [
1>            _Ty=ProtocolGame::parsePacket::<lambda_bc1f1f5bf3254bfc04f541e8a2b30644>
1>        ] (compiling source file ..\src\protocolgame.cpp)
1>C:\Users\jpstafe\Documents\GitHub\tfs-1.x-8.0-graphics-7-4\src\protocolgame.h(330,54): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called (compiling source file ..\src\protocolgame.cpp)
1>C:\Users\jpstafe\Documents\GitHub\tfs-1.x-8.0-graphics-7-4\src\tasks.h(71,7): message : see declaration of 'createTaskWithStats' (compiling source file ..\src\protocolgame.cpp)
1>C:\Users\jpstafe\Documents\GitHub\tfs-1.x-8.0-graphics-7-4\src\protocolgame.h(329,130): message : while trying to match the argument list '(std::_Binder<std::_Unforced,_Ty,Game *>, const std::string, const std::string)'
1>        with
1>        [
1>            _Ty=ProtocolGame::parsePacket::<lambda_bc1f1f5bf3254bfc04f541e8a2b30644>
1>        ] (compiling source file ..\src\protocolgame.cpp)
1>C:\Users\jpstafe\Documents\GitHub\tfs-1.x-8.0-graphics-7-4\src\protocolgame.cpp(525): message : see reference to function template instantiation 'void ProtocolGame::addGameTaskWithStats<ProtocolGame::parsePacket::<lambda_bc1f1f5bf3254bfc04f541e8a2b30644>,>(Callable &&,const std::string &,const std::string &)' being compiled
1>        with
1>        [
1>            Callable=ProtocolGame::parsePacket::<lambda_bc1f1f5bf3254bfc04f541e8a2b30644>
1>        ]
1>raids.cpp
1>rsa.cpp
1>scheduler.cpp
1>script.cpp
1>scriptmanager.cpp
1>server.cpp
1>signals.cpp
1>spawn.cpp
1>spells.cpp
1>stats.cpp
1>storeinbox.cpp
1>protocolstatus.cpp
1>talkaction.cpp
1>tasks.cpp
1>teleport.cpp
1>thing.cpp
1>tile.cpp
1>tools.cpp
1>trashholder.cpp
1>vocation.cpp
1>weapons.cpp
1>wildcardtree.cpp
1>xtea.cpp
1>Done building project "theforgottenserver.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

Lua:
Severity    Code    Description    Project    File    Line    Suppression State
Error    C2660    'Player::sendCreatureAppear': function does not take 2 arguments    theforgottenserver    C:\Users\felip\Documents\GitHub\tfs-1.x-8.0-graphics-7-4\src\game.cpp    729
Code:
Severity    Code    Description    Project    File    Line    Suppression State
Error    C2665    'createTaskWithStats': none of the 2 overloads could convert all the argument types (compiling source file ..\src\protocolgame.cpp)    theforgottenserver    C:\Users\felip\Documents\GitHub\tfs-1.x-8.0-graphics-7-4\src\protocolgame.h    330
there are some of the files
 

Attachments

Last edited:
C++:
// Helpers so we don't need to bind every time
template <typename Callable, typename... Args>
void addGameTaskWithStats(Callable&& function, const std::string& function_str, const std::string& extra_info, Args&&... args) {
    g_dispatcher.addTask(createTaskWithStats(std::bind(std::forward<Callable>(function), &g_game, std::forward<Args>(args)...), function_str, extra_info));
}

template <typename Callable, typename... Args>
void addGameTaskTimedWithStats(uint32_t delay, Callable&& function, const std::string& function_str, const std::string& extra_info, Args&&... args) {
    g_dispatcher.addTask(createTaskWithStats(delay, std::bind(std::forward<Callable>(function), &g_game, std::forward<Args>(args)...), function_str, extra_info));
}

Do you even use these? Arguments type do not match with the ones defined in Tasks class (check definiton of createTaskWithStats)
 
C++:
// Helpers so we don't need to bind every time
template <typename Callable, typename... Args>
void addGameTaskWithStats(Callable&& function, const std::string& function_str, const std::string& extra_info, Args&&... args) {
    g_dispatcher.addTask(createTaskWithStats(std::bind(std::forward<Callable>(function), &g_game, std::forward<Args>(args)...), function_str, extra_info));
}

template <typename Callable, typename... Args>
void addGameTaskTimedWithStats(uint32_t delay, Callable&& function, const std::string& function_str, const std::string& extra_info, Args&&... args) {
    g_dispatcher.addTask(createTaskWithStats(delay, std::bind(std::forward<Callable>(function), &g_game, std::forward<Args>(args)...), function_str, extra_info));
}

Do you even use these? Arguments type do not match with the ones defined in Tasks class (check definiton of createTaskWithStats)
Hello, yes, I do use them for this

and it does not cause problems till I tried to add this
 
Back
Top