Jump to content
  • 0

OnPCKillEvent/OnPCDieEvent


Question

5 answers to this question

Recommended Posts

  • 1
Posted (edited)
-	script	DieDieDie	-1,{
OnPCDieEvent:
	.@party_id = getcharid(1);
	if (getcharid(0) != getpartyleader(.@party_id,2)) {
		end;
		}
  	mapannounce strnpcinfo(4),"The party leader of "+getpartyname(.@party_id)+" has died in battle. ",0,"0x00ff99";
	end;
	}

 

Edited by crazyarashi
  • Upvote 1
  • 0
Posted
5 hours ago, pajodex said:

I'm getting this error in console every time I use command @die with the leader in the party


[Error]: buildin_rid2name: invalid RID

 

Hey,

Have you tried to add in some checks like, if some member is offline? I think when getting RID when some one is offline will fail. Not 100% sure about this! xD


Like this:

// (Optional) Check who is the killer
if (killedrid == killerrid) {
	// You have been killed by your own hand
	end;
}

// Check player is in a party
if (getcharid(1)) {
	getpartymember(getcharid(1), 2);
	set .@partymembercount, $@partymembercount;
	copyarray .@partymemberaid[0], $@partymemberaid[0], .@partymembercount;
	for (set .@i, 0; .@i < .@partymembercount; set .@i, .@i + 1) {
		// Try to attach each party member to this script
		if (attachrid(.@partymemberaid[.@i])) {
			// Now we can check player status like AFK
			if (checkvending() && checkchatting()) {
				// This member is AFK
				end;
			}
		}
	}
}

 

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