Jump to content

  •  

Photo

PvP System


  • Please log in to reply
No replies to this topic

#1 Sedi

Sedi

    Newbie

  • Members
  • Pip
  • 1 posts
  • Github:Alvaren

Posted 06 May 2014 - 08:48 AM

Hello guys,

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, .@b))+"' is not allowed in this map. It has been unequiped.";	 						unequip .@e;	 						break;	 					   }		}	}				 					} 				} 				sleep2 100; 				getmapxy(.@map$,.@x,.@y,0); 			} 		}

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 Sedi, 06 May 2014 - 10:31 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users


This topic has been visited by 26 user(s)