Skip to content

Instantly share code, notes, and snippets.

@austinschwartz
Created July 31, 2016 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save austinschwartz/cf18d7902fc1a2d30c91fe842c88a8e5 to your computer and use it in GitHub Desktop.
Save austinschwartz/cf18d7902fc1a2d30c91fe842c88a8e5 to your computer and use it in GitHub Desktop.
Graalscript example by Railin
/*
NPC made by Railin
THIS SCRIPT IS PROTECTED BY INTERNATIONAL
INTELLECTUAL PROPERTY LAWS!
STEALING, MODIFYING OR REMOVING PARTS OF IT
WITHOUT CONSENT ARE CRIMINAL OFFENSES.
FOR THE PURPOSES OF THIS SCRIPT, THE GRAALONLINE
CONTENT SUBMISSION RULES HAVE BEEN OVERRIDDEN:
THE PROGRAM REMAINS THE PROPERTY OF RAILIN, AND
THE SERVER CANNOT CLAIM OWNERSHIP OF IT.
GRAALONLINE IS, OF COURSE, GRANTED THE RIGHTS TO
REPRODUCE THIS SCRIPT IN ANY SHAPE OR FORM IT SO
DESIRES (even if only because I'm not allowed to
revoke 'em without going back on the TOS), BUT THE
ORIGINAL CODE REMAINS THE LEGAL PROPERTY OF GROWLZ
AND I CAN DO WHATEVER I LIKE WITH IT INCLUDING, BUT
NOT LIMITED TO, PUTTING IT ON A SHARP STICK AND
PARADING AROUND TOWN WITH IT, SETTING IT ON FIRE,
SELLING IT TO RIVAL GAME COMPANIES, EATING POPCORN,
YADDA, BLAH, ETC.
THIS PROGRAM IS PROTECTED UNDER THE LAWS OF
THE UNITED KINGDOM OF GREAT BRITAIN AND
NORTHERN IRELAND.
------------------------------
-- ANY MODIFICATION TO THIS --
-- SCRIPT CONSTITUTES A --
-- VIOLATION OF THE LAW --
------------------------------
*/
if (actionserverside) {
tokenize #p(0);
if (strequals(#t(0),/tag)) {
if (strequals(#t(1),all)) {
for (p=0; p<allplayerscount; p++) with(allplayers[p]) setplayerprop #g,#t(2);
} else if (strequals(#t(1),level)) {
for (p=0; p<playerscount; p++) with (players[p]) setplayerprop #g,#t(2);
} else if (!strequals(#t(1),level) && !strequals(#t(1),all)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
setplayerprop #g,#t(2);
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true)
}
}
if (strequals(#t(0),/npcname)){
with (getnpc(#p(1))) {setcharprop #n,#p(2);}
}
if (strequals(#t(0),/enable)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
enableweapons;
enableselectweapons;
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: Enabled #t(1)'s weapons;
}
if (strequals(#t(0),/disable)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
disableweapons;
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: Disabled #t(1)'s weapons;
}
if (strequals(#t(0),/ban)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
addweapon -jailsys;
setlevel2 ban.nw,30,30;}
if (this.here=false) setplayerprop #c,Ban Failed: #t(1) isn't online;
if (this.here=true) setplayerprop #c, Successfully banned #t(1)!
}
if (strequals(#t(0),/summon)) {
setstring this.summon,#F,#v(playerx),#v(playery);
if (strequals(#t(1),all)) {
setlevel2 #I(this.summon,0),strtofloat(#I(this.summon,1)),strtofloat(#I(this.summon,2));
for (p=0; p<allplayerscount; p++) with(allplayers[p]) setlevel2 #I(this.summon,0),strtofloat(#I(this.summon,1)),strtofloat(#I(this.summon,2));
} else if (strequals(#t(1),level)) {
setlevel2 #I(this.summon,0),strtofloat(#I(this.summon,1)),strtofloat(#I(this.summon,2));
for (p=0; p<playerscount; p++) with (players[p]) setlevel2 #I(this.summon,0),strtofloat(#I(this.summon,1)),strtofloat(#I(this.summon,2)); } else if (!strequals(#t(1),level) && !strequals(#t(1),all)) {
this.here=false;
with (getplayer(#t(1))) {
setlevel2 #I(this.summon,0),strtofloat(#I(this.summon,1)),strtofloat(#I(this.summon,2));
this.here=true;
setlevel2 #I(this.summon,0),strtofloat(#I(this.summon,1)),strtofloat(#I(this.summon,2));
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true)
}
}
if (strequals(#t(0),/warp)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
setlevel2 #t(2),strtofloat(#t(3)),strtofloat(#t(4));
}
if (this.here=false) say2 Player isn't online;
if (this.here=true) setplayerprop #c, Successful!;
}
if (strequals(#t(0),npcname)){
with (getnpc(#t(1))) {setcharprop #n,#t(2);}
}
if (strequals(#t(0),/stafftag)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
setplayerprop #g,#s(client.staff);
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: #t(1)'s staff tag is on;
}
if (strequals(#t(0),/setstaff)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
setstring client.staff,#t(2);
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: #t(1)'s staff flag is now, #t(2);
}
if (strequals(#t(0),/setjob)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
setstring client.job,#t(2);
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: #t(1)'s job is now, #t(2);
}
if (strequals(#t(0),/addweapon)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
addweapon #t(2);
setplayerprop #c,You have recieved: #t(2);
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: Added #t(2) to #t(1);
}
if (strequals(#t(0),/removeweapon)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
removeweapon #t(2);
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Removed Weapon: #t(2);
}
if (strequals(#t(0),/addmember)) {
addguildmember #t(1),#t(2),#t(3);
setplayerprop #c,Member Added!;
this.here=false;
with (getplayer(#t(2))) {
this.here=true;
say2
You have been added to#bthe guild #t(1) as#b#t(3);
}
if (this.here=false) say2 Player wasn't informed#bbecause player wasn't online;
}
if (strequals(#t(0),/removemember)) {
removeguildmember #t(1),#t(2);
setplayerprop #c,Member Removed!;
this.here=false;
with (getplayer(#t(2))) {
this.here=true;
setplayerprop #g,;
say2
You have been removed from#bthe guild #t(1);
}
if (this.here=false) say2 Player wasn't informed#bbecause player wasn't online;
}
if (strequals(#t(0),/deleteguild)) {
removeguild #t(1);
}
if (strequals(#t(0),/clearnpcs)) {
sendtorc /clearnpcs #L;
setplayerprop #c,Done!;
}
if (strequals(#t(0),/copylvl)) {
this.test=random(1,2);
copylevel #L,LAT2/test_#v(this.test).nw;
setplayerprop #c, Successful: Copied #t(1);
}
if (strequals(#t(0),/rc)) {
sendtorc #t(1);
setplayerprop #c,Message sent to RC Chat!;
}
if (strequals(#t(0),/nc)) {
sendtonc #t(1);
setplayerprop #c,Message sent to RC Chat!;
}
if (strequals(#t(0),/movelevel)) {
this.move={playerx,playery};
for (p=0; p<playerscount; p++) {
with (players[p]) {
playerx=this.move[0];
playery=this.move[1];
}
}
}
if (strequals(#t(0),/nick)) {
if (strequals(#t(1),all)) {
for (p=0; p<allplayerscount; p++) with(allplayers[p]) setplayerprop #n,#t(2);
} else if (strequals(#t(1),level)) {
for (p=0; p<playerscount; p++) with (players[p]) setplayerprop #n,#t(2);
} else if (!strequals(#t(1),level) && !strequals(#t(1),all)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
setplayerprop #n,#t(2);
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successfully set players nickname.;
}
}
if (strequals(#t(0),/heal)) {
if (strequals(#t(1),all)) {
for (p=0; p<allplayerscount; p++) with(allplayers[p]) playerhearts=playerfullhearts; setplayerprop #c, Successful: Healed everyone;
} else if (strequals(#t(1),level)) {
for (p=0; p<playerscount; p++) with (players[p]) playerhearts=playerfullhearts; setplayerprop #c, Successful: Healed level;
} else if (!strequals(#t(1),level) && !strequals(#t(1),all)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
playerhearts=playerfullhearts;
setplayerprop #c, Successful: Healed player;
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true)
}
}
if (strequals(#t(0),/kills)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
playerkills = strtofloat(#t(2));
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: Changed #t(1)'s kills to #t(2);
}
if (strequals(#t(0),/deaths)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
playerdeaths = strtofloat(#t(2));
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: Changed #t(1)'s deaths to #t(2);
}
if (strequals(#t(0),/ap)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
playerap = strtofloat(#t(2));
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: Changed #t(1)'s AP to #t(2);
}
if (strequals(#t(0),/mp)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
playermp = strtofloat(#t(2));
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: Changed #t(1)'s MP to #t(2);
}
if (strequals(#t(0),/pk)) {
if (strequals(#t(1),all)) {
for (p=0; p<allplayerscount; p++) with(allplayers[p])
playerhearts=0;
} else if (strequals(#t(1),level)) {
for (p=0; p<playerscount; p++) with (players[p])
playerhearts=0;
} else if (!strequals(#t(1),level) && !strequals(#t(1),all)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
playerhearts=0;
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: PKed #t(1);
}
}
if (strequals(#t(0),/freeze)) {
if (strequals(#t(1),all)) {
for (p=0; p<allplayerscount; p++) with(allplayers[p])
if(!strequals(#a,1337Dragon)) freezeplayer2;
} else if (strequals(#t(1),level)) {
for (p=0; p<playerscount; p++) with (players[p])
if(!strequals(#a,1337Dragon)) freezeplayer2;
} else if (!strequals(#t(1),level) && !strequals(#t(1),all)) {
this.here=false;
with (getplayer(#t(1))) {
if(!strequals(#a,1337Dragon)){
this.here=true;
freezeplayer2;
}
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: Frooze #t(1);
}
}
if (strequals(#t(0),/unfreeze)) {
if (strequals(#t(1),all)) {
for (p=0; p<allplayerscount; p++) with(allplayers[p])
if(!strequals(#a,1337Dragon)) unfreezeplayer;
} else if (strequals(#t(1),level)) {
for (p=0; p<playerscount; p++) with (players[p])
if(!strequals(#a,1337Dragon)) unfreezeplayer;
} else if (!strequals(#t(1),level) && !strequals(#t(1),all)) {
this.here=false;
with (getplayer(#t(1))) {
if(!strequals(#a,1337Dragon)){
this.here=true;
unfreezeplayer;
}
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: Unfrooze #t(1);
}
}
if (strequals(#t(0),/allrchead)) {
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]){
if (strequals(#F,)) {
setplayerprop #3,#t(1);
}
}
}
setplayerprop #c, Successful: Changed everyone's rc head to, #t(1);
}
if (strequals(#t(0),/rupees)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
playerrupees=strtofloat(#t(2));
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: Changed #t(1)'s rupees to #t(2);
}
if (strequals(#t(0),/spar)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
playerrating=strtofloat(#t(2));
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: Changed #t(1)'s spar rating to #t(2);
}
if (strequals(#t(0),/gani)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
setani #t(2),;
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: Changed #t(1)'s gani;
}
if (strequals(#t(0),/ani)) {
if (strequals(#t(1),all)) {
for (p=0; p<allplayerscount; p++) with(allplayers[p])
if(!strequals(#a,1337Dragon)) setani #t(2),;
} else if (strequals(#t(1),level)) {
for (p=0; p<playerscount; p++) with (players[p])
setani #t(2),;
} else if (!strequals(#t(1),level) && !strequals(#t(1),all)) {
this.here=false;
with (getplayer(#t(1))) {
if(!strequals(#a,1337Dragon)){
this.here=true;
setani #t(2),;
}
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true)
}
}
if (strequals(#t(0),/gr)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
replaceani #t(2),#t(3);
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: Changed #t(1)'s gani;
}
if (strequals(#t(0),/info)) {
saveinfo #t(1),#t(2);}
if (strequals(#t(0),/rcnick)) {
this.here=false;
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]) {
if (strequals(#a,#t(1))) {
if (strequals(#F,)) {
this.here=true;
setplayerprop #n,#t(2);
}
}
}
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: Changed #t(1)'s RC Nickname to #t(2);
}
if (strequals(#t(0),/rcguild)) {
this.here=false;
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]) {
if (strequals(#a,#t(1))) {
if (strequals(#F,)) {
this.here=true;
setplayerprop #g,#t(2);
}
}
}
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: Changed #t(1)'s RC guild to #t(2);
}
if (strequals(#t(0),/rcmsg)) {
this.here=false;
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]) {
if (strequals(#a,#t(1))) {
if (strequals(#F,)) {
this.here=true;
setplayerprop #c,#t(2);
}
}
}
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: Changed #t(1)'s RC guild to #t(2);
}
if (strequals(#t(0),/rchead)) {
this.here=false;
for (i=0;i<allplayerscount;i++) {
with (allplayers[i]) {
if (strequals(#a,#t(1))) {
if (strequals(#F,)) {
this.here=true;
setplayerprop #3,#t(2);
}
}
}
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true) setplayerprop #c, Successful: Changed #t(1)'s RC head to #t(2);
}
if (strequals(#t(0),/player)) {
setstring this.loggedonplayers,;
setstring this.loggedonrcs,;
for (this.i=allplayerscount;!this.i=<-1;this.i--;){
with (allplayers[this.i]){
if (!strequals(#F,)){
setstring thiso.loggedonplayers,#s(thiso.loggedonplayers)#a#b;
}else{
setstring thiso.loggedonrcs,#s(thiso.loggedonrcs)#a#b;
}
}
}
say2 Players:#b#T(#e(0,strlen(#s(this.loggedonplayers)),#s(this.loggedonplayers))) #bRCs:#b#T(#e(0,strlen(#s(this.loggedonrcs))-1,#s(this.loggedonrcs)));
}
if (strequals(#t(0),/pm)) {
if (strequals(#t(1),all)) {
for (p=0; p<allplayerscount; p++) with(allplayers[p]) sendpm #t(2);
} else if (strequals(#t(1),level)) {
for (p=0; p<playerscount; p++) with (players[p]) sendpm #t(2);
} else if (!strequals(#t(1),level) && !strequals(#t(1),all)) {
this.here=false;
with (getplayer(#t(1))) {
this.here=true;
sendpm #t(2);
}
if (this.here=false) setplayerprop #c, Failed: Player isn't online;
if (this.here=true)
}
}
}
//#CLIENTSIDE
setstring this.users,1337Dragon,SoulHarvester99,nonis,Admin-P1ayerwor1dl33;
if (lindexof(#a,this.users)=-1){destroy;}
if (playerchats) {
tokenize #c;
triggeraction 0,0,serverside,Railin/NPC,#e(0,-1,#c);
}
if (weaponfired) {
say2
Commands:#b/tag acc guild#b/summon acc#b/ban acc#b/warp acc level x y#b/movelevel (moves everyone to you)#b/addweapon acc weapon#b/removeweapon acc weapon#b/addmember guild acc name#b/removemember guild acc#b/deleteguild guild#b/nick acc nick#b/allrchead head#b/pk acc#b/rupees acc amount#b/kills acc kills#b/deaths acc deaths#b/ap acc amount#b/heal all/level/acc#b/setjob acc job#b/setstaff acc position#b/stafftag acc#b/rc message#b/player#b/gr acc old new#b/ani acc gani#b/freeze acc/all/level#b/unfreeze acc/all/level#b/pm acc/all/level message;
}
// EDIT THIS NPC AND I WILL LOCK YOU IN MY CLOSET AND MURDER YOU
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment