ZENY * #Kill

MikZ

New member
Messages
461
Points
0
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!

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

Code:
	// 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;
 
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.

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

 
Last edited by a moderator:
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!

 
Code:
	// 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;
 
Back
Top