Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Admin Tool (https://forums.graalonline.com/forums/showthread.php?t=60539)

alissalee 08-16-2005 05:32 PM

Admin Tool
 
ok i tested this script out and itstill wont work so please some one help me out in this one


npc script

if (actionserverside){
savelog2 stafftools.txt,#a has used the command #t(0);
tokenize #p(0);
if (strequals(#t(0),allpm)) {
sendpm #t(1);
}
elseif (strequals(#t(0),pm)) {
with (getplayer(#t(1))){
sendpm #t(2);
}
}
elseif (strequals(#t(0),rcchat)) {
setstring this.nick,#n;
sendtonc #s(this.nick): #t(1);
}
elseif (strequals(#t(0),nick)) {
with (getplayer(#t(1))){
setplayerprop #n,#t(2);
}
}
elseif (strequals(#t(0),guild)) {
with(getplayer(#t(1))){
setplayerprop #g,#t(2);
}
}
elseif (strequals(#t(0),setallnick)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
setplayerprop #n,#t(1);
}
}
}
elseif (strequals(#t(0),setnick)) {
setplayerprop #n,#t(1);
}
elseif (strequals(#t(0),setguild)) {
setplayerprop #g,#t(1);
}
elseif (strequals(#t(0),setallguild)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
setplayerprop #g,#t(1);
}
}
}
elseif (strequals(#t(0),head)) {
with(getplayer(#t(1))){
setplayerprop #3,#t(2);
}
}
elseif (strequals(#t(0),hat)) {
with(getplayer(#t(1))){
if (!strequals(#F,)) {
setplayerprop #P1,#t(2);
}
}
}
elseif (strequals(#t(0),rchead)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
if (strequals(#a,#t(1))) {
if (strequals(#F,)) {
setplayerprop #3,#t(2);
}
}
}
}
}
elseif (strequals(#t(0),allrchead)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
if (strequals(#F,)) {
setplayerprop #3,#t(1);
}
}
}
}
elseif (strequals(#t(0),arrows)) {
with(getplayer(#t(1))){
playerdarts=strtofloat(#t(2));
}
}
elseif (strequals(#t(0),bombs)) {
with(getplayer(#t(1))){
playerbombs=strtofloat(#t(2));
}
}
elseif (strequals(#t(0),allheal)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
setstring client.hp,1000;
}
}
}
elseif (strequals(#t(0),allgani)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
setani #t(1),;
}
}
}
elseif (strequals(#t(0),gani)) {
with(getplayer(#t(1))) {
setani #t(2),;
}
}
elseif (strequals(#t(0),ap)) {
if (tokenscount==3) {
with(getplayer(#t(1))) {
playerap=strtofloat(#t(2));
}
}
else if (tokenscount==2) {
playerap=strtofloat(#t(1));
}
}
elseif (strequals(#t(0),allap)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
playerap=strtofloat(#t(1));
}
}
}
elseif (strequals(#t(0),mp)) {
with(getplayer(#t(1))) {
playermp=strtofloat(#t(2));
}
}
elseif (strequals(#t(0),allmp)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
playermp=strtofloat(#t(1));
}
}
}
elseif (strequals(#t(0),addweapon)) {
if(tokenscount==3) {
with(getplayer(#t(1))) {
addweapon #t(2);
if(hasweapon(#t(2))) {
setplayerprop #c, Successfully recieved: #t(2);
}
}
}
else if(tokenscount==2) {
addweapon #t(1);
}
}
elseif (strequals(#t(0),delweapon)) {
if(tokenscount==3) {
with(getplayer(#t(1))) {
removeweapon #t(2);
if(!hasweapon(#t(2))) {
setplayerprop #c, Successfully removed: #t(2);
}
}
}
else if(tokenscount==2) {
removeweapon #t(1);
}
}
elseif (strequals(#t(0),heal)) {
with(getplayer(#t(1))) {
setstring client.hp,1000;
setstring client.mp,10000;
}
}
elseif (strequals(#t(0),freeze)) {
with(getplayer(#t(1))){
freezeplayer2;
}
}
elseif (strequals(#t(0),unfreeze)) {
with(getplayer(#t(1))){
unfreezeplayer;

}
}
elseif (strequals(#t(0),warpto)) {
with (getplayer(#a)) {
setlevel2 #t(1),strtofloat(#t(2)),strtofloat(#t(3));
}
}
elseif (strequals(#t(0),warp)) {
with (getplayer(#t(1))) {
setlevel2 #t(2),strtofloat(#t(3)),strtofloat(#t(4));
}
}
elseif (strequals(#t(0),allwarp)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
setlevel2 #t(1),strtofloat(#t(2)),strtofloat(#t(3));
}
}
}
elseif (strequals(#t(0),say)) {
with (getplayer(#t(1))) {
say2 #t(2);
}
}
elseif (strequals(#t(0),allsay)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
say2 #t(1);
}
}
}
elseif (strequals(#t(0),pk)) {
if(!strcontains(#s(this.allowed),#t(1))) {
with(getplayer(#t(1))) {
setstring client.hp,0;
}
}
}

if (strequals(#t(0),rupees)) {
with(getplayer(#t(1))) {
playerrupees=strtofloat(#t(2));
}
}

elseif (strequals(#t(0),allmsg)) {
for (j=0;j<allplayerscount;j++) {
with (allplayers[j]){
setplayerprop #c,#t(1);
}
}
}
elseif (strequals(#t(0),summon)) {
tokenize #c;
this.x = playerx;
this.y = playery;
setstring this.level,#L;
with(getplayer(#t(1))) setlevel2 #s(this.level),this.x,this.y;
}
elseif (strequals(#t(0),summonall)) {
tokenize #c;
this.x = playerx;
this.y = playery;
setstring this.level,#L;
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
setlevel2 #s(this.level),this.x,this.y;
}
}
}
elseif (strequals(#t(0),msg)) {
with (getplayer(#t(1))) {
setplayerprop #c,#t(2);
}
}
}

if(strequals(#p(0),jail)){
savelog2 StaffTools.txt,#a jailed #p(1)#K(13);
sendtorc #a jailed #p(1),Remember to set comments.;
with (getnpc(Control-NPC)) {
addstring this.jailed,#p(1);
}
with(getplayer(#p(1))) {
disableweapons;
setstring client.jailed,true;
setplayerprop #n,*Jailed;
setlevel2 jail.nw,31,26;
}
}
if (strequals(#p(0),unjail)) {
savelog2 StaffTools.txt,#a unjailed #p(1)#K(13);
sendtorc #a unjailed #p(1), Remember to remove the comments of jailing.;
with (getnpc(Control-NPC)) {
removestring this.jailed,#p(1);
}
with (getplayer(#p(1))) {
enableweapons;
setplayerprop #a,;
removestring client.jailed,true;
setlevel2 rc-cafe.nw,30,30;
setplayerprop #n,#a;
}
}


//#CLIENTSIDE
if (playerchats){
if (startswith(/,#c)) {
tokenize #c;
triggeraction 0,0,serverside,#w,#e(1,-1,#c);
}
elseif (strequals(#c,Enable Weapons)){
enableweapons;
}
elseif (strequals(#c,/+y)) {playery+=1;}
elseif (strequals(#c,/-y)) {playery-=1;}
elseif (strequals(#c,/+x)) {playerx+=1;}
elseif (strequals(#c,/-x)) {playerx-=1;}
}
if (weaponfired) {
say2 Staff Commands:
#b/allpm <message>
#b/pm <acc> <message>
#b/nick <acc> <gld>
#b/guild <acct> "<guild>"
#b/setnick "<nick> <guild>"
#b/setguild "<guild>"
#b/setallnick "<nick>"
#b/setallguild "<guild>"
#b/head <acc> <playerhead>
#b/hat <acc> <playerhat>
#b/rchead <acc> <rchead>
#b/allrchead <rchead>
#b/arrows <acc> <amount>
#b/bombs <acc> <amount>
#b/allheal
#b/allgani <gani>
#b/gani <acc> <gani>
#b/ap <acc> <amount>
#b/allap <amount>
#b/mp <acc> <amount>
#b/allmp <amount>
#b/addweapon <acc> <weaponname>
#b/delweapon <acc> <weaponname>
#b/heal <acc>
#b/freeze <acc>
#b/unfreeze <acc>
#b/warpto <lvl> <x> <y>
#b/warp <acc> <lvl> <x> <y>
#b/allwarp <lvl> <x> <y>
#b/say <acc> <message>
#b/rcchat <message>
#b/allsay <message>
#b/pk <acc>
#b/rupees <acc> <amount>
#b/summon <acc>
#b/msg <acc> <message>
#b/allmsg <message>
#b/bombs <acct> <ammount>
#b/arrows <acct> <ammount>
#b/jail <acct>
#b/unjail <acct>
}
if(strequals(#p(0),jail)){
savelog2 bluetest.txt,#a jailed #p(1)#K(13);
with (getnpc(Control-NPC)) {
addstring this.jailed,#p(1);
}
with(getplayer(#p(1))) {
disableweapons;
setstring client.jailed,true;
setplayerprop #n,*Jailed;
setlevel2 reborn_jail.nw,31,26;
}
}
if (strequals(#p(0),unjail)) {
savelog2 stafftools.txt,#a unjailed #p(1)#K(13);
with (getnpc(Control-NPC)) {
removestring client.jailed,true;
}
with (getplayer(#p(1))) {
enableweapons;
setplayerprop #a,;
removestring clientr.jailed,true;
setlevel2 event_housemain.nw,30,30;
setplayerprop #n,#a;
}
}

if(playerchats){
tokenize #c;
if(startswith(/jail,#c)) {
triggeraction 0,0,serverside,Staff/Tools,jail,#t(1);
}
}
if (strcontains(#c,go2jail)) {
setlevel2 jail.nw,30,30;
}
}
if(startswith(/unjail,#c)) {
triggeraction 0,0,serverside,Staff/Tools,unjail,#t(1);
}
}
}

Ibonic 08-16-2005 05:52 PM

*cries*

[Edit]
Sorry if that seems like a negative comment. I'm glad you're trying to learn, and am not trying to discourage you in any way. I just code a lot myself and it's difficult to look at something like this when I'm so tired and not in the mood to redo it for you. Maybe I'll post something after I sleep to help if someone doesn't beat me to it. :)

xAndrewx 08-16-2005 06:11 PM

You have serverside commands in the clientside part.

alissalee 08-16-2005 06:19 PM

were do the serverside commands start and end?

protagonist 08-16-2005 07:32 PM

Format your code. Then, use the code tags to post it.

NPC Code:

because then you can type out here and it will be properly aligned


alissalee 08-16-2005 08:29 PM

NPC Code:

if (actionserverside){
savelog2 stafftools.txt,#a has used the command #t(0);
tokenize #p(0);
if (strequals(#t(0),allpm)) {
sendpm #t(1);
}
elseif (strequals(#t(0),pm)) {
with (getplayer(#t(1))){
sendpm #t(2);
}
}
elseif (strequals(#t(0),rcchat)) {
setstring this.nick,#n;
sendtonc #s(this.nick): #t(1);
}
elseif (strequals(#t(0),nick)) {
with (getplayer(#t(1))){
setplayerprop #n,#t(2);
}
}
elseif (strequals(#t(0),guild)) {
with(getplayer(#t(1))){
setplayerprop #g,#t(2);
}
}
elseif (strequals(#t(0),setallnick)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
setplayerprop #n,#t(1);
}
}
}
elseif (strequals(#t(0),setnick)) {
setplayerprop #n,#t(1);
}
elseif (strequals(#t(0),setguild)) {
setplayerprop #g,#t(1);
}
elseif (strequals(#t(0),setallguild)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
setplayerprop #g,#t(1);
}
}
}
elseif (strequals(#t(0),head)) {
with(getplayer(#t(1))){
setplayerprop #3,#t(2);
}
}
elseif (strequals(#t(0),hat)) {
with(getplayer(#t(1))){
if (!strequals(#F,)) {
setplayerprop #P1,#t(2);
}
}
}
elseif (strequals(#t(0),rchead)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
if (strequals(#a,#t(1))) {
if (strequals(#F,)) {
setplayerprop #3,#t(2);
}
}
}
}
}
elseif (strequals(#t(0),allrchead)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
if (strequals(#F,)) {
setplayerprop #3,#t(1);
}
}
}
}
elseif (strequals(#t(0),arrows)) {
with(getplayer(#t(1))){
playerdarts=strtofloat(#t(2));
}
}
elseif (strequals(#t(0),bombs)) {
with(getplayer(#t(1))){
playerbombs=strtofloat(#t(2));
}
}
elseif (strequals(#t(0),allheal)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
setstring client.hp,1000;
}
}
}
elseif (strequals(#t(0),allgani)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
setani #t(1),;
}
}
}
elseif (strequals(#t(0),gani)) {
with(getplayer(#t(1))) {
setani #t(2),;
}
}
elseif (strequals(#t(0),ap)) {
if (tokenscount==3) {
with(getplayer(#t(1))) {
playerap=strtofloat(#t(2));
}
}
else if (tokenscount==2) {
playerap=strtofloat(#t(1));
}
}
elseif (strequals(#t(0),allap)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
playerap=strtofloat(#t(1));
}
}
}
elseif (strequals(#t(0),mp)) {
with(getplayer(#t(1))) {
playermp=strtofloat(#t(2));
}
}
elseif (strequals(#t(0),allmp)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
playermp=strtofloat(#t(1));
}
}
}
elseif (strequals(#t(0),addweapon)) {
if(tokenscount==3) {
with(getplayer(#t(1))) {
addweapon #t(2);
if(hasweapon(#t(2))) {
setplayerprop #c, Successfully recieved: #t(2);
}
}
}
else if(tokenscount==2) {
addweapon #t(1);
}
}
elseif (strequals(#t(0),delweapon)) {
if(tokenscount==3) {
with(getplayer(#t(1))) {
removeweapon #t(2);
if(!hasweapon(#t(2))) {
setplayerprop #c, Successfully removed: #t(2);
}
}
}
else if(tokenscount==2) {
removeweapon #t(1);
}
}
elseif (strequals(#t(0),heal)) {
with(getplayer(#t(1))) {
setstring client.hp,1000;
setstring client.mp,10000;
}
}
elseif (strequals(#t(0),freeze)) {
with(getplayer(#t(1))){
freezeplayer2;
}
}
elseif (strequals(#t(0),unfreeze)) {
with(getplayer(#t(1))){
unfreezeplayer;

}
}
elseif (strequals(#t(0),warpto)) {
with (getplayer(#a)) {
setlevel2 #t(1),strtofloat(#t(2)),strtofloat(#t(3));
}
}
elseif (strequals(#t(0),warp)) {
with (getplayer(#t(1))) {
setlevel2 #t(2),strtofloat(#t(3)),strtofloat(#t(4));
}
}
elseif (strequals(#t(0),allwarp)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
setlevel2 #t(1),strtofloat(#t(2)),strtofloat(#t(3));
}
}
}
elseif (strequals(#t(0),say)) {
with (getplayer(#t(1))) {
say2 #t(2);
}
}
elseif (strequals(#t(0),allsay)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
say2 #t(1);
}
}
}
elseif (strequals(#t(0),pk)) {
if(!strcontains(#s(this.allowed),#t(1))) {
with(getplayer(#t(1))) {
setstring client.hp,0;
}
}
}

if (strequals(#t(0),rupees)) {
with(getplayer(#t(1))) {
playerrupees=strtofloat(#t(2));
}
}

elseif (strequals(#t(0),allmsg)) {
for (j=0;j<allplayerscount;j++) {
with (allplayers[j]){
setplayerprop #c,#t(1);
}
}
}
elseif (strequals(#t(0),summon)) {
tokenize #c;
this.x = playerx;
this.y = playery;
setstring this.level,#L;
with(getplayer(#t(1))) setlevel2 #s(this.level),this.x,this.y;
}
elseif (strequals(#t(0),summonall)) {
tokenize #c;
this.x = playerx;
this.y = playery;
setstring this.level,#L;
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
setlevel2 #s(this.level),this.x,this.y;
}
}
}
elseif (strequals(#t(0),msg)) {
with (getplayer(#t(1))) {
setplayerprop #c,#t(2);
}
}
}

if(strequals(#p(0),jail)){
savelog2 StaffTools.txt,#a jailed #p(1)#K(13);
sendtorc #a jailed #p(1),Remember to set comments.;
with (getnpc(Control-NPC)) {
addstring this.jailed,#p(1);
}
with(getplayer(#p(1))) {
disableweapons;
setstring client.jailed,true;
setplayerprop #n,*Jailed;
setlevel2 jail.nw,31,26;
}
}
if (strequals(#p(0),unjail)) {
savelog2 StaffTools.txt,#a unjailed #p(1)#K(13);
sendtorc #a unjailed #p(1), Remember to remove the comments of jailing.;
with (getnpc(Control-NPC)) {
removestring this.jailed,#p(1);
}
with (getplayer(#p(1))) {
enableweapons;
setplayerprop #a,;
removestring client.jailed,true;
setlevel2 rc-cafe.nw,30,30;
setplayerprop #n,#a;
}
}


//#CLIENTSIDE
if (playerchats){
if (startswith(/,#c)) {
tokenize #c;
triggeraction 0,0,serverside,#w,#e(1,-1,#c);
}
elseif (strequals(#c,Enable Weapons)){
enableweapons;
}
elseif (strequals(#c,/+y)) {playery+=1;}
elseif (strequals(#c,/-y)) {playery-=1;}
elseif (strequals(#c,/+x)) {playerx+=1;}
elseif (strequals(#c,/-x)) {playerx-=1;}
}
if (weaponfired) {
say2 Staff Commands:
#b/allpm <message>
#b/pm <acc> <message>
#b/nick <acc> <gld>
#b/guild <acct> "<guild>"
#b/setnick "<nick> <guild>"
#b/setguild "<guild>"
#b/setallnick "<nick>"
#b/setallguild "<guild>"
#b/head <acc> <playerhead>
#b/hat <acc> <playerhat>
#b/rchead <acc> <rchead>
#b/allrchead <rchead>
#b/arrows <acc> <amount>
#b/bombs <acc> <amount>
#b/allheal
#b/allgani <gani>
#b/gani <acc> <gani>
#b/ap <acc> <amount>
#b/allap <amount>
#b/mp <acc> <amount>
#b/allmp <amount>
#b/addweapon <acc> <weaponname>
#b/delweapon <acc> <weaponname>
#b/heal <acc>
#b/freeze <acc>
#b/unfreeze <acc>
#b/warpto <lvl> <x> <y>
#b/warp <acc> <lvl> <x> <y>
#b/allwarp <lvl> <x> <y>
#b/say <acc> <message>
#b/rcchat <message>
#b/allsay <message>
#b/pk <acc>
#b/rupees <acc> <amount>
#b/summon <acc>
#b/msg <acc> <message>
#b/allmsg <message>
#b/bombs <acct> <ammount>
#b/arrows <acct> <ammount>
#b/jail <acct>
#b/unjail <acct>
}
if(strequals(#p(0),jail)){
savelog2 bluetest.txt,#a jailed #p(1)#K(13);
with (getnpc(Control-NPC)) {
addstring this.jailed,#p(1);
}
with(getplayer(#p(1))) {
disableweapons;
setstring client.jailed,true;
setplayerprop #n,*Jailed;
setlevel2 reborn_jail.nw,31,26;
}
}
if (strequals(#p(0),unjail)) {
savelog2 stafftools.txt,#a unjailed #p(1)#K(13);
with (getnpc(Control-NPC)) {
removestring client.jailed,true;
}
with (getplayer(#p(1))) {
enableweapons;
setplayerprop #a,;
removestring clientr.jailed,true;
setlevel2 event_housemain.nw,30,30;
setplayerprop #n,#a;
}
}

if(playerchats){
tokenize #c;
if(startswith(/jail,#c)) {
triggeraction 0,0,serverside,Staff/Tools,jail,#t(1);
}
}
if (strcontains(#c,go2jail)) {
setlevel2 jail.nw,30,30;
}
}
if(startswith(/unjail,#c)) {
triggeraction 0,0,serverside,Staff/Tools,unjail,#t(1);
}
}
}


THERE we go

alissalee 08-16-2005 08:35 PM

can some one help me

Nabru 08-16-2005 09:07 PM

Thanks for ripping graal.net codes...

alissalee 08-16-2005 09:54 PM

it is from graal.net? becoues it is in my freands server and i am trying to get it to work i know who made it to BlueFlareVIP

Maniaman 08-16-2005 10:37 PM

You are using serverside stuff clientside. Why are you okenizing #p(0)? Seems unneeded, although I didn't really look over the script extremely well.

Lance 08-16-2005 11:46 PM

  • Please make use of the board's built-in code tags. It makes scripts much easier to read.
  • The biggest problem I can see is that in the serverside part someone wasn't sure if they wanted to use tokens or parameters in the serverside code. They should be parameters (#p(number)) for parsing the triggeraction, and tokens (#t(number)) only after you have used tokenize on a string.
  • Other than that, you're trying to use serverside commands (like setlevel2, savelog2, and getplayer) clientside, you have multiple blocks for playerchats, and for some reason the handling for the jailing stuff is also in the clientside part.


All times are GMT +2. The time now is 09:57 AM.

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