Jump to content
  • 0

Need help with script (if and else)


Question

Posted

Script only reads the if and not the else part. Which part is written badly?

OnPCDieEvent:
	getmapxy .@map$,.@x,.@y,0;
		if ( getgroupid() > 3 || killedrid == getcharid(3)) end;
		else (.@map$ == "arena") {
		announce rid2name(killerrid)+" wins against "+strcharinfo(0)+" at pvp!",bc_all;
		warp "prontera",155,180; end;

		}	
	end;
}

9 answers to this question

Recommended Posts

Posted

 

Script only reads the if and not the else part. Which part is written badly?

OnPCDieEvent:
	getmapxy .@map$,.@x,.@y,0;
		if ( getgroupid() > 3 || killedrid == getcharid(3)) end;
		else (.@map$ == "arena") {
		announce rid2name(killerrid)+" wins against "+strcharinfo(0)+" at pvp!",bc_all;
		warp "prontera",155,180; end;

		}	
	end;
}

 

shouldn't be like?

OnPCDieEvent:
getmapxy .@map$,.@x,.@y,0;
if ( getgroupid() > 3 || killedrid == getcharid(3)){
end;
}	
else (.@map$ == "arena") {
announce rid2name(killerrid)+" wins against "+strcharinfo(0)+" at pvp!",bc_all;
warp "prontera",155,180;
end;
}

what is supposed to be after this?

getmapxy .@map$,.@x,.@y,0;

if ( getgroupid() > 3 || killedrid == getcharid(3))

 

and then after this?

(.@map$ == "arena") {

announce rid2name(killerrid)+" wins against "+strcharinfo(0)+" at pvp!",bc_all;

warp "prontera",155,180;

Posted

lol you both ...

 

-	script	kjdfkjsdf	-1,{
OnPCDieEvent:
	if ( strcharinfo(3) != "arena" || getgroupid() > 3 ) end;
	if ( killerrid )
		announce rid2name( killerrid )+" wins against "+ strcharinfo(0), bc_all;
	// sure .. you need to warp player out even if he suicide
	warp "prontera",155,180;
	end;
}
  • Upvote 1
Posted

oh lol sorry 

 

still trying to figure out how some scripts work (the order) 

 

i was confused of what he wanted @_@ sorry again lol

Posted (edited)

Mind explaining the output that you want?

 

Basically the broadcast should happen only in the specific map when one player is killed and shouldn't broadcast when using @die.

Edited by Isaiah
Posted (edited)

Try this?

OnPCDieEvent:
if(strcharinfo(3) == "arena" && getgroupid() < 3 && killerrid != getcharid(0)) {
       announce rid2name(killerrid)+" wins against "+strcharinfo(0),bc_all;
}
end;
Edited by sandbox
Posted

Might wanna test AnnieRuru approach? 

 

 

 

Try this?

OnPCDieEvent:
if(strcharinfo(3) == "arena" && getgroupid() < 3 && killerrid != getcharid(0)) {
       announce rid2name(killerrid)+" wins against "+strcharinfo(0),bc_all;
}
end;

killerrid is set as account id not character id  ( getcharid(3) not getcharid(0) ) 

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