• 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!

Compiling [C++] Help with a little function,

danick10

Intermediate OT User
Joined
Apr 11, 2009
Messages
196
Solutions
4
Reaction score
141
Hello, here is my problem,
I want the player of the same sex to be unable to attack target of the same sex.
examble, PLAYER_MALE cant attack another PLAYER_MALE

here is my code in Combat.cpp:
[
Player* playerGetSex = player->getSex();
Target* targetGetSex = target->getSex();
if(playerGetSex == targetGetSex)
{
return RET_YOUMAYNOTATTACKTHISPLAYER;
}
]

That's mainly what i want to do, but it is not working,
I'd like some help with it please!
 
The reason your code doesn't work is because Target is not defined, you could handle this in a script rather than editing the sources.
 
Hello, here is my problem,
I want the player of the same sex to be unable to attack target of the same sex.
examble, PLAYER_MALE cant attack another PLAYER_MALE

here is my code in Combat.cpp:
[
Player* playerGetSex = player->getSex();
Target* targetGetSex = target->getSex();
if(playerGetSex == targetGetSex)
{
return RET_YOUMAYNOTATTACKTHISPLAYER;
}
]

That's mainly what i want to do, but it is not working,
I'd like some help with it please!
Just do an onTarget and onCombat creaturescript.

if getPlayerSex(cid) == 1 and getPlayerSex(target) == 1 then
 
I dont have this function in my version of tfs! but I solved it!
now i have another question! i'm getting a strange error,

  • int32_t LuaScriptInterface::luaSetPlayerParty(lua_State* L)
  • {
  • uint32_t lid = popNumber(L);
  • uint32_t cid = popNumber(L);

  • ScriptEnviroment* env = getScriptEnv();
  • Player* player = env->getPlayerByUID(cid);
  • Player* player2 = env->getPlayerByUID(lid);

  • Party* party = player2->getParty();

  • if (party && player) {
  • lua_pushboolean(L, party->joinParty(player*));
  • } else {
  • lua_pushnil(L);
  • }
  • return 1;

  • }
in this line : lua_pushboolean(L, party->joinParty(player*)); // error ---> \TheForgottenServer\source\luascript.cpp expected primary-expression before ')' token

Anyone Can help me ?
 
change:
Code:
lua_pushboolean(L, party->joinParty(player*));

to:
Code:
lua_pushboolean(L, party->joinParty(*player));
 
Back
Top