I've been working on certain pvp script for my server, but I've got odd problem.
for(set .@m, 0; .@m < getarraysize(.@restrictedmaps$); set .@m, .@m + 1) { while(.@map$ == .@restrictedmaps$[.@m]){ for(set .@e, 1; .@e < 11; set .@e, .@e + 1) { if(getequipid(.@e) != -1) { for(set .@i, 0; .@i < getarraysize(.@itemsnotallowed); set .@i, .@i + 1) { if(getequipid(.@e) == .@itemsnotallowed[.@i]) { dispbottom "Item '"+getitemname(getequipid(.@e))+"' is not allowed in this map. It has been unequiped."; unequip .@e; break; } else{ for(set .@n, 0; .@n < getarraysize(.@cardsnotallowed); set .@n, .@n + 1){ //I WANTED TO DO IT WITH FOR LOOP BUT SAKRAY WAS LIKE 'FUCK YOU, YOU ARE NOT USING MORE LOOPS' if(getequipcardid(.@e, 0) == .@cardsnotallowed[.@n] || getequipcardid(.@e, 1) == .@cardsnotallowed[.@n] || getequipcardid(.@e, 2) == .@cardsnotallowed[.@n] || getequipcardid(.@e, 3) == .@cardsnotallowed[.@n]){ dispbottom "Item '"+getitemname(getequipcardid(.@e, .@)+"' is not allowed in this map. It has been unequiped."; unequip .@e; break; } } } } } sleep2 100; getmapxy(.@map$,.@x,.@y,0); } }
but starts to 'crash' with bigger table inputes, it just freezes after 9-10 comparisons. I've already split the script to 2 different ones, one to check items and one to check cards and it seems to work. But I'd like to understand why 'bigger' version crashes, any ideas?
Hello guys,
I've been working on certain pvp script for my server, but I've got odd problem.
It works perfectly fine with:
setarray .@itemsnotallowed[0],2541,2382,1530,1132,1565,1369,1141,2629,2545;
setarray .@cardsnotallowed[0],4441,4365,4407,4128,4276,4361;
but starts to 'crash' with bigger table inputes, it just freezes after 9-10 comparisons. I've already split the script to 2 different ones, one to check items and one to check cards and it seems to work. But I'd like to understand why 'bigger' version crashes, any ideas?
Edited by SediShare this post
Link to post
Share on other sites