Jump to content
  • 0

loadevent problems


Question

Posted

Hi, can anyone help me with my script problem. The thing is i have this script for battleground that blocks the player if he/she have more than 2 character in bat_room map and timetick checker for my dra_lake map. Both script use loadevent mapflag. I find it confusing when the player load on the map either bat_room or dra_lake the server uses the script restriction on both map. 

 

6 answers to this question

Recommended Posts

Posted (edited)

- script Maroll Script -1,{
OnPCLoadMapEvent:
getmapxy .Maroll$,@x,@y,0;
if (query_sql("SELECT login.account_id FROM login LEFT JOIN `char` ON login.account_id=`char`.account_id WHERE login.last_ip=(SELECT last_ip FROM login WHERE account_id="+getcharid(3)+") AND `char`.online=1", .@account_id) > 5) {
warp "new_pront",156,177;
dispbottom "You exceeded the maximum accounts allowed in this area.";
end;
}
OnInit:
setarray .Maroll$,"bat_room";
setmapflag .Maroll$, mf_loadevent;
end;
}

-	script	Dungeon Script	-1,{

OnPCLoadMapEvent:
	getmapxy .Dungeons$,@x,@y,0;
	setarray .Dungeons$,"inzektor","necro","infernity","naturia","mermail","noble","dra_lake","dra_dun","dra_dun01","dra_dun02","dra_dun03";
	if(gettimetick(2) - #Dungeon < (60 * 60 * 1)) {
	warp "new_pront",156,177;
	dispbottom "You need to wait atleast 1 hour before your next run.";
	end;
	}
}

inzektor	mapflag	loadevent
necro	mapflag	loadevent
infernity	mapflag	loadevent
naturia	mapflag	loadevent
mermail	mapflag	loadevent
noble	mapflag	loadevent
dra_lake	mapflag	loadevent
dra_dun	mapflag	loadevent
dra_dun01	mapflag	loadevent
dra_dun02	mapflag	loadevent
dra_dun03	mapflag	loadevent
Edited by muzika
Posted
Try something like:

 



OnPCLoadMapEvent:
getmapxy .Maroll$,@x,@y,0;
if ( .@mapname$ == "bat_room" ) {
if (query_sql("SELECT login.account_id FROM login LEFT JOIN `char` ON login.account_id=`char`.account_id WHERE login.last_ip=(SELECT last_ip FROM login WHERE account_id="+getcharid(3)+") AND `char`.online=1", .@account_id) > 5) {
warp "new_pront",156,177;
dispbottom "You exceeded the maximum accounts allowed in this area.";
end;
}
}

Posted
Try something like:
 
OnPCLoadMapEvent:
getmapxy .Maroll$,@x,@y,0;
if ( .@mapname$ == "bat_room" ) {
if (query_sql("SELECT login.account_id FROM login LEFT JOIN `char` ON login.account_id=`char`.account_id WHERE login.last_ip=(SELECT last_ip FROM login WHERE account_id="+getcharid(3)+") AND `char`.online=1", .@account_id) > 5) {
warp "new_pront",156,177;
dispbottom "You exceeded the maximum accounts allowed in this area.";
end;
	}
}

Aaaah, so his question was: "How do I check which map was entered?". I see...

rqueen, your script wont work, because .@mapname$ doesn't have a value.

Try this:

OnPCLoadMapEvent:
  if (strcharinfo(3) == "bat_room" && query_sql("SELECT login.account_id FROM login LEFT JOIN `char` ON login.account_id=`char`.account_id WHERE login.last_ip=(SELECT last_ip FROM login WHERE account_id="+getcharid(3)+") AND `char`.online=1", .@account_id) > 5)
  {
    dispbottom "You exceeded the maximum accounts allowed in this area.";
    warp "new_pront",156,177;
  }
  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...