Jump to content
  • 0

Help with this npc script


Lord Ganja

Question


  • Group:  Members
  • Topic Count:  141
  • Topics Per Day:  0.03
  • Content Count:  444
  • Reputation:   22
  • Joined:  06/18/12
  • Last Seen:  

I'm currently creating a script that will be triggered by OnPCLoadMapEvent.
My problem here is, it has lot's of errors like buildin_rid2name: invalid RID, buildin_checkvending: Player (null) is not online!
I modified and applied  THIS ONE(this script actually extract account id's but i've modified it) in my server to extract character id's in a specific area. 
 
What I wanted to happen here is, after the event started. It will kick the vending players inside the event_wroom map.
but the thing is, it can't kick the vendors because the character id's are somehow messy. BUT when I use this script below, it returns the char id's of the players in the area.
prontera,148,177,5	script	getareausers	100,{
	.@len = getareausers("event_wroom",1,1,500,500);
	for( .@a = 0; .@a < .@len; .@a++ )
		npctalk ""+.@char_ids[.@a];
	end;
}

This is the messy script that I use:

OnPCLoadMapEvent:
	if( getmapusers("event_wroom") >= 10 ) {
		if( .@running )end; // To avoid double trigger
		if( !.@running ).@running = 1;
		.@len = getareausersid("event_wroom",1,1,500,500);
		for( .@i = 0; .@i < .@len; .@i++ ) {
		if( checkvending(rid2name(.@char_ids[.@i])) )
				.@vending += 1;
		}
		if ( .@vending >= 1 ) {
			mapannounce "event_wroom", "Event is about to start in 3 seconds.",0;
			sleep 1000;
			mapannounce "event_wroom", "3",0;
			sleep 1000;
			mapannounce "event_wroom", "2",0;
			sleep 1000;
			mapannounce "event_wroom", "1",0;
			sleep 1000;
			mapannounce "event_wroom", "Let's get it on!",0;
			sleep 1000;
			donpcevent "event_quest::OnStart"; // This will warp players on the main event map
			//This part will kick the vendors
			for( .@i = 0; .@i < getareausersid("event_wroom",1,1,500,500); .@i++ ) {
			if(checkvending(rid2name(.@char_ids[.@i])))
				atcommand "@kick "+rid2name(.@char_ids[.@i]);
			}
		}
	}
	end;

Thanks in advance!

Link to comment
Share on other sites

1 answer to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  141
  • Topics Per Day:  0.03
  • Content Count:  444
  • Reputation:   22
  • Joined:  06/18/12
  • Last Seen:  

bump*

Link to comment
Share on other sites

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.

×
×
  • Create New...