Jump to content

Recommended Posts

Posted (edited)

Someone recently requested this from me so I figure I'd share it with the community.

Be very careful about randomly throwing this on your own real server please, and warn your players about it.

-	script	PERMANENTDEATH	-1,{
end;

OnPCDieEvent:
	set .@deadplayer,getcharid(0);
	message strcharinfo(0),"Game Over";
	atcommand "@kick "+strcharinfo(0);
	set .@j, getarraysize( .char_delete$ );
	for (.@i = 0; .@i < .@j; .@i++) {
    query_sql("DELETE FROM `"+ .char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'");
	}
	query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'";
	end;
	
OnInit:
setarray .char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown";
end;
	
}

I was thinking about adding an NPC that would set a character variable to select if they wanted to opt-in to "Hardcore" mode, and give them benefits for doing so, and having people without the character variable not be affected by it, but that should be easy to add.

 

The only detail is I get a "[Error]: chrif_ack_login_req failed - player not online." but I believe it might be because I have other OnPCDieEvent labels that are attempting to run, didn't have time to confirm if this was the problem or not. But the deletion goes through just fine and the server doesn't seem to be affected by it at all.

 

Enjoy! (Yay my first public release)

 

X0v7aZN.png

 

Edit: Thanks to my friend Tokei for making me use better loops.

 

Here's the version for the upgraded script engine:

-	script	PERMANENTDEATH	-1,{
end;

OnPCDieEvent:
	set .@deadplayer,getcharid(0);
	message strcharinfo(0),"Game Over";
	atcommand "@kick "+strcharinfo(0);
	set .@j, getarraysize( .char_delete$ );
	for (.@i = 0; .@i < .@j; .@i++) {
    query_sql("DELETE FROM `"+ .char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'");
	}
	query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'";
	end;
	
OnInit:
setarray .char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","char_reg_str","char_reg_num","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown";
end;
	
}

Have not tested this one, but it should work fine :]

Edited by Nova
  • Upvote 2
  • 3 weeks later...
  • 7 months later...
  • 3 months later...
  • 1 month later...
  • 1 month later...
  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

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