Jump to content
  • 0

Cash Giver (IP Based)


Question

Posted

Requesting a script that will give automatically cash points to player after logging in. X Cash Points where x is any amount..

 

Also, the script will only run for the 1st 100 IP.

 

Example..

player A log-in to the game for the first time (IP) the system will give him/her cash points with dialogues and then the IP can't receive any freebies anymore as well as his account.

 

Thanks!

9 answers to this question

Recommended Posts

Posted
-	script	swdghfgj	-1,{
OnPCLoginEvent:
	// Check if already log in
	// -----------------------
	query_sql "SELECT `logincount` FROM `login` WHERE `account_id` = '"+ getcharid(3) +"'", .@logincount;
	if( .@logincount > 1 ) end;

	// Count account with the same ip xx.xx.xx.*
	// -----------------------------------------
	sscanf( getcharip(), "%d.%d.%d.%d", .@a, .@b, .@c, .@d );
	query_logsql "SELECT COUNT(`ip`) FROM `loginlog` WHERE `ip` LIKE '%"+ .@a +"."+ .@b +"."+ .@c +".%'", .@count;

	if( .@count == 1 ) {
		dispbottom "Here a reward for newbie.";
		// getitem 501, 1;
		#CASHPOINTS = #CASHPOINTS +100;
	}
	query_sql "UPDATE `login` SET `logincount` = '2' WHERE `account_id` = '"+ getcharid(3) +"'";

	end;

}

 

Check the log count and if an other account have the same ip. Only works with new account/IP.

Posted
-	script	swdghfgj	-1,{
OnPCLoginEvent:
	// Check if already log in
	// -----------------------
	query_sql "SELECT `logincount` FROM `login` WHERE `account_id` = '"+ getcharid(3) +"'", .@logincount;
	if( .@logincount > 1 ) end;

	// Count account with the same ip xx.xx.xx.*
	// -----------------------------------------
	sscanf( getcharip(), "%d.%d.%d.%d", .@a, .@b, .@c, .@d );
	query_sql "SELECT COUNT(`account_id`) FROM `login` WHERE `last_ip` LIKE '%"+ .@a +"."+ .@b +"."+ .@c +".%'", .@count;

	if( .@count == 1 ) {
		dispbottom "Here a reward for newbie.";
		// getitem 501, 1;
		#CASHPOINTS = #CASHPOINTS +100;
	}
	query_sql "UPDATE `login` SET `logincount` = '2' WHERE `account_id` = '"+ getcharid(3) +"'";

	end;

}

Check the log count and if an other account have the same ip. Only works with new account/IP.

 

How to add the 1st 100 IP will only be the one to receive this reward?

Posted
-	script	swdghfgj	-1,{
OnPCLoginEvent:
	// Check if already log in
	// -----------------------
	query_sql "SELECT `logincount` FROM `login` WHERE `account_id` = '"+ getcharid(3) +"'", .@logincount;
	if( .@logincount > 1 ) end;

	// Count account with the same ip xx.xx.xx.*
	// -----------------------------------------
	sscanf( getcharip(), "%d.%d.%d.%d", .@a, .@b, .@c, .@d );
	query_logsql "SELECT COUNT(`ip`) FROM `loginlog` WHERE `ip` LIKE '%"+ .@a +"."+ .@b +"."+ .@c +".%'", .@count;

	if( .@count == 1 ) {
		#CASHPOINTS = #CASHPOINTS +100;		// gain for newbie
		dispbottom "Here a reward for newbie.";
		dispbottom "Gained : 100 Cashpoints. Total: "+ #CASHPOINTS +" Cashpoints";
		
		query_logsql "SELECT COUNT(DISTINCT `ip`) FROM `loginlog`", .@count_ip;
		if( .@count_ip / 100 != $count_distinct ) {
			$count_distinct = .@count_ip / 100 ;
			dispbottom "Here a reward for being the "+ $count_distinct +"00th players !";
			#CASHPOINTS = #CASHPOINTS +100;		// gain each 100 distinct ip
			dispbottom "Gained : 100 Cashpoints. Total: "+ #CASHPOINTS +" Cashpoints";
		}
	}
	query_sql "UPDATE `login` SET `logincount` = '2' WHERE `account_id` = '"+ getcharid(3) +"'";

	end;
}

 

 

@Capuche

You can use a bug exploit in the previous script. I edited it.

(I made a challenge vs myself xP)

Posted
-	script	swdghfgj	-1,{
OnPCLoginEvent:
	// Check if already log in
	// -----------------------
	query_sql "SELECT `logincount` FROM `login` WHERE `account_id` = '"+ getcharid(3) +"'", .@logincount;
	if( .@logincount > 1 ) end;

	// Count account with the same ip xx.xx.xx.*
	// -----------------------------------------
	sscanf( getcharip(), "%d.%d.%d.%d", .@a, .@b, .@c, .@d );
	query_logsql "SELECT COUNT(`ip`) FROM `loginlog` WHERE `ip` LIKE '%"+ .@a +"."+ .@b +"."+ .@c +".%'", .@count;

	if( .@count == 1 ) {
		#CASHPOINTS = #CASHPOINTS +100;		// gain for newbie
		dispbottom "Here a reward for newbie.";
		dispbottom "Gained : 100 Cashpoints. Total: "+ #CASHPOINTS +" Cashpoints";
		
		query_logsql "SELECT COUNT(DISTINCT `ip`) FROM `loginlog`", .@count_ip;
		if( .@count_ip / 100 != $count_distinct ) {
			$count_distinct = .@count_ip / 100 ;
			dispbottom "Here a reward for being the "+ $count_distinct +"00th players !";
			#CASHPOINTS = #CASHPOINTS +100;		// gain each 100 distinct ip
			dispbottom "Gained : 100 Cashpoints. Total: "+ #CASHPOINTS +" Cashpoints";
		}
	}
	query_sql "UPDATE `login` SET `logincount` = '2' WHERE `account_id` = '"+ getcharid(3) +"'";

	end;
}

 

 

@Capuche

You can use a bug exploit in the previous script. I edited it.

(I made a challenge vs myself xP)

 

How does this literally works? I'm trying to understand it hehehe. Can you give me some guide?

Posted

- check the logincount in login table (how much the account connect in game)

- if the logincount is more than 1, the script end otherwise..

- get the player IP

- count this IP in the loginlog table. If the IP count is more than 1, the script end otherwise..

- give a reward

- count the distinct IP in loginlog table. If there is a multiple of 100 distinct IP => reward

- update the logincount in login table to 2

Posted

- check the logincount in login table (how much the account connect in game)

- if the logincount is more than 1, the script end otherwise..

- get the player IP

- count this IP in the loginlog table. If the IP count is more than 1, the script end otherwise..

- give a reward

- count the distinct IP in loginlog table. If there is a multiple of 100 distinct IP => reward

- update the logincount in login table to 2

And if it reaches 100 distinct IP, will it automatically end?

Posted

It will give a reward to the 100th IP, 200th, 300th...

 

Sorry for the very late reply..

 

How to stop it at 100th IP only the 1st distinct 100 IP will be given the cash points?

Posted

Ha then replace

		if( .@count_ip / 100 != $count_distinct ) {
			$count_distinct = .@count_ip / 100 ;

by

		if( .@count_ip / 100 != $count_distinct && $count_distinct != 999999999 ) {
			$count_distinct = 999999999 ;

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...