Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Freebie: Jail Script using DB npc (https://forums.graalonline.com/forums/showthread.php?t=53366)

xManiamaNx 06-24-2004 05:16 PM

Freebie: Jail Script using DB npc
 
Free Jailing NPC.
Create a DB npc named Jail.
Put the npc below in a level you want to allow people to jail from.
Idea from: Shock (goalieboy_01)
NPC Code:

//Jailing NPC
//NPC made by Maniaman
if (created) {
//Set the guilds allowed to jail
setstring this.guilds,Police,Manager,Co-Manager,Administrator,Staff,Developer;
//Set the accounts allowed to jail with no tag
setstring this.accounts,xManiamaNx,stupidplayer,leetperson,e tc;
}
if (playerchats) {
if (strcontains(#s(this.guilds),#g)||strcontains(#s(t his.accounts),#a)) {
if (startswith(/jail,#c)) {
setstring thiso.account,#e(6,-1,#c);
jail();
}
if (startswith(/unjail,#c)) {
setstring thiso.account,#e(8,-1,#c);
unjail();
}
if (startswith(/comments,#c)) {
tokenize #c;
setstring thiso.account,#t(1);
setstring thiso.comments,#t(2);
setcomments();
}
if (strequals(#c,help)){
say2 Help is sent. Press F2 to View;
sendrpgmessage Jail System Help:;
sendrpgmessage /jail <account> --- Ex: /jail Bob;
sendrpgmessage /unjail <account> --- Ex: /unjail Bob;
sendrpgmessage /comments <account> --- Ex: /comments BoB "Test Dummy";
sendrpgmessage /getcomments <account> --- Ex: /getcomments BoB;
sendrpgmessage YOU MUST BE TAGGED TO USE THESE COMMANDS!;
sendrpgmessage ---------------;
}
}
if (startswith(/getcomments,#c)) {
setstring thiso.account,#e(13,-1,#c);
getcomments();
}
}
function jail() {
//Give them jailed flag in DB NPC
with (getnpc(Jail)) { setstring this.jail.#s(thiso.account),jailed; }
with (getplayer(#s(thiso.account))) {
set clientr.jail; //Give the client a jailed flag in case the DB npc goes poof
setlevel2 jail.nw,29.5,44; //Warp them to jail level
setplayerprop #n,Jailed;
say2 You Jailed #s(thiso.account);
}
}
function unjail() {
//Remove jailed string in db npc
with (getnpc(Jail)) { setstring this.jail.#s(thiso.account),; }
with (getplayer(#s(thiso.account))) {
unset clientr.jail; //Remove Players jailed flag
setlevel2 level.nw,30,30; //Warp them out of the jail
}
}
function setcomments() {
with(getnpc(Jail)) {
if (!strequals(#s(this.jail.#s(thiso.account)),)) {
setstring this.jail.#s(thiso.account),#s(thiso.comments);
} else { setplayerprop #c,#s(thiso.account) not jailed!; }
}
}
function getcomments() {
with (getnpc(Jail)) {
if (!strequals(#s(this.jail.#s(thiso.account)),)) {
setplayerprop #c,#s(this.jail.#s(thiso.account));
} else { setplayerprop #c,#s(thiso.account) not jailed!; }
}
}


Thallen 06-24-2004 05:55 PM

Very nice. :)

dlang 06-24-2004 06:00 PM

Why put it in a level, its easier to have it as a weapon.

JohnGames 06-24-2004 06:19 PM

Quote:

Originally Posted by dlang
Why put it in a level, its easier to have it as a weapon.

It will need to be rescripted. Unless it used that everywhere script.

osrs 06-24-2004 06:21 PM

Very nice, i made something similiar some weeks ago. :)


All times are GMT +2. The time now is 08:43 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.