PenUltima Online

It is currently Tue Oct 07, 2008 6:03 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: .antilootingareas
PostPosted: Thu Dec 28, 2006 5:35 am 
Offline

Joined: Mon Dec 25, 2006 6:33 am
Posts: 44
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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 28, 2006 6:09 am 
Offline
Distro Developer
User avatar

Joined: Thu Apr 06, 2006 5:11 pm
Posts: 350
Location: Nederland, Texas
I've never heard of that command. Could you post the code for it?

Could the characters loot BEFORE you restarted the server?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 28, 2006 6:18 am 
Offline

Joined: Mon Dec 25, 2006 6:33 am
Posts: 44
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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 28, 2006 6:43 am 
Offline
Distro Developer
User avatar

Joined: Thu Apr 06, 2006 5:11 pm
Posts: 350
Location: Nederland, Texas
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.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 28, 2006 1:02 pm 
Offline

Joined: Mon Dec 25, 2006 6:33 am
Posts: 44
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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 28, 2006 1:13 pm 
Offline

Joined: Mon Dec 25, 2006 6:33 am
Posts: 44
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?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 28, 2006 1:34 pm 
Offline
Distro Developer
User avatar

Joined: Thu Apr 06, 2006 5:11 pm
Posts: 350
Location: Nederland, Texas
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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 28, 2006 3:05 pm 
Offline

Joined: Mon Dec 25, 2006 6:33 am
Posts: 44
thanks for all people!!

:D
cya!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl