PenUltima Online

It is currently Sat Sep 06, 2008 11:07 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: POL 096, Help with a custom script.
PostPosted: Mon Jul 07, 2008 9:39 pm 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
Ok, so I'm having some difficulties.


I have two edits....ish..

I have a bankstone and I am trying to make it so I can set the owner, and only he or a staff member can open that bank stone, while if there is no owner set, anyone can open the bankstone...

Here are my two scripts...

setowner.src: Needs to set a property on the bank with the same value as the owners name.
Code:
use uo;

program textcmd_setowner( who, text )
SendSysMessage( who, "Target the bank stone" );
var bankstone := TargetCoordinates( who );
  SendSysMessage( who, "Target the new owner" );
  var newowner := TargetCoordinates( who );
SetObjProperty(bankstone, "owner", newowner.name);
SendSysMessage( who, "New owner set!" );
endprogram


bankstone.src: needs to look for an owner, if it has one, block everyone else's access except the owner and staff. If it doesn't allow everyone access

Code:
var owner := GetObjProperty(item, "owner");

if (owner && owner != who.name && who.cmdlevel < 2 )
SendSysMessage( who, "This is not your bankstone!" );
return;
endif


That is at the beginning of the function, if someone can get past this they can open the bank, if they can't it tells them This is not your bankstone! and ends the script...

My problem is that at the moment everyone can open it, weather it has an owner set or not..

Any issues that are obvious?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 07, 2008 9:45 pm 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 750
Location: Chicago, IL USA
Yes very obvious. Use Target, not TargetCoordinates. You're using TargetCorrdinates and getting a coordinate return instead of a mobile object.

Also as a suggestion, use owner.serial instead of owner.name. This avoids any possible future conflicts.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 07, 2008 10:13 pm 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
Awesome, thanks :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl