Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IF(@#ptllaunchmode=0);
- DO;
- IFMATCHES(%@¤tcmd%,"^/ptl$");
- @#filtermes=1;
- @#ptllaunchmode=1;
- EXEC(Portals.txt,"Processing...");
- ENDIF;
- IF(%@&pscoords[0]%!=);
- FOREACH(@&pscoords,&coord);
- #x=0;#y=0;#z=0;
- MATCH(%&coord%,"^(.+?) (.+?) (.+)$",{#x,#y,#z});
- #y1=%YPOS%+1;
- IF((%#x%=%XPOS%)&&((%#y%=%YPOS%)||(%#y%=%#y1%))&&(%#z%=%ZPOS%));
- @#ptllaunchmode=2;
- EXEC(Portals.txt,"Processing...");
- #match=1;
- BREAK;
- ENDIF;
- NEXT;
- IF(#match=1);
- #match=0;
- IF(#teleporting=1);
- #teleporting=0;
- #i=0;
- DO;INC(#i);IF((%#x%!=%XPOS%)||((%#y%!=%YPOS%)&&(%#y%!=%#y1%))||(%#z%!=%ZPOS%));BREAK;ENDIF;UNTIL(#i>50);
- ELSE;
- INDEXOF(@&pscoords,#i,"%#x% %#y% %#z%");
- LOG(&7[&3Portals&7] &3%@&ptlmatch% &a%@&ppoints[%#i%]%);
- DO;
- #y1=%YPOS%+1;
- IFMATCHES(%@¤tcmd%,"^/ptl$");
- @#filtermes=1;
- @#ptllaunchmode=1;
- EXEC(Portals.txt,"Processing...");
- ENDIF;
- IF((%#x%!=%XPOS%)||((%#y%!=%YPOS%)&&(%#y%!=%#y1%))||(%#z%!=%ZPOS%));
- #x=0;#y=0;#z=0;
- BREAK;
- ENDIF;
- IF(RMOUSE);
- INDEXOF(@&pscoords,#i,"%#x% %#y% %#z%");
- @&tbc=/%@&pcmds[%#i%]%;
- #teleporting=1;
- BREAK;
- ENDIF;
- LOOP;
- ENDIF;
- ENDIF;
- ENDIF;
- LOOP;
- ENDIF;
- IF(@#ptllaunchmode=1);
- @#ptllaunchmode=0;
- UNSET(@¤tcmd);
- MATCH(%@&chatcontent%,"^/ptl (.+?)\b",{&case});
- IFMATCHES(%&case%,"^h$|^help$",&ccase);
- LOG(&8=============[&3Portals&8]=============);
- LOG(&a/ptl h &3- %@&ptlh1%);
- LOG(&a/ptl l &3- %@&ptlh2%);
- LOG(&a/ptl ap &7<point name> <cmd> &3- %@&ptlh3%);
- LOG(&a/ptl dp &7<point name> &3- %@&ptlh4%);
- LOG(&a/ptl sel &7<point name> &3- %@&ptlh5%);
- LOG(%@&ptlh6%);
- ENDIF;
- IFMATCHES(%&case%,"^ap$|^addpoint$",&ccase);
- MATCH(%@&chatcontent%,"^/ptl %&case% (.+?) (.+)$",{&point,&cmd});
- IF(%&point%=);
- LOG(&7[&3Portals&7] &3%@&ptlneedspnamecmd%);
- ELSE;
- INDEXOF(@&ppoints[],#i,%&point%);
- IF(#i=-1);
- IFBEGINSWITH(%&cmd%,"/");
- &cmd=\%&cmd%;
- REPLACE(&cmd,"\/","");
- ENDIF;
- PUSH(@&ppoints[],"%&point%");
- PUSH(@&pcmds[],"%&cmd%");
- PUSH(@&pscoords[],"%XPOS% %YPOS% %ZPOS%");
- LOG(&7[&3Portals&7] &3%@&ptadded% &a%&point% &a< &b%&cmd%&a >);#ind=1;
- ENDIF;
- ELSE;
- IF((#ind!=1)&&(#i!=-1));
- LOG(&7[&3Portals&7] &3%@&ptlexists%);
- ELSE;
- #ind=0;
- ENDIF;
- ENDIF;
- ENDIF;
- IFMATCHES(%&case%,"^dp$|^delpoint$",&ccase);
- MATCH(%@&chatcontent%,"^/ptl %&case% (.+?)$",{&point});
- IF(%&point%=);
- LOG(&7[&3Portals&7] &3%@&ptlneedspname%);
- ELSE;
- INDEXOF(@&ppoints[],#i,"%&point%");
- IF(#i=-1);
- LOG(&7[&3Portals&7] &3%@&ptlunexists%);
- ELSE;
- LOG(&7[&3Portals&7] &3%@&ptlemd% "&a%@&ppoints[%#i%]%&3");
- UNSET(@&ppoints[%#i%]);
- UNSET(@&pcmds[%#i%]);
- UNSET(@&pscoords[%#i%]);
- INDEXOF(@&ppoints[],#i,"");
- IF(#i!=-1);
- ARRAYSIZE(@&ppoints,#n);#n=#n-1;
- FOR(#j,%#i%,%#n%);
- #k=#j+1;
- @&ppoints[%#j%]=%@&ppoints[%#k%]%;
- @&pcmds[%#j%]=%@&pcmds[%#k%]%;
- @&pscoords[%#j%]=%@&pscoords[%#k%]%;
- NEXT;
- IF(%@&ppoints[1]%!=);
- POP(@&ppoints[],&del);
- POP(@&pcmds[],&del);
- POP(@&psoords[],&del);
- ENDIF;
- ENDIF;
- ENDIF;
- ENDIF;
- IF(%@&ppoints[0]%=);
- UNSET(@&ppoints[]);
- UNSET(@&pcmds[]);
- UNSET(@&pscoords[]);
- ENDIF;
- ENDIF;
- IFMATCHES(%&case%,"^l$|^list$",&ccase);
- ARRAYSIZE(@&ppoints,#n);
- IF(#n!=0);
- #n=#n-1;
- LOG(&7[&3Portals&7] &3%@&ptlplist%);
- @#tcsmblockchat=1;
- FOR(#i,0,%#n%);
- LOG("&a%@&ppoints[%#i%]%&a <&b%@&pscoords[%#i%]%&a> => <&b%@&pcmds[%#i%]%&a>");
- NEXT;
- @#tcsmblockchat=0;
- ELSE;
- LOG(&7[&3Portals&7] &3%@&ptlnopoints%);
- ENDIF;
- ENDIF;
- IFMATCHES(%&case%,"^s$|^sel$|^select$",&ccase);
- MATCH(%@&chatcontent%,"^/ptl %&case% (.+?)$",{&point});
- IF(%&point%=);
- LOG(&7[&3Portals&7] &3%@&ptlneedspname%);
- ELSE;
- INDEXOF(@&ppoints[],#i,"%&point%");
- IF(#i=-1);
- LOG(&7[&3Portals&7] &3%@&ptlunexists%);
- ELSE;
- MATCH(%@&pscoords[%#i%]%,"^(.+?) (.+?) (.+)$",{#x,#y,#z});
- ECHO("//pos1 %#x%,%#y%,%#z%");
- ENDIF;
- ENDIF;
- ENDIF;
- IF(%&ccase%=);
- ECHO(%@&chatcontent%);
- ENDIF;
- ENDIF;
- IF(@#ptllaunchmode=2);
- @#ptllaunchmode=0;
- ARRAYSIZE(@&ppoints,#n);
- ARRAYSIZE(@&pcmds,#m);
- ARRAYSIZE(@&pscoords,#o);
- IF((#n=#m)&&(#m=#o));
- #max=#n;
- ELSE;
- #sort[0]=#n;
- #sort[1]=#m;
- #sort[2]=#o;
- FOR(#i,1,2);
- #j=#i-1;
- IF(#sort[%#i%]>#sort[%#j%]);#max=#sort[%#i%];ENDIF;
- NEXT;
- ENDIF;
- FOR(#i,0,%#max%);
- IF(((%@&ppoints[%#i%]%=)&&(%@&pcmds[%#i%]%!=)&&(%@&pscoords[%#i%]%!=))||((%@&ppoints[%#i%]%!=)&&(%@&pcmds[%#i%]%=)&&(%@&pscoords[%#i%]%!=))||((%@&ppoints[%#i%]%!=)&&(%@&pcmds[%#i%]%!=)&&(%@&pscoords[%#i%]%=))||((%@&ppoints[%#i%]%=)&&(%@&pcmds[%#i%]%=)&&(%@&pscoords[%#i%]%!=))||((%@&ppoints[%#i%]%=)&&(%@&pcmds[%#i%]%!=)&&(%@&pscoords[%#i%]%=))||((%@&ppoints[%#i%]%!=)&&(%@&pcmds[%#i%]%=)&&(%@&pscoords[%#i%]%=)));
- LOG(&7[&3Portals&7] &4CRITICAL ERROR!!!);
- LOG(&7[&3Portals&7] &4Deleting portal %#i%...);
- LOGTO(debug.txt,"--------------------------------------------------");
- LOGTO(debug.txt,"[%DATE%|%TIME%] ERROR REPORT BY PORTALS");
- LOGTO(debug.txt,"--------------------------------------------------");
- LOGTO(debug.txt,"Known stats:");
- IF(%@&ppoints[%#i%]%!=);
- LOGTO(debug.txt,"Point name: %@&ppoints[%#i%]%");
- ENDIF;
- IF(%@&pcmds[%#i%]%!=);
- LOGTO(debug.txt,"Point coords: %@&pcmds[%#i%]%");
- ENDIF;
- IF(%@&pscoords[%#i%]%!=);
- LOGTO(debug.txt,"Portal coords: %@&pscoords[%#i%]%");
- ENDIF;
- UNSET(@&ppoints[%#i%]);
- UNSET(@&pcmds[%#i%]);
- UNSET(@&pscoords[%#i%]);]
- LOG(&7[&3Portals&7] &4All what we know is written to &cdebug.txt);
- ENDIF;
- NEXT;
- ENDIF;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement