Jump to content

Automatically award points purchased to account in game help


Recommended Posts

so in my game you can purchase points to spend in the game.

the problem im having is points being automatically awarded to the person who bought them.

currently we have to manually award them.


does anyone have any knowledge of how to make this work as intended.. I have attached the points script





function PlayerInfo::loadPoints(%playerInfo)

{

%query = "accountId=" @ %playerInfo.accountId TAB "server=" @ $realmName;

%auth = $AuthServer;

$AuthServer = "127.0.0.1:80";

dbresult("checkPoints.php", %query, "loadPoints", %playerInfo);

$AuthServer = %auth;

%playerInfo.lastPointsCheck = UnixTime();

}


function loadPoints::onLineReceived(%this, %command, %vars)

{

%playerInfo = %this.player;


if(%command $= "success")

{

%playerInfo.points = %vars;

%playerInfo.updatePoints();

}

}


function PlayerInfo::updatePoints(%playerInfo)

{

commandToClient(%playerInfo.zoneConnection, 'updatePlayerPoints', %playerInfo.playerId, %playerInfo.points);

}


function serverCmdrequestAddPoints(%zone, %playerId, %amount)

{

%playerInfo = getPlayerInfo(%playerId);

if(!%playerInfo)

return;


%amount = getIntArg(%amount);


if(%amount < 0)

{

// removing

if(%playerInfo.points + %amount < 0)

{

commandToClient(%playerInfo.zoneConnection, 'PointAdditionResult', %playerInfo.playerId, 0);

return;

}

}


if($pointsLock[%playerInfo.accountId] && %amount > 0)

{

commandToClient(%playerInfo.zoneConnection, 'PointAdditionResult', %playerInfo.playerId, 0);

return;

}


$pointsLock[%playerInfo.accountId] = 1;


%query = "accountId=" @ %playerInfo.accountId @ "\t" @ "amount=" @ %amount TAB "server=" @ $realmName;

%auth = $AuthServer;

$AuthServer = $accountAuthServer;

dbresult("addPoints.php", %query, "addPoints", %playerInfo);

$AuthServer = %auth;

}


function serverCmdCheckPointsLock(%zone, %accountId, %tradeOffer)

{

if($pointsLock[%accountId])

commandToClient(%zone, 'checkPointsResult', %tradeOffer, 0);

else

commandToClient(%zone, 'checkPointsResult', %tradeOffer, 1);

}


function addPoints::onLineReceived(%this, %command, %vars)

{

%playerInfo = %this.player;


if(%command $= "success")

{

if(%playerInfo)

{

%playerInfo.points = %vars;

%playerInfo.updatePoints();

commandToClient(%playerInfo.zoneConnection, 'PointAdditionResult', %playerInfo.playerId, 1);

$pointsLock[%playerInfo.accountId] = 0;

}

}

else

{

commandToClient(%playerInfo.zoneConnection, 'PointAdditionResult', %playerInfo.playerId, 0);

}

}

Link to post
Share on other sites

It is probably difficult to do on the fly, without knowing the rest. You have to describe the problem and then how you want it to be. Can't players just give the points to other players ingame? This would solve the issue, but may create other issues. Another method would be to create a bank that the points get awarded to first and then in another GUI or so the player can chose who to transfer it to, but it would require to create a new feature. Another method would be to not award points directly, but hand out codes that can be redeemed ingame to get the points, that is how many others do it, like if you purchase credits in the supermarkets for your mobile phone or whatever, they do not transfer anything, but give you a key and whoever enters it gets the money, but I have no idea how that system works either.


I would just tell people to deal with it, since I think most players who buy something will want it on their own character, even many moderne games do not offer that feature to buy something for others.


Easiest solution would probably having a GUI after purchase where the player has to manually enter the character who to transfer it to, but you have to consider the average person is stupid so any additoinal action required to do by the player is probably a cause of further problems.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...