-
Posts
13 -
Joined
-
Last visited
-
Feedback
0%
Content Type
Forums
Store
Third Party - Providers Directory
Feature Plan
Release Notes
Docs
Events
Posts posted by rafa23alzira
-
-
Thanks hachiwari, now 2 functions is correct, but in change_money when use the money change in database but no in game, if after use guild.get_gold return the old money.
-
Hi, i create 2 functions for questlua_guild but no function.
My c++ level is -1
First function: guild.get_gold() - For get the gold of guild, no return nothing.
int guild_get_gold(lua_State* L) { luaL_checknumber(L, 1); CGuild * pkGuild = CGuildManager::instance().FindGuild((DWORD) lua_tonumber(L, 1)); if (pkGuild) lua_pushnumber(L, pkGuild->GetGuildMoney()); else lua_pushnumber(L, 0); return 1; }
Second function: guild.change_money() For change the money of guild, crash server
int guild_change_money(lua_State * L) { int gold = (int)lua_tonumber(L, -1); //LPCHARACTER ch = q.GetCurrentCharacterPtr(); CGuild * pkGuild = CGuildManager::instance().FindGuild((DWORD) lua_tonumber(L, 1)); if (gold + pkGuild->GetGuildMoney() < 0) sys_err("QUEST wrong ChangeGold %d (now %d)", gold, pkGuild->GetGuildMoney()); else{ DBManager::instance().Query("UPDATE guild%s SET gold=%d WHERE name = '%s'", get_table_postfix(), gold, pkGuild->GetName()); } return 0; }
Game compile perfect.
Thanks
-
Well I just made this two functions for you, but I didn't test it, so please do it for me (but it should work)
Write these into the questlua_pc.cpp:
int pc_get_another_pcs_flag(lua_State * L) { if (lua_gettop(L) != 3 && !lua_isstring(L, 1) && !lua_isstring(L, 2) && !lua_isstring(L, 3)) { lua_pushnumber(L, -1); return 1; } const char * sPC = lua_tostring(L, 1); std::string qName = lua_tostring(L, 2); std::string qFlag = lua_tostring(L, 3); LPCHARACTER selPC = CHARACTER_MANAGER::instance().FindPC(sPC); if (!selPC) { lua_pushnumber(L, -1); return 1; } PC * qPC = CQuestManager::instance().GetPCForce(selPC->GetPlayerID()); if (!qPC) { lua_pushnumber(L, -1); return 1; } lua_pushnumber(L, qPC->GetFlag(qName + "." + qFlag)); return 1; } int pc_set_another_pcs_flag(lua_State * L) { if (lua_gettop(L) != 4 && !lua_isstring(L, 1) && !lua_isstring(L, 2) && !lua_isstring(L, 3) && !lua_isnumber(L, 4)) return 0; const char * sPC = lua_tostring(L, 1); std::string qName = lua_tostring(L, 2); std::string qFlag = lua_tostring(L, 3); LPCHARACTER selPC = CHARACTER_MANAGER::instance().FindPC(sPC); if (!selPC) return 0; PC * qPC = CQuestManager::instance().GetPCForce(selPC->GetPlayerID()); if (!qPC) return 0; qPC->SetFlag(qName + "." + qFlag, int(rint(lua_tonumber(L, 4)))); return 0; }
Then scroll down to it's end, and write these into the luaL_reg pc_functions[] matrix:
{ "get_otherpc_quest_flag", pc_get_another_pcs_flag }, { "set_otherpc_quest_flag", pc_set_another_pcs_flag },
The arguments the same that you wrote in the first post of this topic. If an error trigger durning get_otherpc_quest_flag, it will push back -1 as the flag's value.
Note that it maybe works only if the other pc is online!
Thanks masodikbela, after compile and test write pm to you
-
Hi all, my question is the next:
Is possible create two new functions for quest, pc.get_otherpc_quest_flag and pc.set_otherpc_quest_flag
Same pc.getf and pc.setf, but for others players.
pc.get_otherpc_quest_flag(namepc,namequest,questqf)
pc.set_otherpc_quest_flag(namepc,namequest,questqf,value)
Thanks.
-
her mode is for input
-
Hi metin2dev, i'm search the mode for send variable text/number from client to quest.This is necessary for send opponent id guild to questExample:
def testreturn(self,guildID): return str(guildID)
And quest
local op = cmdchat("testreturn") chat("The id is "..op.."")
Sorry for mi english
-
Good system, come hai fatto per mettere il livello prima dal nome dal personaggio?
-
Hi Vanilla, say function for color (title, reward and others) works like normal say, in white.
Compile your own client binary or use the fixed version
Link for fixed version? Thanks
-
Hi Vanilla, say function for color (title, reward and others) works like normal say, in white.
-
Thanks Electron, problem solved.
-
Hi, I have tried to find a solution to this error "Do not open file (locale / germany / forkedmapindex.txt)" but I have not found a solution, if anyone can give me an answer would be very gratefully. The file if it is on the route. I tested with multiple files and that is not. Thank you very much. Sorry for my english.
[C++] Error with 2 functions
in Community Support - Questions & Answers
Posted · Edited by rafa23alzira
Thanks, after test edit this comment
Edit: Thanks Denis, function perfect