Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CraftTimer = {};
- function init_CraftTimer()
- -- local textureid = CreateTexture(2900, 200, 6000, 8000, "BAR_BACK.TGA");
- for i = 0, GetMaxPlayers() - 1 do
- CraftTimer[i] = {};
- CraftTimer[i].DigOre = 0;
- end
- end
- function getCraftTimer(playerid, id)
- if id == 0 then
- return CraftTimer[playerid].DigOre;
- end
- end
- function setCraftTimer(playerid, id, value)
- if id == 0 then
- CraftTimer[playerid].DigOre = value;
- end
- end
- function resetCraftTimer(playerid)
- CraftTimer[playerid].DigOre = 0;
- end
- function StartDigging(playerid)
- local ani = GetPlayerAnimationID(playerid);
- if getCraftTimer(playerid, 0) == 0 then
- if ani == 305 then
- setCraftTimer(playerid,0,1);
- FreezePlayer(playerid, 1);
- GameTextForPlayer(playerid, 2600, 3000, "Started Digging.", "Font_Old_20_White_Hi.TGA", 20, 20, 200, 1500);
- SetTimerEx("StartDigging2",4000,0,playerid);
- else
- GameTextForPlayer(playerid, 2600, 3000, "You're not digging.", "Font_Old_20_White_Hi.TGA", 200, 20, 20, 1500);
- end
- else
- GameTextForPlayer(playerid, 2600, 3000, "You're already digging!", "Font_Old_20_White_Hi.TGA", 200, 20, 20, 1500);
- end
- end
- function StartDigging2(playerid)
- local ani = GetPlayerAnimationID(playerid);
- if getCraftTimer(playerid, 0) == 1 then
- if ani == 305 then
- setCraftTimer(playerid,0,2);
- FreezePlayer(playerid, 1);
- GameTextForPlayer(playerid, 2600, 3000, "Digging 20% done", "Font_Old_20_White_Hi.TGA", 20, 20, 200, 1500);
- SetTimerEx("StartDigging3",4000,0,playerid);
- else
- GameTextForPlayer(playerid, 2600, 3000, "You stopped digging.", "Font_Old_20_White_Hi.TGA", 200, 20, 20, 1500);
- setCraftTimer(playerid,0,0);
- FreezePlayer(playerid, 0);
- end
- end
- end
- function StartDigging3(playerid)
- local ani = GetPlayerAnimationID(playerid);
- if getCraftTimer(playerid, 0) == 2 then
- if ani == 305 then
- setCraftTimer(playerid,0,3);
- FreezePlayer(playerid, 1);
- GameTextForPlayer(playerid, 2600, 3000, "Digging 40% done", "Font_Old_20_White_Hi.TGA", 20, 20, 200, 1500);
- SetTimerEx("StartDigging4",4000,0,playerid);
- else
- GameTextForPlayer(playerid, 2600, 3000, "You stopped digging.", "Font_Old_20_White_Hi.TGA", 200, 20, 20, 1500);
- setCraftTimer(playerid,0,0);
- FreezePlayer(playerid, 0);
- end
- end
- end
- function StartDigging4(playerid)
- local ani = GetPlayerAnimationID(playerid);
- if getCraftTimer(playerid, 0) == 3 then
- if ani == 305 then
- setCraftTimer(playerid,0,4);
- FreezePlayer(playerid, 1);
- GameTextForPlayer(playerid, 2600, 3000, "Digging 60% done", "Font_Old_20_White_Hi.TGA", 20, 20, 200, 1500);
- SetTimerEx("StartDigging5",4000,0,playerid);
- else
- GameTextForPlayer(playerid, 2600, 3000, "You stopped digging.", "Font_Old_20_White_Hi.TGA", 200, 20, 20, 1500);
- setCraftTimer(playerid,0,0);
- FreezePlayer(playerid, 0);
- end
- end
- end
- function StartDigging5(playerid)
- local ani = GetPlayerAnimationID(playerid);
- if getCraftTimer(playerid, 0) == 4 then
- if ani == 305 then
- setCraftTimer(playerid,0,5);
- FreezePlayer(playerid, 1);
- GameTextForPlayer(playerid, 2600, 3000, "Digging 80% done", "Font_Old_20_White_Hi.TGA", 20, 20, 200, 1500);
- SetTimerEx("FinishDigging",4000,0,playerid);
- else
- GameTextForPlayer(playerid, 2600, 3000, "You stopped digging.", "Font_Old_20_White_Hi.TGA", 200, 20, 20, 1500);
- setCraftTimer(playerid,0,0);
- FreezePlayer(playerid, 0);
- end
- end
- end
- function FinishDigging(playerid)
- local ani = GetPlayerAnimationID(playerid);
- if getCraftTimer(playerid, 0) == 5 then
- if ani == 305 then
- resetCraftTimer(playerid);
- FreezePlayer(playerid, 0);
- local job = getJob(playerid, 6);
- local number0 = random(3);
- local amount0 = number0+1;
- local number1 = random(8);
- local amount1 = number1+1;
- local number2 = random(14);
- local amount2 = number2+2;
- local number3 = random(19);
- local amount3 = number3+4;
- local number4 = random(28);
- local amount4 = number4+6;
- local number5 = random(31);
- local amount5 = number5+10;
- if job <= 50 then
- local amountexp = (amount0)*5;
- --GameTextForPlayer(playerid, 2600, 3000, "Dug "..amount0.." ore nuggets.", "Font_Old_20_White_Hi.TGA", 20, 20, 200, 1500);
- --GameTextForPlayer(playerid, 2600, 3500, "+"..amount0.." digging experience.", "Font_Old_10_White_Hi.TGA", 150, 150, 200, 1500);
- diggerexp = CreateDraw( 2600, 3000, "Dug "..amount0.." ore nuggets.", "Font_Old_20_White_Hi.TGA", 20, 20, 200);
- diggerexp2 = CreateDraw( 2600, 3500, "+"..amountexp.." digging experience.", "Font_Old_10_White_Hi.TGA", 150, 150, 200);
- GiveItem(playerid, "itmi_nugget", amount0);
- setJob(playerid, 6, job+amountexp);
- elseif job <= 300 then
- local amountexp = amount1*5;
- --GameTextForPlayer(playerid, 2600, 3000, "Dug "..amount1.." ore nuggets.", "Font_Old_20_White_Hi.TGA", 20, 20, 200, 1500);
- --GameTextForPlayer(playerid, 2600, 3500, "+"..amount1.." digging experience.", "Font_Old_10_White_Hi.TGA", 150, 150, 200, 1500);
- diggerexp = CreateDraw( 2600, 3000, "Dug "..amount1.." ore nuggets.", "Font_Old_20_White_Hi.TGA", 20, 20, 200);
- diggerexp2 = CreateDraw( 2600, 3500, "+"..amountexp.." digging experience.", "Font_Old_10_White_Hi.TGA", 150, 150, 200);
- GiveItem(playerid, "itmi_nugget", amount1);
- setJob(playerid, 6, job+amountexp);
- elseif job <= 800 then
- local amountexp = amount2*5;
- --GameTextForPlayer(playerid, 2600, 3000, "Dug "..amount2.." ore nuggets.", "Font_Old_20_White_Hi.TGA", 20, 20, 200, 1500);
- --GameTextForPlayer(playerid, 2600, 3500, "+"..amount2.." digging experience.", "Font_Old_10_White_Hi.TGA", 150, 150, 200, 1500);
- diggerexp = CreateDraw( 2600, 3000, "Dug "..amount2.." ore nuggets.", "Font_Old_20_White_Hi.TGA", 20, 20, 200);
- diggerexp2 = CreateDraw( 2600, 3500, "+"..amountexp.." digging experience.", "Font_Old_10_White_Hi.TGA", 150, 150, 200);
- GiveItem(playerid, "itmi_nugget", amount2);
- setJob(playerid, 6, job+amountexp);
- elseif job <= 2500 then
- local amountexp = amount3*5;
- --GameTextForPlayer(playerid, 2600, 3000, "Dug "..amount3.." ore nuggets.", "Font_Old_20_White_Hi.TGA", 20, 20, 200, 1500);
- --GameTextForPlayer(playerid, 2600, 3500, "+"..amount3.." digging experience.", "Font_Old_10_White_Hi.TGA", 150, 150, 200, 1500);
- diggerexp = CreateDraw( 2600, 3000, "Dug "..amount3.." ore nuggets.", "Font_Old_20_White_Hi.TGA", 20, 20, 200);
- diggerexp2 = CreateDraw( 2600, 3500, "+"..amountexp.." digging experience.", "Font_Old_10_White_Hi.TGA", 150, 150, 200);
- GiveItem(playerid, "itmi_nugget", amount3);
- setJob(playerid, 6, job+amountexp);
- elseif job <= 5000 then
- local amountexp = amount4*5;
- --GameTextForPlayer(playerid, 2600, 3000, "Dug "..amount4.." ore nuggets.", "Font_Old_20_White_Hi.TGA", 20, 20, 200, 1500);
- --GameTextForPlayer(playerid, 2600, 3500, "+"..amount4.." digging experience.", "Font_Old_10_White_Hi.TGA", 150, 150, 200, 1500);
- diggerexp = CreateDraw( 2600, 3000, "Dug "..amount4.." ore nuggets.", "Font_Old_20_White_Hi.TGA", 20, 20, 200);
- diggerexp2 = CreateDraw( 2600, 3500, "+"..amountexp.." digging experience.", "Font_Old_10_White_Hi.TGA", 150, 150, 200);
- GiveItem(playerid, "itmi_nugget", amount4);
- setJob(playerid, 6, job+amountexp);
- else
- --GameTextForPlayer(playerid, 2600, 3000, "Dug "..amount5.." ore nuggets.", "Font_Old_20_White_Hi.TGA", 20, 20, 200, 1500);
- diggerexp = CreateDraw( 2600, 3000, "Dug "..amount5.." ore nuggets.", "Font_Old_20_White_Hi.TGA", 20, 20, 200);
- diggerexp2 = CreateDraw( 2600, 3500, "Maximum digging level reached.", "Font_Old_10_White_Hi.TGA", 150, 150, 200);
- GiveItem(playerid, "itmi_nugget", amount5);
- --setJob(playerid, 6, job+amount5);
- end
- ShowDraw(playerid,diggerexp);
- ShowDraw(playerid,diggerexp2);
- SetTimerEx("FinishDigging2",1500,0,playerid);
- else
- GameTextForPlayer(playerid, 2600, 3000, "You stopped digging.", "Font_Old_20_White_Hi.TGA", 200, 20, 20, 1500);
- setCraftTimer(playerid,0,0);
- FreezePlayer(playerid, 0);
- end
- end
- end
- function FinishDigging2(playerid)
- HideDraw(playerid,diggerexp);
- DestroyDraw(diggerexp);
- HideDraw(playerid,diggerexp2);
- DestroyDraw(diggerexp2);
- end
- --addCommandHandler("/digore", StartDigging);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement