Jump to content
  • 0

Error checking IP / Erro ao fazer checagem de IP


Tassadar

Question


  • Group:  Members
  • Topic Count:  52
  • Topics Per Day:  0.02
  • Content Count:  107
  • Reputation:   5
  • Joined:  07/21/16
  • Last Seen:  


[Inglês]
Good night guys!
I'm using this npc. But when I changed the part marked to limit use by ip. The NPC began delivering the items several times in a row.

	// Ip check to prevent multi accounts
	// Toggle 
	// [0] = Off
	// [1] = On
	.IPCheck = 0;

	// Ip check to prevent multi accounts
	// Toggle 
	// [0] = Off
	// [1] = On
	.IPCheck = 1;

I removed some lines just so as not to get too big. But the error appeared when I changed from 0 to 1.

TKS.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


[Port-BR]
Boa noite galera!
Estou usando esse npc. Mas quando eu alterei na parte marcada para limitar o uso por ip. O NPC começou a entregar os itens diversas vezes seguidas.
 

	// Ip check to prevent multi accounts
	// Toggle 
	// [0] = Off
	// [1] = On
	.IPCheck = 0;

	// Ip check to prevent multi accounts
	// Toggle 
	// [0] = Off
	// [1] = On
	.IPCheck = 1;



Retirei algumas linhas só para não ficar muito grande. Mas o erro apareceu quando eu mudei de 0 para 1.

 

//===== EinherjarRO Scripts ================================== 
//= Requested 
//===== By: ================================================== 
//= Stolao
//===== Current Version: =====================================
//= 2.1B
//===== Compatible With: =====================================
//= rAthena SVN
//===== Description: =========================================
//= A reward system for players who play more frequently
//===== Todo =================================================
//= Make Logging out then it continue count

