PenUltima Online Forum Index Official Core: 096.7
Official Core: 097 2008-02-26
Donate towards the POL web hosting bill!
 POL Home   FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in
.antilootingareas

 
Post new topic   Reply to topic    PenUltima Online Forum Index -> General Help (095)
Display posts from previous:   

Author Message
lokaum



Joined: 25 Dec 2006
Posts: 29

PostPosted: Thu Dec 28, 2006 9:35 am    Post subject: .antilootingareas Reply with quote

hi people,

i did .antilootingareas in my server and keep anti-loot areas.. later i saved and did a restart in server, but the chars can loot yet in these locations...

im using UL pol095...
thanks

Author Message
tekproxy
Distro Developer


Joined: 06 Apr 2006
Posts: 350
Location: Nederland, Texas

PostPosted: Thu Dec 28, 2006 10:09 am    Post subject: Reply with quote

I've never heard of that command. Could you post the code for it?

Could the characters loot BEFORE you restarted the server?

Author Message
lokaum



Joined: 25 Dec 2006
Posts: 29

PostPosted: Thu Dec 28, 2006 10:18 am    Post subject: Reply with quote

yes...

pkg\opt\loot\antiloot.src

Code:
use uo;
use os;

include "include/areas";
include "include/constants/propids";

program antilooting( who, corpse, item )

   var serial := GetObjProperty( corpse, PROPID_CORPSE_CORPSE_OF );
   if( !serial )
      return 1;
   elseif( who.cmdlevel )
      return 1;
   elseif( serial = who.serial )
      return 1;      
   elseif( GetObjProperty( corpse, PROPID_MOBILE_CANT_BE_LOOTED ) )
      return 0;
   elseif( GetObjProperty( corpse, PROPID_MOBILE_GUARD_KILLED ) )
      return AddLooter( who, corpse );
   elseif( IsInAntiLootingArea(who) )
      SendSysMessage( who, "You can't loot here." );
      return 0;
   else
      var guild1 := GetObjProperty( who, "guild_id" );
      if( guild1 )
         var guild2 := GetObjProperty( who, "guild_id" );
         if( guild2 )
            if( guild1 = guild2 )
               return AddLooter( who, corpse );
            else
               guild1 := FindGuild( guild1 );
               guild2 := FindGuild( guild2 );
               if( guild1.IsEnemyGuild(guild2) )
                  return AddLooter( who, corpse );
               elseif( guild1.IsAllyGuild(guild2) )
                  return AddLooter( who, corpse );
               endif
            endif
         endif
      endif
      
      if( IsInAntiLootingArea(who) )
         SendSysMessage( who, "You can't loot here." );
         return 0;
      elseif( GetObjProperty( corpse, PROPID_CORPSE_IS_BLUE ) )
         who.setCriminal(1);
         return AddLooter( who, corpse );
      endif
   endif
   
   return 1;

endprogram


function AddLooter( looter, object )
   var looters := GetObjProperty(object, PROPID_CORPSE_LOOTED_BY);
   if( !looters )
      looters := dictionary;
   endif

   if( !looters.exists(looter.serial) )
      looters[looter.serial] := looter.name;
      return SetObjProperty(object, PROPID_CORPSE_LOOTED_BY, looters);
   else
      return 1;
   endif
endfunction



want that i post the antilootingarea.src too?

thanks

Author Message
tekproxy
Distro Developer


Joined: 06 Apr 2006
Posts: 350
Location: Nederland, Texas

PostPosted: Thu Dec 28, 2006 10:43 am    Post subject: Reply with quote

Add "debug prints" in all those IF, ELSEIF portions. Here's an example:
Code:
   var serial := GetObjProperty( corpse, PROPID_CORPSE_CORPSE_OF );

   Print("antiloot - serial:"+serial+" cmdlevel:"+who.cmdlevel+" who.serial:"+who.serial);

   if( !serial )
      return 1;
   elseif( who.cmdlevel )
      return 1;
   elseif( serial = who.serial )
      return 1;     
   elseif( GetObjProperty( corpse, PROPID_MOBILE_CANT_BE_LOOTED ) )
      Print("antiloot - Found can't be looted prop, no looting!");
      return 0;
   elseif( GetObjProperty( corpse, PROPID_MOBILE_GUARD_KILLED ) )
      Print("antiloot - Found killed by guard prop, AddLooter()!");
      return AddLooter( who, corpse );
   elseif( IsInAntiLootingArea(who) )
      Print("antiloot - IsInAntiLootingArea()! No looting!");
      SendSysMessage( who, "You can't loot here." );
      return 0;
   else
      Print("antiloot - checking guild stuff...");
      var guild1 := GetObjProperty( who, "guild_id" );


