• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Help with lua function

Rosomak

New Member
Joined
Jul 30, 2014
Messages
11
Reaction score
0
The Forgotten Server
Hi guys i have problem. I wrote in c++ function setPower(int x); in player.cpp
I want to use this with lua i wrote this:

int32_t LuaScriptInterface::luaSetPower(lua_State* L)
{

ScriptEnviroment* env = getEnv();
if(Player *player = env->getPlayerByUID(popNumber(L)))
{
int power = popNumber(L);
player->setPower(power);
std::cout<<"Power: "<<power<<std::endl;
}
return 1;

}
and i want function to look like this :
//setPower(cid,power)
But how i get player cid? and how i use this with spells to set power others players?
 
I guess you can get "cid" with this:

Code:
const Player* player = creature->getPlayer();
but I'm not sure :P
I am not programmer :/
 
Yes but in lua script i call function like this for example i drink mana potion and function is addMana(cid,mana) and i dont know from where lua get this cid o.O
 
Back
Top