Author Topic: Raycast is reflecting?  (Read 567 times)

For some reason on my rp, whenever I click another player it seems to reflect back at me when using this thief code.  It didn't start happening until v13.  Can anyone fix it?

Code: [Select]
function player::activateStuff(%this)
        {
                parent::activateStuff(%this);
                
                %target = containerRayCast(%this.getEyePoint(), vectorAdd(vectorScale(vectorNormalize(%this.getEyeVector()), 8), %this.getEyePoint()), $typeMasks::all);
                
                if(isObject(%target) && %target.getType() & $typeMasks::playerObjectType && isObject(%target.client) && getWord(TezRPData.getData(%this.client.bl_id).valueJailData, 1) < 1 && getWord(TezRPData.getData(%target.client.bl_id).valueJailData, 1) < 1 && $TezRP::jobs::pickpocket[TezRPData.getData(%this.client.bl_id).valueJobID] && TezRPData.getData(%target.client.bl_id).valueMoney > 10 && %this.lastPickpocket + 2 < $sim::time)
                {
                        %this.lastPickpocket = $sim::time;
                        
                        if(getRandom(0, 1))
                        {
                                return;
                        }
                        
                        %amount = getRandom(1, 25);
                        
                        commandToClient(%this.client, 'centerPrint', "\c6You have commited a crime. [\c3Pickpocketing\c6]", 1);
                        
                        %this.client.TezRP(2, $TezRP::demerits::pickpocketing);
                        TezRPData.getData(%this.client.bl_id).totalPicketed += %amount;
                        messageClient(%this.client, '', "\c6You have stolen \c3$" @ %amount SPC "\c6from \c3" @ %target.client.name @ "\c6.");
                        messageClient(%target.client, '', "\c3" @ %this.client.name SPC "\c6has stolen \c3$" @ %amount SPC "\c6from you.");
                        
                        TezRPData.getData(%this.client.bl_id).valueMoney += %amount;
                        TezRPData.getData(%target.client.bl_id).valueMoney -= %amount;
                        
                        if(TezRPData.getData(%target.client.bl_id).valueMoney < 0)
                        {
                                TezRPData.getData(%target.client.bl_id).valueMoney = 0;
                        }
                        
                        %this.client.TezRP(1);
                        %target.client.TezRP(1);
                }
        }

Fourth argument in containerRaycast is the object to ignore.

Fourth argument in containerRaycast is the object to ignore.

So how exactly would I fix it, can you patch it up?  I didn't make this script, and I don't know how to fix the args because I haven't gotten that far in scripting.

Code: [Select]
%target = containerRayCast(%this.getEyePoint(), vectorAdd(vectorScale(vectorNormalize(%this.getEyeVector()), 8), %this.getEyePoint()), $typeMasks::all, %this);

For some reason on my rp, whenever I click another player it seems to reflect back at me when using this thief code.  It didn't start happening until v13.  Can anyone fix it?

Code: [Select]
$TezRP::jobs::pickpocket[TezRPData.getData(%this.client.bl_id).valueJobID] && TezRPData.getData(%target.client.bl_id).valueMoney > 10 && %this.lastPickpocket + 2 < $sim::time)
this.client.TezRP(2, $TezRP::demerits::pickpocketing);
TezRPData.getData(%this.client.bl_id).totalPicketed += %amount;
TezRPData.getData(%this.client.bl_id).valueMoney += %amount;
TezRPData.getData(%target.client.bl_id).valueMoney -= %amount;
if(TezRPData.getData(%target.client.bl_id).valueMoney < 0)
TezRPData.getData(%target.client.bl_id).valueMoney = 0;
%this.client.TezRP(1);
%target.client.TezRP(1);
Hmmmm, funny, I detect the following
Search: city
Replace: Tez