I'd also need to see the code for the function IsInAntiLootingArea(who) and how PROPID_MOBILE_CANT_BE_LOOTED is defined. You could probably figure it out on your own with the above debug messages.

Author Message
lokaum



Joined: 25 Dec 2006
Posts: 29

PostPosted: Thu Dec 28, 2006 5:02 pm    Post subject: Reply with quote

antilootingareas.src

Code:
use uo;
use os;
use cfgfile;

include "include/areas";


program antimagicareas( who )

   var cfg      := ReadConfigFile(":areas:areas");
   var areas   := GetConfigStringArray( cfg[1], "Area" );
   var disabled   := GetGlobalProperty("AntiLootAreas");
   if( !disabled )
      disabled := array;
   endif
   
   var layout   := array( "page 0",
              "nodispose",
              "resizepic 50  0   2600 250 325",
              "resizepic 100 280 5100 150 25",
              "text 110 30 5 0" );
            
   var data   := array( "Anti-Looting Areas" );
   
   var name;
   var splited;
   var count   := 0;
   var done   := 0;
   var page   := 1;
   var perpage   := 10;
   var y       := 70;
   var i;
   var j;

   layout.append( "page " + page );
   if( areas.size() > perpage )
      layout.append( "button 200 281 5540 5542 0 " + (page + 1) );
   endif
   
   for( i := 1; i <= areas.size(); i := i + 1 )
      if( done = perpage )
         done    := 0;
         page    := page + 1;
         y    := 70;
         
         layout.append( "page " + page );
         layout.append( "button 125 281 5537 5538 0 " + (page - 1) );
         if( areas.size() > (count + perpage) )
            layout.append( "button 200 281 5540 5542 0 " + (page + 1) );
         endif
      endif
      
      if( disabled[i] )
         layout.append( "checkbox 250 " + y + " 210 211 1 " + i );
      else
         layout.append( "checkbox 250 " + y + " 210 211 0 " + i );
      endif
            
      splited   := SplitWords( areas[i] );
      name   := splited[5];
      j := 6;
      while( splited[j] )
         name := name + " " + splited[j];
         j := j + 1;
      endwhile
         
      layout.append( "text 85 " + y + " 0 " + data.size() );
      data.append( name );

      y    := y + 20;
      done    := done + 1;
      count    := count + 1;
      Sleepms(1);
   endfor
   
   var save;   
   var result := SendDialogGump( who, layout, data );
   for( i := 1; i <= areas.size(); i := i + 1 )
      disabled[i] := result[i];
   endfor
   
   for( i := 1; i <= areas.size(); i := i + 1 )
      if( result[i] )
         disabled[i] := 1;
         save := 1;
      else
         disabled[i] := 0;
      endif
   endfor
   
   if( save )
      if( SetGlobalProperty( "AntiLootAreas", disabled ) )
         SendSysMessage( who, "Data saved" );
         return 1;
      endif
   else
      if( EraseGlobalProperty( "AntiLootAreas" ) )
         SendSysMessage( who, "Data saved" );
         return 1;
      endif
   endif
   
   SendSysMessage( who, "Error occured" );
   return 0;

endprogram


hmm

Author Message
lokaum



Joined: 25 Dec 2006
Posts: 29

PostPosted: Thu Dec 28, 2006 5:13 pm    Post subject: Reply with quote

later try to loot any corpse...

this message show in console
Code:

antiloot - serial: 30488 cmdlevel: 0 who.serial: 32623);
antiloot - Found killed by guard prop, AddLooter()!


what is the problem now?

Author Message
tekproxy
Distro Developer


Joined: 06 Apr 2006
Posts: 350
Location: Nederland, Texas

PostPosted: Thu Dec 28, 2006 5:34 pm    Post subject: Reply with quote

The mobile in question was killed by a guard and according to the code, you can loot if it has been killed by a guard, unless SetObjProperty has a problem and doesn't return 1 (not likely).

To change this, instead of returning AddLooter(), you could just return 0.

Code:

   elseif( GetObjProperty( corpse, PROPID_MOBILE_GUARD_KILLED ) )
      return 0; // do not allow looting

Author Message
lokaum



Joined: 25 Dec 2006
Posts: 29

PostPosted: Thu Dec 28, 2006 7:05 pm    Post subject: Reply with quote

thanks for all people!!

Very Happy
cya!!

Post new topic   Reply to topic    PenUltima Online Forum Index -> General Help (095) All times are GMT - 4 Hours
Page 1 of 1

 




Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS & Scott E. Royalty