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

C++ Storage c++

muladao

New Member
Joined
Feb 8, 2021
Messages
9
Solutions
1
Reaction score
2
I tried a thousand ways already

what would be the right way? i got it one way but she was sending value 1
s << "yourself. (Reborns: " << getStorageValue(412421, value) << ").";

error:

"C:\projects\myla\vc14\theforgottenserver.sln" (default target) (1) ->
1842 "C:\projects\myla\vc14\theforgottenserver.vcxproj" (default target) (2) ->
1843 (ClCompile target) ->
1844 C:\projects\myla\src\player.cpp(114,9): error C2371: 'value': redefinition; different basic types [C:\projects\myla\vc14\theforgottenserver.vcxproj]
 
Solution
i don't know how its going but maybe this will help you
Lua:
uint32_t Player::getReborn() const
{
    uint32_t ret = 0;
    std::string value;
    getStorage(16075, value);
    int32_t intValue = atoi(value.c_str());
    if(!intValue || value == "0" || intValue <= 0 || value == "-1")
        return ret;
    
    ret = intValue;
    return intValue;
}
player.h add
uint32_t getReborn() const;
in Player::getDescription
change
s << "yourself. Reborn: " << getReborn();
s << " (Level " << level << ", Reborn: " << getReborn() << ")";
i don't know how its going but maybe this will help you
Lua:
uint32_t Player::getReborn() const
{
    uint32_t ret = 0;
    std::string value;
    getStorage(16075, value);
    int32_t intValue = atoi(value.c_str());
    if(!intValue || value == "0" || intValue <= 0 || value == "-1")
        return ret;
    
    ret = intValue;
    return intValue;
}
player.h add
uint32_t getReborn() const;
in Player::getDescription
change
s << "yourself. Reborn: " << getReborn();
s << " (Level " << level << ", Reborn: " << getReborn() << ")";
 
Solution
remove old compile and compile again
I tried, but the error persisted, I put so and worked the code is good?

Lua:
uint32_t Player::getReborn() const
{
    int32_t value;
    if (getStorageValue(5123513, value)) {
        return value;
    }
    return 0;
}

that way it worked

You see yourself. (Level 8) [Reborn 16]. You are a ADM.

You see Test. (Level 8) [Reborn 0]. He is a Knight.
 
I tried, but the error persisted, I put so and worked the code is good?

Lua:
uint32_t Player::getReborn() const
{
    int32_t value;
    if (getStorageValue(5123513, value)) {
        return value;
    }
    return 0;
}

that way it worked

You see yourself. (Level 8) [Reborn 16]. You are a ADM.

You see Test. (Level 8) [Reborn 0]. He is a Knight.
nice if i helped you mark it solved
 
Back
Top