//===== Contact Info: ========================================
//= [Stolao] 
//= Email: [email protected]
//============================================================
prontera,146,172,5	script	Presentes	1743,{
OnPCLoginEvent:
	if(!@logintime)
		@logintime = gettime(DT_YEAR) * 60 * 24 * 365 + gettime(DT_DAYOFYEAR) * 60 * 24 + gettime(DT_HOUR) * 60 + gettime(DT_MINUTE);
OnLoginCmnd:
	.@i = gettime(DT_YEAR) * 12 * 31 + gettime(DT_MONTH) * 31 + gettime(DT_DAYOFMONTH);
	if(.Reset && .@i > #LastDailyReward + 1)
		#DRewardCon = 0;
	if(.Reset && .@i > #LastVIPReward + 1)
		#VIPRewardCon = 0;
	.@VIPSize = getarraysize(.VIPRewards$);
	.@Size = getarraysize(.Rewards$);
	if(#DRewardCon >= .@Size && #VIPRewardCon >= .@VIPSize){
		#LastDailyReward = .@i;
		#LastVIPReward = .@i;
		end;
	}
	sleep2 1000;
	for(.@k = 0; .@k < 2; .@k++){
		if(!.@k){
			if(!vip_status(VIP_STATUS_ACTIVE) && .VIPRewards$[#VIPRewardCon + 1] != ""){
				//message strcharinfo(0),"[Presente do Dia]: Torne-se um VIP para mais recompensas.";
				continue;
			} else if(#VIPRewardCon >= .@VIPSize){
				message strcharinfo(0),"[Presente do Dia]: Sem recompensas VIP restantes este mes.";
				continue;
			} else if(.@i <= #LastVIPReward){
				message strcharinfo(0),"[Presente do Dia]: Recompensas VIP ja coletadas hoje";
				continue;
			}
		} else {
			if(#DRewardCon >= .@Size){
				message strcharinfo(0),"[Presente do Dia]: Sem recompensas restantes este mes.";
				continue;
			} else if(.@i <= #LastDailyReward){
				message strcharinfo(0),"[Presente do Dia]: Recompensas ja coletadas hoje.";
				continue;
			}
		}
		if(!.@k)
			explode(.@XT$,.VIPRewards$[#VIPRewardCon + 1],",");
		else {
			if(.IPCheck){
				query_sql("SELECT account_id FROM `login` WHERE last_ip = '"+getcharip()+"'", .@AccountId);
				.@Size = getarraysize(.@AccountId);
				for(.@i=0; .@i < .@Size; .@i++){
					query_sql("SELECT `value` FROM `acc_reg_num` WHERE `account_id` = '"+.@AccountId[.@i]+"' AND `key` = '#LastDailyReward'",.@LastIp2);
					if(.@i <= .@LastIp2){
						message strcharinfo(0),"[Presente do Dia]: Limite de uma recompensa por dia.";
						continue;
					}
				}
			}
			if(.MacCheck){
				query_sql("SELECT last_unique_id FROM `login` WHERE account_id = "+getcharid(3)+"", .@last_unique_id$);
				query_sql("SELECT account_id FROM `login` WHERE last_unique_id = '"+.@last_unique_id$+"'", .@AccountId2);
				.@Size = getarraysize(.@AccountId2);
				for(.@i=0; .@i < .@Size; .@i++){
					query_sql("SELECT `value` FROM `acc_reg_num` WHERE `account_id` = '"+.@AccountId2[.@i]+"' AND `key` = '#LastDailyReward'",.@MacCheck2);
					if(.@i <= .@MacCheck2){
						message strcharinfo(0),"[Presente do Dia]: Limite de uma recompensa por computador.";
						continue;
					}
				}
			}
			if(.Rest){
				.@time = gettime(DT_YEAR) * 60 * 24 * 365 + gettime(DT_DAYOFYEAR) * 60 * 24 + gettime(DT_HOUR) * 60 + gettime(DT_MINUTE);
				if(.@time < @logintime + .Rest){
					.@delay = @logintime + .Rest - .@time;
					message strcharinfo(0),"[Presente do Dia]: Para coletar recompensas, fique logado por mais "+callfunc("F_InsertPlural",.@delay,"minuto")+".";
					continue;
				}	
			}
			deletearray .@XT$[0],getarraysize(.@XT$);
			.@NextDay = #DRewardCon + 1;
			explode(.@XT$,.Rewards$[.@NextDay],",");
		}
		if(checkvending() & 2 && .Mode & 256){
			message strcharinfo(0),"[Presente do Dia]: Os fornecedores nao podem receber recompensas.";
			end;
		}
		.@Size = getarraysize(.@XT$);
		deletearray .@TT[0],getarraysize(.@TT);
		deletearray .@itms[0],getarraysize(.@itms);
		deletearray .@qnts[0],getarraysize(.@qnts);
		for(.@x = y = 0; .@x < .@Size; .@x++)
			.@TT[.@x] = atoi(.@XT$[.@x]);
		if(.Mode & 1 && (.@TT[4] > 0 || .@vip[4] > 0)){
			.@Size = getarraysize(.@TT);
			for(.@x = 4; .@x <= .@Size - 1 ; .@x += 2){
				.@itms[.@y] = .@TT[.@x];
				.@qnts[.@y] = .@TT[.@x + 1];
				.@y++;
			}
			if(checkweight2(.@itms,.@qnts)){
				for(.@x = 0; .@x < .@y; .@x++){
					if(.Mode & 128)
						getitembound  .@itms[.@x], .@qnts[.@x], .Bound_Mode;
					else	getitem  .@itms[.@x], .@qnts[.@x];
				}
			} else {
				message strcharinfo(0),"[Presente do Dia]: Voce esta muito pesado para receber os premios, use o armazem e relogue.";
				continue;
			}
		}
		if(.Mode & 2 && (.@TT[1])){
			#Loyalty += .@TT[1];
			message strcharinfo(0),"[Presente do Dia]: Recebeu "+ .@TT[1] +" "+.Points$;
		}
		if(.Mode & 4 && (.@TT[0])){
			zeny += .@TT[0];
			message strcharinfo(0),"[Presente do Dia]: Recebeu "+ .@TT[0] +"zenys";
		}
		if(.Mode & 8 && (.@TT[3] || .@TT[4]))
			getexp .@TT[3], .@TT[4];

		if(!.@k){
			if(.Mode & 32)
				cutin .VIPCutins$[#VIPRewardCon],4;
			#VIPRewardCon++;
			#LastVIPReward = .@i;
			sleep2 1000;
			if(.Mode & 64)
				cutin .VIPCutins$[#VIPRewardCon],4;
			message strcharinfo(0),"[Presente do Dia]: Voce coletou sua recompensa VIP, por "+callfunc("F_InsertPlural",#VIPRewardCon,"vez")+" este mes.";
		} else {
			if(.Mode & 16){
				.@Size = getarraysize(.BuffInfo);
				for(.@x = 0; .@x < .@Size; .@x += 4){
					if(.@NextDay == .BuffInfo[.@x + 1])
						sc_start .BuffInfo[.@x], .BuffInfo[.@x + 2] * 15000, .BuffInfo[.@x + 3];
				}
			}
			if(.Mode & 32)
				cutin .Cutins$[#DRewardCon],4;
			#DRewardCon++;
			#LastDailyReward = .@i;
			sleep2 1000;
			if(.Mode & 64)
				cutin .Cutins$[#DRewardCon],4;
			message strcharinfo(0),"[Presente do Dia]: Voce coletou sua recompensa diaria, por "+callfunc("F_InsertPlural",#DRewardCon,"vez")+" este mes.";
		}	
		if(.Mode & 32 || .Mode & 64){
			sleep2 15000;
			cutin "",255;
		}
	}
	end;

OnNextCmnd:
	.@time = gettime(DT_YEAR) * 60 * 24 * 365 + gettime(DT_DAYOFYEAR) * 60 * 24 + gettime(DT_HOUR) * 60 + gettime(DT_MINUTE);
	if(.@time >= @logintime + .Rest){
		message strcharinfo(0),"[Presente do Dia]: Sua proxima recompensa esta disponivel..";
	} else {
		.@i = gettime(DT_YEAR) * 12 * 31 + gettime(DT_MONTH) * 31 + gettime(DT_DAYOFMONTH);
		if(.@i <= #LastDailyReward)
			message strcharinfo(0),"[Presente do Dia]: Sua proxima recompensa estara disponivel amanha..";
		else {
			.@days = (.@time >= @logintime + .Rest) / 60 / 24;
			.@hours = ((.@time >= @logintime + .Rest) / 60) % 24;
			.@mins = (.@time >= @logintime + .Rest) % 60;
			message strcharinfo(0),"[Presente do Dia]: Voce tem "+ ((.@days) ? .@days +" Dias " : "") + ((.@hours) ? .@hours +" Horas " : "") + ((.@mins) ? .@mins +" Minutos " : "") +"ate sua proxima recompensa.";
		}
		if(.Mode & 32 || .Mode & 64){
			if(.@NextDay >= getarraysize(.Rewards$))
				.@g = 0;
			else	.@g = #DRewardCon + 1;
			cutin .Cutins$[.@g],4;
		}
	}
	end;

OnHour00:
	if(gettime(DT_DAYOFMONTH) == 1){
		query_sql("DELETE FROM `acc_reg_num` WHERE `key` = '#DRewardCon' OR `key` = '#VIPRewardCon' OR `key` = '#LastVIPReward' OR `key` = '#LastDailyReward'");
		addrid(0);
		#DRewardCon = #VIPRewardCon = #LastVIPReward = #LastDailyReward = 0;
	}
	end;

OnInit:
	// Basic Settings
	//   1: Item | 2: Points | 4: Zeny | 8: Exp
	//   16: Gain Buffs
	//   32: Show Cutins | 64: Show Next Day Cutin
	//   128: Item Rewards Bound
	//   256: No Rewards for Autotraders 
	//     (a bit value, e.g. 3 = Items & Points from Multi)
	.Mode = 1|2|4|16|32|64|128|256;

	// Item Binding Mode
	//	 Bound_Account : Account Bound item
	//	 Bound_Guild   : Guild Bound item
	//	 Bound_Party   : Party Bound item
	//	 Bound_Char    : Character Bound item
	.Bound_Mode = Bound_Account;

	// To disable the command '@loginreward' comment the next lines
	// * Needs extra commands for typos
	bindatcmd("relog","LOGIN::OnLoginCmnd",0,99);
	bindatcmd("collectreward",strnpcinfo(3)+"::OnLoginCmnd",0,99);
	bindatcmd("dailyreward",strnpcinfo(3)+"::OnLoginCmnd",0,99);
	bindatcmd("collectdaily",strnpcinfo(3)+"::OnLoginCmnd",0,99);
	bindatcmd("nextreward",strnpcinfo(3)+"::OnNextCmnd",0,99);

	// Reset days back to 0 on a skipped day.
	// Toggle 
	// [0] = Off
	// [1] = On
	.Reset = 0;

	// .Rest
	// Delay after login to collect rewards
	// In Minutes
	.Rest = 1;

	// Point Name
	.Points$ = "Pontos de Lealdade";

	// Ip check to prevent multi accounts
	// Toggle 
	// [0] = Off
	// [1] = On
	.IPCheck = 1;

	// Consecutive Days Buff
	// Each buff contains 4 variables
	// <Type>,<Days>,<Duration>,<Rate>, // Buff 1
	// <Type>,<Days>,<Duration>,<Rate>, // Buff 2
	//   ...;
	//
	//  Example: 188,7,45,3
	//    -On the 7th day logged in Player gains +3 Str for 45 mins
	//
	//  Type is 188, which references which SC_ to use, SC_INCSTR in this example
	//     -For a full list of SC_ visit the db/const.txt
	//  Days is days buff is applied, in this example 7, so every 7th day, 14,21,28....
	//  Duration is buff duration is Minuits, in this example 45 mins
	//  Rate is buff val1, in this example player gains 3 Str
	setarray .BuffInfo
				,260,2,120,1	// Life Insurance for 120 on 2nd Day
				,196,30,120,25;	// +25 Flee for 120 Mins on 30th Day

	// Daily Prize items:
	//   "<Zeny>,<Points>,<BaseExp>,<JobExp>,<itemID-1>,<amount-1>,<itemID-2>,<amount-2>...etc", // Day 1
	//   "<Zeny>,<Points>,<BaseExp>,<JobExp>,<itemID-1>,<amount-1>,<itemID-2>,<amount-2>...etc"  // Day 2
	//   ...;
	// Total length of any days string must be 255 or shorter
	setarray .Rewards$[1],
		"10000,0,0,0,501,5,673,1",			// Day 1: 10000 Zeny  + Moeda Cobre Roleta



	// VIP Prize items:
	//   "<Zeny>,<Points>,<BaseExp>,<JobExp>,<itemID-1>,<amount-1>,<itemID-2>,<amount-2>...etc", // Day 1
	//   "<Zeny>,<Points>,<BaseExp>,<JobExp>,<itemID-1>,<amount-1>,<itemID-2>,<amount-2>...etc"  // Day 2
	//   ...;
	// Total length of any days string must be 255 or shorter
	//
	// Note VIPs Collect both VIP and Normal Player rewards
	setarray .VIPRewards$[1],
		"10000,0,0,0,501,5,673,1,7720,1",			// Day 1: 10000 Zeny  + Moeda Cobre Roleta + Gold Coin


	// Cutin Array
	//	Shows a cutin before collecting for each date
	//	Start at 0 if showing next day
	setarray .Cutins$,
			"kafra_01",


	// Cutin Array
	//	Shows a cutin on collecting for each date
	setarray .VIPCutins$,
			"kafra_01",

end;
}

Obrigado.

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...