Jump to content
  • 0
MikZ

ZENY * #Kill

Question

Good day!

I wanted to ask help.

I added column in my char Sql.

ALTER TABLE `char` ADD COLUMN `kill` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `name`;

what I wanted is that if player killed below level 50 players they will be jailed and if they want to go out they need to bail. bout zeny price depends on the number on player they kill.

please help me how to make this work, to query char sql deaths

to make

zeny , zeny (amount * .killc);

 

			
	mes "Are you sure you want to bail - "+.@char_name$[.@i];
				next;
				if ( select( "Confirm","Cancel" ) == 1 ) {
				query_sql( "SELECT `char_id`, `account_id`, `name`, `kill` FROM `char` WHERE `name` LIKE '%"+escape_sql( .@name$ )+"%' LIMIT 50", .@char_aid, .@account_aid, .@char_name$, .@killc );
.@killc = .killc;
					if( Zeny <  (.Rates * .killc) ){
						mes "You didnt have enough Zeny.";
						close;
						}else{
						set Zeny, Zeny - ( .Rates * .killc );
						mes "Kabooom!";
                        close;
                }

thanks!

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0
	// this assumes the target player is online and those variables are filled:
	// .@char_name$
	// .@account_id
	// .Rates

	.@kill_counter = getvariableofpc(KILL_COUNTER, .@account_id);
	.@cost = .Rates * .@kill_counter;

	mesf("Are you sure you want to bail %s out of jail for %d zeny?", .@char_name$, .@cost);
	next();

	if (select("Confirm", "Cancel") == 1) {
		if (Zeny < .@cost) {
			mes("You didn't have enough Zeny.");
		} else {
			Zeny -= .@cost; // remove zeny
			set(getvariableofpc(KILL_COUNTER, .@account_id), 0); // reset counter to zero

			// {{ ADD YOUR UNJAILING LOGIC HERE }}

			mes("Kabooom!");
		}
	}
	close;



OnPCKillEvent:
	if (readparam(BaseLevel, killedrid) < 50) {
		++KILL_COUNTER; // increase the kill counter

		// {{ ADD YOUR JAILING LOGIC HERE }}
	}
	end;

 

Share this post


Link to post
Share on other sites
  • 0

You don't need to use SQL at all for this; it can all be done in the script engine:

	// this assumes the target player is online and those variables are filled:
	// .@char_name$
	// .@account_id
	// .Rates

	mesf("Are you sure you want to bail %s out of jail?", .@char_name$);
	next();

	if (select("Confirm", "Cancel") == 1) {
		.@kill_counter = getvariableofpc(KILL_COUNTER, .@account_id);
		.@cost = .Rates * .@kill_counter;

		if (Zeny < .@cost) {
			mes("You didn't have enough Zeny.");
		} else {
			Zeny -= .@cost;
			mes("Kabooom!");
		}
	}
	close;



OnPCKillEvent:
	if (readparam(BaseLevel, killedrid) < 50) {
		++KILL_COUNTER;
	}
	end;

 

Share this post


Link to post
Share on other sites
  • 0
1 minute ago, meko said:

You don't need to use SQL at all for this; it can all be done in the script engine:


	// this assumes the target player is online and those variables are filled:
	// .@char_name$
	// .@account_id
	// .Rates

	mesf("Are you sure you want to bail %s out of jail?", .@char_name$);
	next();

	if (select("Confirm", "Cancel") == 1) {
		.@kill_counter = getvariableofpc(KILL_COUNTER, .@account_id);
		.@cost = .Rates * .@kill_counter;

		if (Zeny < .@cost) {
			mes("You didn't have enough Zeny.");
		} else {
			Zeny -= .@cost;
			mes("Kabooom!");
		}
	}
	close;



OnPCKillEvent:
	if (readparam(BaseLevel, killedrid) < 50) {
		++KILL_COUNTER;
	}
	end;

 

I also want someone to bail him out , in the event that player is out of zeny.

Share this post


Link to post
Share on other sites
  • 0
4 minutes ago, MikZ said:

I also want someone to bail him out , in the event that player is out of zeny.

That's exactly what my script does, it assumes .@char_name$ and .@account_id are of the player in jail, not the player paying the bail. It checks the kill counter of the other player by using getvariableofpc(). You just need to add your release logic where it says Kaboom, and to add your dialog before the "Are you sure ..."

Share this post


Link to post
Share on other sites
  • 0
6 minutes ago, meko said:

That's exactly what my script does, it assumes .@char_name$ and .@account_id are of the player in jail, not the player paying the bail. It checks the kill counter of the other player by using getvariableofpc(). You just need to add your release logic where it says Kaboom, and to add your dialog before the "Are you sure ..."

ooh, apologies didn't notice that part.
 One last thing how to make the total bail amount in script.
like:


mes	" Total amount to bail "+.@amount+"";
mesf("Are you sure you want to bail %s out of jail?", .@char_name$);
	next();

thanks!

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.