thaihoa91
27-08-09, 07:21 PM
Include("\\script\\global\\serverlib.lua");
-> server mình ko có file serverlid.lua ( server mèo 3.0 ) vậy sài dc Script này hok vậy thai hòa
Ko có Serverlib.lua thì ko dc đâu ! Serverlib.lua nà :
INIT_TASK_NEWTASK = 1
INIT_TASK_BOSS = 1
INIT_TASK_GOLDENBOSS = 1
INIT_EVENT_EXP = 1
INIT_EVENT_GIFT = 1
INIT_EVENT_FESTIVAL = 1
Task_String={"kinh nghiem","danh vong","pk","tich luy Tong Kim"}
----------------------------------------------------------------------------------------Common Function-----------------------------------------------------------------------------------------------------------
function AddNPCEx(nId,nLevel, nMap,nX,nY,nOffsetX,nOffsetY,nScript,nCurCamp)
if (nOffsetX==nil) then nOffsetX = 0 end
if (nOffsetY==nil) then nOffsetY = 0 end
mapindex = SubWorldID2Idx(nMap)
npcid = nId
npclvl = nLevel
posx = floor((nX+nOffsetX/10)*8*32)
posy = floor((nY+nOffsetY/10)*16*32)
nNpcId = AddNpc(npcid,npclvl,mapindex,posx,posy,1, "Da tau", 1);
if(nScript~=nil) then
SetNpcScript(nNpcId, nScript);
end
if(nCurCamp~=nil) then
SetNpcCurCamp(nNpcId, nCurCamp);
end
return
end;
function GenNPCEx(nLevel, nMap, nX, nY, Width,Height, NpcNum, NpcFrom, NpcTo,nDeathScript,nCurCamp)
worldindex = SubWorldID2Idx(nMap)
posx = nX*8*32
posy = nY*16*32
if (Width <= 0 or Height <=0 or NpcNum <=0 or NpcFrom <=0 or NpcTo <=0) then
return
end;
if (x == nil) then
return
end;
PerWidth = Width/sqrt(NpcNum);
PerHeight = Height / sqrt(NpcNum);
for i = 1, NpcNum do
Npctemp = random(NpcFrom, NpcTo);
NpcIndex = AddNpc(Npctemp, nLevel, worldindex, (x - Width/2) + mod(i, sqrt(NpcNum)) * PerWidth, (y - Height/2) + i/sqrt(NpcNum) * PerHeight);
if(nDeathScript~=nil) then
SetNpcScript(NpcIndex, nDeathScript);
end
if(nCurCamp~=nil) then
SetNpcCurCamp(NpcIndex, nCurCamp);
end
end;
end;
function MoveNPC(nMap,nX,nY,nOffsetX,nOffsetY,nPrice,nFight State,nTermini)
if (nOffsetX==nil) then nOffsetX=0 end
if (nOffsetY==nil) then nOffsetY=0 end
posx = floor((nX+nOffsetX/10)*8)
posy = floor((nY+nOffsetY/10)*16)
if (GetCash() >= nPrice) then
Pay(nPrice)
NewWorld(nMap, posx, posy);
SetFightState(nFightState);
AddRepute(1)
if(nTermini~=nil) then
AddTermini(nTermini);
end
else
Say("Quy Khach khong co du "..nPrice.." luong", 0)
end
end;
---------------------------------------------------------------------------------------Menpai and Skill-----------------------------------------------------------------------------------------------------------
function AddSkill(sId,sLevel,sReqLevel,sMsgEnable,sMessage, sMsgType)
if(sReqLevel~=nil) then
if (GetLevel() >= sReqLevel) then
AddMagic(sId, sLevel);
if(sMsgEnable==1) then
MsgEx(sMessage,sMsgType)
end
else
MsgEx("Ban phai dat cap "..sReqLevel.." moi co the hoc duoc ki nang nay",sMsgType)
end
end
return
end;
function SetMenpai(sId,sReqLevel,sGo,sRank,sMessage)
menpai={{"Phai Thieu Lam",1,1,"yellow"},{"Thien Vuong Bang",1,3,"Green"},{"Duong Mon",2,3,"Green"},{"Ngu Doc Giao",2,2,"pink"},{"Phai Nga My",3,1,"yellow"},{"Thuy Yen Mon",3,3,"Green"},{"Cai Bang",4,1,"Yellow"},{"Thien Nhan Giao",4,2,"pink"},{"Phai Vo Dang",5,1,"Yellow"},{"Phai Con Lon",5,3,"Green"}}
player_Faction = GetFaction()
player_Series = GetSeries()+1
mSeries = {{"Kim","metal",1,2},{"Moc","wood",3,4},{"Thuy","water",5,6},{"Hoa","fire",7,8},{"Tho","earth",9,10}}
if(sReqLevel~=nil) then
if (GetLevel() >= sReqLevel) then
if (player_Faction ~= "") then
if (player_Faction == menpai[sId][1]) then
MsgEx("Ban da la de tu cua <color="..menpai[sId][4]..">"..menpai[sId][1].."<color>.\nHay ra suc dong gop cho mon phai!",1)
else
MsgEx("Ban da la de tu cua <color=red>"..player_Faction.."<color>.\nBan ban khong the gia nhap mon phai khac!",1)
end;
else
if (sGo ==1) then
if (player_Series == menpai[sId][2]) then
SetFaction(menpai[sId][1])
SetCamp(menpai[sId][3])
SetCurCamp(menpai[sId][3])
SetRank(sRank)
MsgEx("Chuc mung ban da gia nhap <color="..menpai[sId][4]..">"..menpai[sId][1].."<color>.\nTu nay ban co the vi <color="..menpai[sId][4]..">"..menpai[sId][1].."<color> hanh hiep!\n"..sMessage,1)
else
MsgEx("The chat cua ban thuoc he <color="..mSeries[player_Series][2]..">"..mSeries[player_Series][1].."<color>.\nBan khong thich hop gia nhap <color="..menpai[sId][4]..">"..menpai[sId][1].."<color>.\nHay gia nhap <color="..menpai[mSeries[player_Series][3]][4]..">"..menpai[mSeries[player_Series][3]][1].."<color> hoac <color="..menpai[mSeries[player_Series][4]][4]..">"..menpai[mSeries[player_Series][4]][1].."<color>.",1)
end
end
end
else
MsgEx("Ban phai dat cap "..sReqLevel.." moi co the gia nhap <color="..menpai[sId][4]..">"..menpai[sId][1].."<color>.",1)
end
end
return
end;
function AddMenpaiSkills()
menpai={{"Phai Thieu Lam","sl"},{"Thien Vuong Bang","tw"},{"Duong Mon","tm"},{"Ngu Doc Giao","wu"},{"Phai Nga My","em"},{"Thuy Yen Mon","cy"},{"Cai Bang","gb"},{"Thien Nhan Giao","tr"},{"Phai Vo Dang","wd"},{"Phai Con Lon","kl"}}
player_Faction = GetFaction()
level_list={1,10,20,30,40,50,60,90}
local skillMap ={
tt={
{210,1,3}
},
sl={
{14,1,1},
{10,1,1},
{8,1,10},
{4,1,10},
{6,1,10},
{15,1,20},
{16,1,30},
{20,1,40},
{271,1,50},
{11,1,50},
{19,1,50},
{273,1,60},
{21,1,60},
{318,1,90},
{319,1,90},
{321,1,90},
},
tw={
{34,1,1},
{30,1,1},
{29,1,1},
{26,1,10},
{23,1,10},
{24,1,10},
{33,1,20},
{37,1,30},
{35,1,30},
{31,1,30},
{40,1,40},
{42,1,50},
{36,1,60},
{32,1,60},
{41,1,60},
{324,1,60},
{322,1,90},
{323,1,90},
{325,1,90},
},
em={
{85,1,1},
{80,1,1},
{77,1,10},
{79,1,10},
{93,1,20},
{385,1,30},
{82,1,30},
{89,1,30},
{86,1,40},
{92,1,50},
{252,1,60},
{88,1,60},
{91,1,60},
{282,1,60},
{328,1,90},
{380,1,90},
{332,1,90},
},
cy={
{99,1,1},
{102,1,1},
{95,1,10},
{97,1,10},
{269,1,20},
{105,1,30},
{113,1,30},
{100,1,40},
{109,1,50},
{114,1,60},
{108,1,60},
{111,1,60},
{336,1,90},
{337,1,90},
},
tm={
{45,1,1},
{43,1,10},
{347,1,10},
{303,1,20},
{50,1,30},
{54,1,30},
{47,1,30},
{343,1,30},
{345,1,40},
{349,1,50},
{48,1,60},
{249,1,60},
{58,1,60},
{341,1,60},
{339,1,90},
{302,1,90},
{342,1,90},
{351,1,90},
},
wu={
{63,1,1},
{65,1,1},
{62,1,10},
{60,1,10},
{67,1,10},
{70,1,20},
{66,1,20},
{68,1,30},
{384,1,30},
{64,1,30},
{69,1,30},
{356,1,40},
{73,1,40},
{72,1,50},
{75,1,60},
{71,1,60},
{74,1,60},
{353,1,90},
{355,1,90},
{390,1,90},
},
gb={
{122,1,1},
{119,1,1},
{116,1,10},
{115,1,10},
{129,1,20},
{274,1,30},
{124,1,30},
{277,1,40},
{128,1,50},
{125,1,50},
{130,1,60},
{360,1,60},
{357,1,90},
{359,1,90},
},
tr={
{135,1,1},
{145,1,1},
{132,1,10},
{131,1,10},
{136,1,10},
{137,1,20},
{141,1,30},
{138,1,30},
{140,1,30},
{364,1,40},
{143,1,50},
{150,1,60},
{142,1,60},
{148,1,60},
{361,1,90},
{362,1,90},
{391,1,90},
},
wd={
{153,1,1},
{155,1,1},
{152,1,10},
{151,1,10},
{159,1,20},
{164,1,30},
{158,1,30},
{160,1,40},
{157,1,50},
{166,1,60},
{165,1,60},
{267,1,60},
{365,1,90},
{368,1,90},
},
kl={
{169,1,1},
{179,1,1},
{167,1,10},
{168,1,10},
{392,1,10},
{171,1,10},
{174,1,20},
{178,1,30},
{172,1,30},
{393,1,30},
{173,1,30},
{175,1,40},
{181,1,40},
{176,1,50},
{90,1,50},
{275,1,60},
{182,1,60},
{372,1,90},
{375,1,90},
{394,1,90},
}
}
if (player_Faction ~= "") then
for i=1,getn(menpai) do
if (player_Faction == menpai[i][1]) then
for k=1,getn(level_list) do
if (GetLevel()>=level_list[k]) then
for j=1,getn(skillMap[menpai[i][2]]) do
if (skillMap[menpai[i][2]][j][3] ==level_list[k]) then
AddMagic(skillMap[menpai[i][2]][j][1],skillMap[menpai[i][2]][j][2])
end
end
end
end
end
end
end
return
end
----------------------------------------------------------------------------------------NewTask-Da tau-----------------------------------------------------------------------------------------------------------
function DTTask(Type,Act)
local Task_Type=0
local Task_Target=0
local LevelExp=0
Task_Num = GetTask(251)
Working = GetTask(250)
if (Type==1) then
if (Act==0) then --Nhan nhiem vu
if (Working==1) then
Say("Ban phai hoan thanh nhiem vu duoc giao thi moi co the nhan nhiem vu moi.",0)
else
if (GetLevel()>40) then
Task_Type = random(1,4)
Task_Target,LevelExp = GenTask(GetLevel(),Task_Type)
else
Task_Type = random(2,3)
Task_Target,LevelExp = GenTask(GetLevel(),Task_Type)
end
str_task = "Day la nhiem vu thu <color=red>"..(GetTask(251)+1).."<color>. Nguoi hay di nang diem <color=red>"..Task_String[Task_Type].."<color> len <color=yellow>"..Task_Target.."<color> diem.";
main_task_type=Task_Type
main_task_target=Task_Target
if (Task_Type==1) then
main_task_start=GetExp()
elseif (Task_Type==2) then
main_task_start=GetRepute()
elseif (Task_Type==3) then
main_task_start=GetPK()
elseif (Task_Type==4) then
main_task_start=GetTask(232)
end
main_startlevel=GetLevel()
main_levelexp=LevelExp
end
end
if (Act==1) then --Hoan thanh nhiem vu
return
end
if (Act==2) then --Huy bo nhiem vu
return
end
if (Act==3) then --Xem thong tin nhan vat
return
end
end
end;
function GetDTTask()
local Working = GetTask(250)
local Task_Num = GetTask(251)
local Task_Type = GetTask(252)
local Task_Start = GetTask(253)
local Task_Target = GetTask(254)
local StartLevel = GetTask(255)
local LevelExp = GetTask(256)
local CurStatus, nNeedNum
if (Task_Type==1) then
CurStatus = GetExp()
if ((GetLevel()-StartLevel)>1) then
nNeedNum = 0
else
if ((GetLevel()-StartLevel)==1) then
nNeedNum = (Task_Start+Task_Target-LevelExp)-CurStatus
else
nNeedNum = (Task_Start+Task_Target)-CurStatus
end
end
if nNeedNum<0 then nNeedNum=0; end;
elseif (Task_Type==2) then
CurStatus = GetRepute()
nNeedNum = (Task_Target+Task_Start)-CurStatus
if nNeedNum<0 then nNeedNum=0; end;
elseif (Task_Type==3) then
CurStatus = GetPK()
if ((Task_Target+Task_Start)>10) then
nNeedNum = 10 - CurStatus
else
nNeedNum = (Task_Target+Task_Start)-CurStatus
end
if nNeedNum<0 then nNeedNum=0; end;
elseif (Task_Type==4) then
CurStatus = GetTask(232)
nNeedNum = (Task_Target+Task_Start)-CurStatus
if nNeedNum<0 then nNeedNum=0; end;
end
StrStatus="Ban dang thuc hien nhiem vu tang diem <color=red>"..Task_String[Task_Type].."<color>.So diem <color=red>"..Task_String[Task_Type].."<color> can phai nang la: <color=yellow>"..Task_Target.."<color>, so diem con lai cua ban la <color=yellow>"..nNeedNum.."<color>.Hay hoan thanh roi den tim ta."
if (nNeedNum==0) then
CheckFinish=1
else
CheckFinish=0
end
return Working, Task_Num, Task_Type, Task_Start, Task_Target, StartLevel, LevelExp , CurStatus, nNeedNum;
end;
function SetDTTask(Task_Type,Task_Start,Task_Target,StartLe vel,LevelExp)
local Working = GetTask(250)
local Task_Num = GetTask(251)
if (Working==1) then
Say("Ban chua hoan thanh nhiem vu truoc do nen khong the nhan nhiem vu moi",0)
else
SetTask(250,1)
SetTask(251,Task_Num+1)
SetTask(252,Task_Type)
SetTask(253,Task_Start)
SetTask(254,Task_Target)
SetTask(255,StartLevel)
SetTask(256,LevelExp)
end
end;
function FinishDTTask()
local Working = GetTask(250)
local Task_Num = GetTask(251)
SetTask(250,0)
SetTask(251,Task_Num)
SetTask(252,0)
SetTask(253,0)
SetTask(254,0)
SetTask(255,0)
SetTask(256,0)
end;
function ClearDTTask()
local Working = GetTask(250)
local Task_Num = GetTask(251)
SetTask(250,0)
SetTask(251,Task_Num-1)
SetTask(252,0)
SetTask(253,0)
SetTask(254,0)
SetTask(255,0)
SetTask(256,0)
end;
function GenTask(nLevel,nType)
TaskBin = {}
local level_list={10,20,30,40,50,60,70,80,90,100}
local level_exp={{40,318100},{50,544900},{60,905400},{70 ,1418400},{80,2151900},{90,3218400},{100,4793900}, {110,7147900},{120,10682400}}
local UpGround_Tab ={
{1,1,5000},
{2,1,15000},
{3,1,50000},
{4,1,100000},
{5,1,200000},
{6,1,500000},
{7,1,1000000},
{8,1,1500000},
{9,1,2000000},
{10,1,3000000},
{11,1,4000000},
{12,1,5000000},
{13,2,1},
{14,2,5},
{15,2,10},
{16,2,20},
{17,2,30},
{18,2,40},
{19,2,50},
{20,2,100},
{21,3,1},
{22,3,2},
{23,3,3},
{24,3,4},
{25,3,5},
{26,3,6},
{27,3,7},
{28,3,8},
{29,3,9},
{30,3,10},
{31,4,1000},
{32,4,2000},
{33,4,5000},
{34,4,7000},
{35,4,10000},
{36,4,12000},
{37,4,15000}
}
if (nLevel <= 40) then
TaskBin[1] = random(13,16)
TaskBin[2] = random(21,25)
nTarget = UpGround_Tab[TaskBin[nType-1]][3]
nLevelExp = 0
elseif (nLevel < 50) then
TaskBin[1] = random(1,6)
TaskBin[2] = random(13,16)
TaskBin[3] = random(21,30)
TaskBin[4] = random(31,34)
nTarget = UpGround_Tab[TaskBin[nType]][3]
nLevelExp = level_exp[1][2]
elseif (nLevel < 60) then
TaskBin[1] = random(1,6)
TaskBin[2] = random(13,16)
TaskBin[3] = random(21,30)
TaskBin[4] = random(31,34)
nTarget = UpGround_Tab[TaskBin[nType]][3]
nLevelExp = level_exp[2][2]
elseif (nLevel < 70) then
TaskBin[1] = random(1,6)
TaskBin[2] = random(13,16)
TaskBin[3] = random(21,30)
TaskBin[4] = random(31,34)
nTarget = UpGround_Tab[TaskBin[nType]][3]
nLevelExp = level_exp[3][2]
elseif (nLevel < 80) then
TaskBin[1] = random(1,7)
TaskBin[2] = random(13,17)
TaskBin[3] = random(21,30)
TaskBin[4] = random(31,34)
nTarget = UpGround_Tab[TaskBin[nType]][3]
nLevelExp = level_exp[4][2]
elseif (nLevel < 90) then
TaskBin[1] = random(1,6)
TaskBin[2] = random(13,16)
TaskBin[3] = random(21,30)
TaskBin[4] = random(31,34)
nTarget = UpGround_Tab[TaskBin[nType]][3]
nLevelExp = level_exp[5][2]
elseif (nLevel < 100) then
TaskBin[1] = random(1,12)
TaskBin[2] = random(13,20)
TaskBin[3] = random(21,30)
TaskBin[4] = random(31,37)
nTarget = UpGround_Tab[TaskBin[nType]][3]
nLevelExp = level_exp[6][2]
elseif (nLevel < 110) then
TaskBin[1] = random(1,12)
TaskBin[2] = random(13,20)
TaskBin[3] = random(21,30)
TaskBin[4] = random(31,37)
nTarget = UpGround_Tab[TaskBin[nType]][3]
nLevelExp = level_exp[7][2]
elseif (nLevel < 120) then
TaskBin[1] = random(1,12)
TaskBin[2] = random(13,20)
TaskBin[3] = random(21,30)
TaskBin[4] = random(31,37)
nTarget = UpGround_Tab[TaskBin[nType]][3]
nLevelExp = level_exp[8][2]
elseif (nLevel >= 120) then
TaskBin[1] = random(1,12)
TaskBin[2] = random(13,20)
TaskBin[3] = random(21,30)
TaskBin[4] = random(31,37)
nTarget = UpGround_Tab[TaskBin[nType]][3]
nLevelExp = level_exp[9][2]
end
return nTarget,nLevelExp;
end;
function GenRewardItem()
local baovat = {{3,0},{4,0},{4,1},{9,0},{9,1}}
local vukhi = {{0,0},{0,1},{0,2},{0,3},{0,4},{0,5},{1,0},{1,1},{ 1,2}}
local trangbi = {{8,0},{8,1},{5,0},{5,1},{5,2},{5,3},{6,0},{6,1},{ 1,2}}
local nItemClass = 0
local nDetailType = 0
local nParticualrType = 0
local nLevel = 0
local nSeries = random(0,4)
local nLuck = 0
local nItemLevel = random(1,10)
nLevel = GetLevel()/10
if (nLevel>10) then nLevel = 10
end
if (nLevel<1) then nLevel = 1 end
if (type_item ==1) then
i = random(1,9)
nDetailType = vukhi[i][1]
nParticualrType = vukhi[i][2]
elseif (type_item ==2) then
i = random(1,5)
nDetailType = baovat[i][1]
nParticualrType = baovat[i][2]
else
i = random(1,9)
nDetailType = trangbi[i][1]
nParticualrType = trangbi[i][2]
end
if (nLevel<70) then
nItemLevel = random(5,7)
else
nItemLevel = random(8,10)
end
AddItem(nItemClass,nDetailType,nParticualrType,nLe vel,nSeries,nLuckn,nItemLevel)
end;
------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Ham gia nhap quan tong
-- Vi du : JoinS()
-- Cach dung : xem them tren trang <b><font color=red>[Chỉ có thành viên mới xem link được. <a href="register.php"> Nhấp đây để đăng ký thành viên......</a>]</font></b>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
function JoinS()
MoveNPC(326,145,198,3,3,0,0)
SetCurCamp(1);
SetDeathScript("\\script\\global\\tong_kim\\tong_player_die.lua");
SetPunish(0)
SetRevPos(53, 19)
SetLogoutRV(1);
SetTempRevPos(326,145*8*32,198*16*32)
SetCreateTeam(0);
SetTask(233,GetExp())
end;
------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Ham gia nhap quan kim
-- Vi du : JoinJ()
-- Cach dung : xem them tren trang <b><font color=red>[Chỉ có thành viên mới xem link được. <a href="register.php"> Nhấp đây để đăng ký thành viên......</a>]</font></b>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
function JoinJ()
MoveNPC(326,193,158,6,9,4000,0)
SetCurCamp(2);
SetDeathScript("\\script\\global\\tong_kim\\kim_player_die.lua");
SetPunish(0)
SetRevPos(53, 19)
SetLogoutRV(1);
SetTempRevPos(326,193*8*32,158*16*32)
SetCreateTeam(0);
SetTask(233,GetExp())
end;
----------------------------------------------------------------------------------------Notify Function-----------------------------------------------------------------------------------------------------------
function MsgEx(sMessage,sMsgType)
if (sMsgType==0 or sMsgType==nil) then
Msg2Player(sMessage);
else
Talk(1,"",sMessage);
end
end;
function SayEx(strSay)
local strMsg,strSel = "","";
local strNum = getn(strSay);
if strNum < 2 then
return
end;
if strNum > 2 then
for i=2,strNum - 1 do
strSel = strSel..format("%q", strSay[i])..",";
end;
strSel = strSel..format("%q", strSay[strNum]);
strMsg = "Say("..format("%q", strSay[1])..","..(strNum - 1)..","..strSel..");";
elseif strNum == 2 then
strSel = format("%q", strSay[strNum]);
strMsg = "Say("..format("%q", strSay[1])..",1"..","..strSel..");";
end;
dostring(strMsg);
end;
function OnExit()
end;
Powered by vBulletin® Version 4.2.0 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.