• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] Player.cpp Error

Status
Not open for further replies.

Zulku

Dirty Dev
Went through adding gold cap to gold bars and it seems something has changed since the mod was released, but i got it down to two errors.

21epzsg.jpg


Anyone that would know a solution would be a great help. Thanks in advance for any insight :)
 

Tommy

Founder
That code is wrong. XD

Are you trying to increment the current amount with 147480000? Or are you trying to see if it reaches the gold amount?

1). Are you trying to increment the current amount with 147480000? It would look like:

Code:
amount = amount + 147480000;

2). Or are you trying to see if it reaches the gold amount? It would look like:

Code:
if (amount >= GOLD_CAP)
{
    // You have reached the gold cap
}

However, the above isn't needed seeing the 'else' is saying: "You're at the max gold cap" - The code should look like this: (overall)

Since you're in the player class, 'AddItem' is accessible without doing 'm_session->GetPlayer()'. Doing 'm_session->GetPlayer()' shouldn't be used in the player class.

Code:
else // Reached the cap
{
    m_session->SendAreaTriggerMessage("You have reached the gold cap and..");
    AddItem(100000, 1);
}

The string variable is pretty useless, just do: (without the variable)

Code:
m_session->SendAreaTriggerMessage("You have reached the gold cap and..");

Also, where are you getting 'd' from? It isn't declared at all. You can't use something that isn't declared. XD
 

Zulku

Dirty Dev
It was the one darksoke shared :p

Pretty much what the code used to do was when gold cap was reached, it removed all gold added 14k and some change and then gave the player gold bar(s) which were worth the value of 200k in this case or 50k in darksoke's

so the 147480000 was the 14748 gold left over
 
Status
Not open for further replies.
Top