Skip to content

Instantly share code, notes, and snippets.

@johnX9

johnX9/Players.cpp

Last active Apr 30, 2018
Embed
What would you like to do?
//@abi action
void getplayer(const account_name account) {
playerIndex players(_self, _self);
auto iterator = players.find(account);
eosio_assert(iterator != players.end(), "Address for account not found");
/**
* The "get" function returns a constant reference to the object
* containing the specified secondary key
*/
auto currentPlayer = players.get(account);
print("Username: ", currentPlayer.username.c_str(), " Level: ", currentPlayer.level, " Health: ", currentPlayer.health_points, " Energy: ", currentPlayer.energy_points);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.