Jump to content
  • 0
Sign in to follow this  
Sedi

PvP System

Question

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, .@)+"' 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

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.