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

getPlayerVocation in C++

Is it that easy or do you have to add more?
I am currently into C++ and already followed 30 lessons. I would like to know more about the OTServ c++ codes I can use.
Any tutorials or something? I know some basic c++ coding. Just have to get into otserv
 
Code:
int voc = player->getVocationId();
Thanks, where i put the number of vocation? xD!

Is it that easy or do you have to add more?
I am currently into C++ and already followed 30 lessons. I would like to know more about the OTServ c++ codes I can use.
Any tutorials or something? I know some basic c++ coding. Just have to get into otserv

I can't change corpse for each vocation in creaturescript so.. I think in source is posible, i good in C++ but no expert and need help :)

I added new corpse to const.cpp
Code:
ITEM_MALE_CORPSE	= 6007,
ITEM_FEMALE_CORPSE	= 2826,
ITEM_MALE_NEWA	= 2827,
ITEM_MALE_NEWB	= 2828,
vITEM_MALE_NEWC	= 2829,

And in player.cpp
Code:
{
	if(sex % 2)
		return ITEM_MALE_CORPSE;

	return ITEM_FEMALE_CORPSE;
}

I change to
Code:
{
	if(int voc = player->getVocationId(2);)
		return ITEM_MALE_CORPSE;
	if(int voc = player->getVocationId(3);)
	return ITEM_MALE_NEWA;
}

It will work?

if it work, is free to use xD!!!

Sorry for my bad english.
 
I don't know much about C++ but i think you need to change te vocation code to this
LUA:
{
int voc = player->getVocationId(2);)
	if(voc == 2);
		return ITEM_MALE_CORPSE;
	else if(voc == 3);
		return ITEM_MALE_NEWA;
}
Or something like it
 
I don't know much about C++ but i think you need to change te vocation code to this
LUA:
{
int voc = player->getVocationId(2);)
	if(voc == 2);
		return ITEM_MALE_CORPSE;
	else if(voc == 3);
		return ITEM_MALE_NEWA;
}
Or something like it

In member function `virtual uint16_t Player::getLookCorpse() const':
`player' was not declared in this scope
expected primary-expression before ')' token
expected `;' before ')' token
expected primary-expression before "else"
expected `;' before "else"
[Build Error] [obj//player.o] Error 1

I try to fix, but i cant. I think edit the corpse for each vocation is imposible :/
 
[cpp]{
switch(player->getVocationId())
{
case 2:
return ITEM_MALE_CORPSE;
case 3:
return ITEM_MALE_NEWA;

default:
break;
}
}[/cpp]
 
[cpp]{
switch(player->getVocationId())
{
case 2:
return ITEM_MALE_CORPSE;
case 3:
return ITEM_MALE_NEWA;

default:
break;
}
}[/cpp]

`player' was not declared in this scope

[cpp]

{
if(vocation_id == 1)
return ITEM_MALE_CORPSE;

else if(vocation_id == 2)
return ITEM_MALE_NEWA;


}
[/cpp]
Try that?

Oh My Fucking God, it work xD, well thanks to all i rep++ to all ;)

SOLVED!
 
Back
Top