Code: Select all
use os;
use uo;
use cfgfile;
include "include/objtype";
include "include/client";
include "include/canAccess";
Program guildportal(who, text)
if (!text)
SendSysMessage(who, "You must specify the guild ID.");
SendSysMessage(who, "You can get the guilds list by typing '.guildlist' command.");
return;
EndIf
var stone:=0, guilds := ListGuilds();
var guild_id := CInt(text);
If (guilds.size() == 0)
SendSysMessage(who, "There is no guilds. Sorry guys. :)");
return;
Else
foreach guild in guilds
if (guild.guildid==guild_id)
stone:=guild;
break;
endif;
endforeach
If (!stone)
SendSysMessage(who, "Guild with given ID (" + guild_id + ") is not exists!");
return;
EndIf
EndIf
SendSysMessage(who, "Creating portal for guild " + stone.getprop("guildname") + "...");
SendSysMessage(who, "Target a recall rune to create portals.");
var rune := Target(who);
if((rune.objtype != UOBJ_RUNE) && (rune.objtype != 0x6100))
SendSysMessage(who, "You must target recall rune!");
return;
endif
var tox := CInt(GetObjProperty( rune, "x" ));
var toy := CInt(GetObjProperty( rune, "y" ));
var toz := CInt(GetObjProperty( rune, "z" ));
if(!tox)
SendSysMessage(who, "the rune must be marked.");
return;
endif
var wx := who.x;
var wy := who.y;
var wz := who.z;
set_critical(1);
var gate1 := CreateItemAtLocation( wx, wy, wz, UOBJ_GUILD_PORTAL, 1 );
gate1.movable := 0;
gate1.decayat := 604;
gate1.SaveOnExit := 1;
var gate2 := CreateItemAtLocation( tox, toy, toz, UOBJ_GUILD_PORTAL, 1 );
gate2.movable := 0;
gate2.decayat := 604;
gate2.SaveOnExit := 1;
if(!gate1)
DestroyItem(gate2);
SendSysMessage(who, "Unable to create source gate");
return;
endif
if (!gate2)
DestroyItem(gate1);
SendSysMessage(who, "Unable to create destination gate");
return;
endif
set_critical(0);
SetObjProperty( gate1, "GateDestX", gate2.x );
SetObjProperty( gate1, "GateDestY", gate2.y );
SetObjProperty( gate1, "GateDestZ", gate2.z );
SetObjProperty( gate1, "guild_id", guild_id );
SetObjProperty( gate2, "GateDestX", gate1.x );
SetObjProperty( gate2, "GateDestY", gate1.y );
SetObjProperty( gate2, "GateDestZ", gate1.z );
SetObjProperty( gate2, "guild_id", guild_id );
SetObjProperty( gate2, "guild_id", guild_id );
EndProgram