Jump to content
  • 0

Cash Giver (IP Based)


Meister

Question


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

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!

Link to comment
Share on other sites

9 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

- 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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

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?

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

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 ;
Link to comment
Share on other sites

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