// * This script prevents pickpocketing (and kills pickpocketer)
void main()
{
object oItem = GetModuleItemAcquired();
object oByPC = GetModuleItemAcquiredBy();
object oFromPC = GetModuleItemAcquiredFrom();
object oPC;
string sMessage;
// * If the item is aquired by a PC and is stolen
if (GetIsPC(oFromPC) && GetStolenFlag(oItem))
{
// * Remove the stolen flag and return to the owner
SetStolenFlag(oItem, FALSE);
ActionTakeItem(oItem, oByPC);
ActionGiveItem(oItem, oFromPC);
// * Give warning to pickpocketer, or if warning was given, kill player
if (GetLocalInt(oByPC, "CAUGHT_STEALING"))
{
FloatingTextStringOnCreature("Pickpocket warning ignored! Killing Player!", oByPC, FALSE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), oByPC);
sMessage = GetName(oByPC) + " has been executed for being a moron.";
// * SetLocalInt(oByPC, "CAUGHT_STEALING", 0);
}
else
{
FloatingTextStringOnCreature("Pickpocket is not allowed! Warning given!", oByPC, FALSE);
sMessage = GetName(oByPC) + " tried to steal from " + GetName(oFromPC) + "!";
SetLocalInt(oByPC, "CAUGHT_STEALING", 1);
}
// * Broadcast message to all
oPC = GetFirstPC();
while(GetIsObjectValid(oPC)){
SendMessageToPC(oPC, sMessage);
oPC = GetNextPC();
}
}
}
ActionTakeItem(oItem, oByPC);
ActionGiveItem(oItem, oFromPC);
Try this, replace the above two lines with this one:Code: [Select]ActionTakeItem(oItem, oByPC);
Try this, replace the above two lines with this one:
ActionGiveItem(oItem, oFromPC);
AssignCommand(oByPC, (ActionGiveItem(oItem, oFromPC)));
or possibly:
AssignCommand(oFromPC, (ActionTakeItem(oItem, oByPC)));
The main problem is that you are telling the module object (which is what executes that script) to take an item, but since the module has no inventory it can't store the item anywhere.
Not sure if that will work though, also make sure to recheck the formatting (I'm typing all this from memory).
The other thing you can try is to copy the item into the PC's inventory then DestroyObject the old item.
I did a script similar to this a long time ago, if you can't get it to work I'll try to find my old anti-pickpocket script and post it.
-420[snapback]33433[/snapback]