Jump to content
  • 0

Help with Afk Script


Mystogan

Question


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   1
  • Joined:  05/05/12
  • Last Seen:  

Hello i am trying to get this script to work properly but i am unable to.  

The script is so that if a user stays idle for 30 sec in BG he/she will get kicked.

 

the script loads and only works on the first map of the array bat_a01 but it will not work on the rest

 

 

-	script	AROBG	-1,{

OnInit:
//Configuración
set .s,1;	// Script Off = 0	Script On = 1
set .t,30;	// Segundos que se puede estar AFK antes de que se ejecute el castigo.
set .c,1;	// Tipo de Castigo por estar AFK:
			//	1 = Kick	2 = Jail	3 = Ban
set .z$,"5n";	// Tiempo de Castigo en caso de ser Jail o Ban:
			//	n = minuto	h = hora	m = meses	y = año
			// Ejempo:
			//	1n = 1 minuto	2n = 2 minutos	3n = 3 minutos, etc
			//	1h = 1 hora		2h = 2 horas	3h = 3 horas, etc
			//	1m = 1 mes		2m = 2 meses	3m = 3 meses, etc
			//	1y = 1 año		2y = 2 años		3y = 3 años, etc
setarray .a$[0],"kick","jail","ban";
setarray .m$[0],"bat_a01", "bat_a02", "bat_b01", "bat_b02", "bat_c01", "bat_c02", "bat_c03", "arug_cas07"; // Mapas Anti AFK. Maximo 127 mapas.
end;

OnPCLoadMapEvent:
	if(.s != 0){
			for(set .@i,0; .@i < getarraysize(.m$); set .@i, .@i+1){
			if(.m$[@i] == strcharinfo(3)){
				while(.@p <= .t){
					getmapxy(.@m1$,.@x1,.@y1,0);
					sleep2 1000;
					getmapxy(.@m2$,.@x2,.@y2,0);
					if(.@m1$ == .@m2$ && .@x1 == .@x2 && .@y1 == .@y2){
						set .@p,.@p+1;
					} else { 
						set .@p,0;
					}
				}
				if(.@p >= .t){
					announce "Has estado parado en el mismo punto mucho tiempo y eso puede significar que estas AFK.",bc_self,0xff8000;
					sleep2 2000;
					announce "Por razones de seguridad se procederá a ejecutar un "+.a$[.c]+".",bc_self,0xff8000;
					sleep2 2000;
					if(.c == 1){
						atcommand "@kick "+strcharinfo(0);
						end;
					}
					if(.c == 2){
						atcommand "@jailfor "+.z$+" "+strcharinfo(0);
						end;
					}
					if(.c == 3){
						atcommand "@ban "+.z$+" "+strcharinfo(0);
						end;
					}
				}
			}
		}
	}
end;
}

// Agregar los mismos mapas que se agregan en el array .m$[0]
//mapa[TABULACIóN]mapflag[TABULACIóN]loadevent
bat_a01	mapflag	loadevent
bat_a02	mapflag	loadevent
bat_b01	mapflag	loadevent
bat_b02	mapflag	loadevent
bat_c01	mapflag	loadevent
bat_c02	mapflag	loadevent
bat_c03	mapflag	loadevent
arug_cas07	mapflag	loadevent

 

Link to comment
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.   Paste as plain text instead

  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.

×
×
  • Create New...