bool Player::tameMount(uint8_t mountId)
{
if(!Mounts::getInstance()->getMountById(mountId))
return false;
int32_t key = PSTRG_MOUNTS_RANGE_START + (mountId / 31), value = 0;
std::string keyString = boost::lexical_cast<std::string>(key);
std::string tmp;
mountId--;
if(getStorage(keyString, tmp))
{
value = atoi(tmp.c_str());
value |= (int32_t)pow(2., mountId % 31);
}
else
value = (int32_t)pow(2., mountId % 31);
setStorage(keyString, boost::lexical_cast<std::string>(value))...
int32_t x=sirSezagoRandomValue;
char *ptr = (char*)&x;
char *msg = new char[5];
for(int i=0;i<4;++i, ++ptr)
msg[i] = *ptr;
int32_t x=sirSezagoRandomValue;
int digs[5], count=0;
char *msg = new char[5];
while(x>0)
{
digs[count++]=x%10;
x/=10;
}
int i=0;
while(count--)
{
msg[i++] = digs[count] +'0';
}
//////////////////////////////////////////////////////////////////////// // Ope - Pastebin.com the code i don't under stand what u already said but the error in setstorage in the mount systemHello Sir Sezago,
throw us the code here so we can check it out and maybe fix it for you, I'd rather make you think a little and solve your problem yourself.
There are different ways to solve this, it depends on the way you want to store information, if you want to go byte by byte, let's put it this way:
C++:int32_t x=sirSezagoRandomValue; char *ptr = (char*)&x; char *msg = new char[5]; for(int i=0;i<4;++i, ++ptr) msg[i] = *ptr;
If you want to store it digit by digit instead:
C++:int32_t x=sirSezagoRandomValue; int digs[5], count=0; char *msg = new char[5]; while(x>0) { digs[count++]=x%10; x/=10; } int i=0; while(count--) { msg[i++] = digs[count] +'0'; }
I hope you can fix it yourself, anyways if you don't think you can, provide us the code
Best Wishes,
Okke
bool Player::tameMount(uint8_t mountId)
{
if(!Mounts::getInstance()->getMountById(mountId))
return false;
int32_t key = PSTRG_MOUNTS_RANGE_START + (mountId / 31), value = 0;
std::string keyString = boost::lexical_cast<std::string>(key);
std::string tmp;
mountId--;
if(getStorage(keyString, tmp))
{
value = atoi(tmp.c_str());
value |= (int32_t)pow(2., mountId % 31);
}
else
value = (int32_t)pow(2., mountId % 31);
setStorage(keyString, boost::lexical_cast<std::string>(value));
return true;
}
bool Player::untameMount(uint8_t mountId)
{
if(!Mounts::getInstance()->getMountById(mountId))
return false;
int32_t key = PSTRG_MOUNTS_RANGE_START + (mountId / 31), value = 0;
std::string keyString = boost::lexical_cast<std::string>(key);
std::string tmp;
mountId--;
if(!getStorage(keyString, tmp))
return true;
value = atoi(tmp.c_str());
value ^= (int32_t)std::pow(2., mountId % 31);
Mount* mount = Mounts::getInstance()->getMountByCid(defaultOutfit.lookMount);
if(mount->getId() == (mountId + 1))
dismount(true);
setStorage(keyString, boost::lexical_cast<std::string>(value));
return true;
}
i got other error bro ..This error is probably, because you copied code from some server that use 'int' storage keys (all servers except 0.4) and TFS 0.4 has 'string' storage keys.
These functions should work:
PHP:bool Player::tameMount(uint8_t mountId) { if(!Mounts::getInstance()->getMountById(mountId)) return false; int32_t key = PSTRG_MOUNTS_RANGE_START + (mountId / 31), value = 0; std::string keyString = boost::lexical_cast<std::string>(key); std::string tmp; mountId--; if(getStorage(keyString, tmp)) { value = atoi(tmp.c_str()); value |= (int32_t)pow(2., mountId % 31); } else value = (int32_t)pow(2., mountId % 31); setStorage(keyString, boost::lexical_cast<std::string>(value)); return true; } bool Player::untameMount(uint8_t mountId) { if(!Mounts::getInstance()->getMountById(mountId)) return false; int32_t key = PSTRG_MOUNTS_RANGE_START + (mountId / 31), value = 0; std::string keyString = boost::lexical_cast<std::string>(key); std::string tmp; mountId--; if(!getStorage(keyString, tmp)) return true; value = atoi(tmp.c_str()); value ^= (int32_t)std::pow(2., mountId % 31); Mount* mount = Mounts::getInstance()->getMountByCid(defaultOutfit.lookMount); if(mount->getId() == (mountId + 1)) dismount(true); setStorage(keyString, boost::lexical_cast<std::string>(value)); return true; }
you should start like fresh, it's seems corrupted files it must do hard work to solve :si got other error bro .. View attachment 32344
explain moreyou should start like fresh, it's seems corrupted files it must do hard work to solve :s
Use fresh sources without editsexplain more
In DevCpp (screen looks like DevCpp) it was 'Rebuild all' or something like that. To compile all files again. You must do it everytime you change something in any .h file.explain more
already done it and still get same error ..In DevCpp (screen looks like DevCpp) it was 'Rebuild all' or something like that. To compile all files again. You must do it everytime you change something in any .h file.
Remember this error bro i Found what is the cause of this errorIn DevCpp (screen looks like DevCpp) it was 'Rebuild all' or something like that. To compile all files again. You must do it everytime you change something in any .h file.
[Unit158]
FileName=..\mounts.cpp
CompileCpp=1
Folder=TheForgottenServer
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit159]
FileName=..\mounts.h
CompileCpp=1
Folder=TheForgottenServer
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=