Before v13, this command worked. What this code does is transfer money from one player to another in my rp. I've commented above the line I suspect of being the problem.
function RPC_givemoney(%client,%args)
{
%money = mFloor(getWord(%args, 0));
if(%money < 1)
{
messageClient(%client, '', "\c6You must enter a valid amount of money to give.");
return;
}
if(TezRPData.getData(%client.bl_id).valueMoney - %money < 0)
{
messageClient(%client, '', "\c6You don't have that much money to give.");
return;
}
if(!isObject(%client.player))
{
messageClient(%client, '', "\c6Spawn first before you use this command.");
return;
}
//I'm sure the line below is causing the problem and I think some changes in v13 broke it. Can anyone fix?
%target = containerRayCast(%client.player.getEyePoint(), vectorAdd(vectorScale(vectorNormalize(%client.player.getEyeVector()), 8), %client.player.getEyePoint()), $typeMasks::playerObjectType).client;
if(!isObject(%target))
{
messageClient(%client, '', "\c6You must be looking at and be in a reasonable distance of the player in order to give them money.");
return;
}
messageClient(%client, '', "\c6You give \c3$" @ %money SPC "\c6to \c3" @ %target.name @ "\c6.");
messageClient(%target, '', "\c3" @ %client.name SPC "\c6has given you \c3$" @ %money @ "\c6.");
TezRPData.getData(%client.bl_id).valueMoney -= %money;
TezRPData.getData(%target.bl_id).valueMoney += %money;
%client.TezRP(1);
%target.TezRP(1);
}