Jump to content
  • 0

adding a npc to this script


PewN

Question


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

how can i add a npc here that can buy a Vip using an item. then after he buy it the vip system will start!


//===== eAthena Script =======================================
//= VIP Rental System
//===== By: ==================================================
//= Brian
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
//= eAthena SVN (SQL only)
//===== Description: =========================================
//= Makes a player VIP (GM level 1) for a set amount of time.
//===== Additional Comments: =================================
//= 
//============================================================

function	script	F_VIPstart	{
set .@ticks, getarg(0); // getarg(0) = ticks (seconds)
if (.@ticks <= 0) {
	debugmes "F_VIPstart - tried to set a timer in the past";
	end;
}
// set a variable, #VIP_expire, as the Unixtime when this expires
set #VIP_expire, gettimetick(2) + .@ticks;
// add a timer with that tick (in case they stay logged in that long)
if (.@ticks < 2147483) { // prevent overflow error
	addtimer .@ticks *1000, "vip_rental::OnVIPend";
} else {
	addtimer 2147483000, "vip_rental::OnVIPcheck";
}
// change them to GM level 1
atcommand "@adjgmlvl 1 "+strcharinfo(0);
dispbottom "You now have access to VIP commands!";
return;
}

-	script	vip_rental	-1,{
OnPCLoginEvent:
if (#VIP_expire > gettimetick(2)) {
	// timer in future
	dispbottom "VIP Rental : expires in " + callfunc("Time2Str",#VIP_expire);
	atcommand "@adjgmlvl 1 "+strcharinfo(0);
}
OnVIPcheck:
if (#VIP_expire > gettimetick(2)) {
	if ((#VIP_expire - gettimetick(2)) < 2147483) { // prevent overflow error
		addtimer (#VIP_expire - gettimetick(2)) *1000, strnpcinfo(3)+"::OnVIPend";
	} else {
		addtimer 2147483000, strnpcinfo(3)+"::OnVIPcheck";
	}
} else if (#VIP_expire) {
	// timer already expired
	doevent strnpcinfo(3)+"::OnVIPend";
}
end;

OnVIPend:
// change them to GM level 0
atcommand "@adjgmlvl 0 "+strcharinfo(0);
set #VIP_expire, 0; // clear timer
dispbottom "Your VIP Rental has expired.";
end;
}

Link to comment
Share on other sites

1 answer to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  782
  • Reputation:   82
  • Joined:  01/01/12
  • Last Seen:  

Just put this script for your item script?

callfunc "F_VIPstart";

Edit: Misunderstood some part, hehs.

Just write your script like this to toggle your function script?

map,x,y,f     script     VIP     50,{
function F_VIPstart;
end;
}

Edited by darristan
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...