Code Creation Request

almarket23

New member
Messages
90
Points
0
Github
nexus
Emulator
prontera,150,150,5 script codes 89,{set .@n$,"[Code Creator]"; mes .@n$; mes "This code will only work with the help of the Administrator. Please give this code to our Administrator so that they can Reset your System Credential."; next; mes .@n$; mes "Please write this down."; mes "==================================="; next; set .codesArray,rand(0,5); if ( .codesArray == 0 ) { setarray .codes[1],A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,1,2,3,4,5,6,7,8,9,0; } if ( .codesArray == 1 ) { setarray .codes[1],A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,1,2,3,4,5,6,7,8,9,0; } if ( .codesArray == 2 ) { setarray .codes[1],A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,1,2,3,4,5,6,7,8,9,0; } if ( .codesArray == 3 ) { setarray .codes[1],A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,1,2,3,4,5,6,7,8,9,0; } if ( .codesArray == 4 ) { setarray .codes[1],A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,1,2,3,4,5,6,7,8,9,0; } if ( .codesArray == 5 ) { setarray .codes[1],A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,1,2,3,4,5,6,7,8,9,0; } set .GenerateCode1,.codes[rand(0,61)]; set .GenerateCode2,.codes[rand(0,61)]; set .GenerateCode3,.codes[rand(0,61)]; set .GenerateCode4,.codes[rand(0,61)]; set .GenerateCode5,.codes[rand(0,61)]; set .GenerateCode6,.codes[rand(0,61)]; set .GenerateCode7,.codes[rand(0,61)]; set .GenerateCode8,.codes[rand(0,61)]; set .GenerateCode9,.codes[rand(0,61)]; set .GenerateCode10,.codes[rand(0,61)]; mes .@n$; mes "Please write this down."; mes "==================================="; mes "Your Code is: "+.GenerateCode1+""+.GenerateCode2+""+.GenerateCode3+""+.GenerateCode4+""+.GenerateCode5+""+.GenerateCode6+""+.GenerateCode7+""+.GenerateCode8+""+.GenerateCode9+""+.GenerateCode10+""; close; } }}

Can anyone fix this script for me please? I am creating an NPC that will generate a code.

The code is a combination of Capital, Small Letters and a number.

Thanks in advance for those who wants to help me...

 
I think this should work, didn't test it though

Code:
prontera,150,150,5	script	codes	89,{
set .@n$,"[code Creator]";
	mes .@n$;
	mes "This code will only work with the help of the Administrator. Please give this code to our Administrator so that they can Reset your System Credential.";
	next;
	mes .@n$;
	mes "Please write this down.";
	mes "===================================";
	for (.@i = 0; .@i< 10; .@i++) {
		.@ch$ = .codes$[rand(getarraysize(.codes$))];
		.@gen$[.@i] = (rand(2)?strtolower(.@ch$):.@ch$);
	}
	mes "Your Code is: " + implode(.@gen$);
	close;

OnInit:
	setarray .codes$[0],"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0";	end;}
 
Last edited by a moderator:
Back
Top