Give reward hourly

I have a script I’m working on. I know what I want to do. Just not how to do it exactly. I’m more experienced in PHP, so here’s what I have for CPP currently.

#include “ScriptMgr.h”
#include “Player.h”
#include “Chat.h”
#include “World.h”

class PlayerRewards : public PlayerScript
PlayerRewards() : PlayerScript(“PlayerRewards”) { }

void OnLogin(Player* player, bool firstLogin)
auto guid = player->GetGUID();
auto guidNum = guid.GetCount();
CharDatabase.PExecute(“SELECT last_reward FROM player_rewards WHERE guid = %u”, guid);
//Here’s where I’m running into difficulty.
By PHP Standards that last one would be
$resource->execute( array (
“%u” = guid,
$result = $resource->fetch(PDO::FETCH_ASSOC);
if($result[‘last_reward’] - playedtime() >= 3600 {
//Run a script to check how many hours have passed since the last reward and playedtime to update points
//Give all the points



void AddSC_PlayerRewards()
new PlayerRewards();

I know it's cpp not PHP, but I'm trying to see if anyone's willing to help me learn what I need to do in CPP to get the results I'm after. Hopefully you can see what I'm trying to do.