The idea was when player talk to this npc it will have option to create an item, and it will require player to wait until the process is complete, that part works fine without an error, but the problem start when server reboot, restart or stop, if player was waiting the item to complete and server reboot or restart during that period, player will get stuck as the count time kinda stuck and it keep saying player to wait until the progress is done, can someone help me fix this script ?
Spoiler
- script PublicButcherTable FAKE_NPC,{.@wrkb_id= atoi(strnpcinfo(2));if($wrkb_crafting_state[.@wrkb_id]==1){
soundeffect "menu.wav",0;
mes "Please wait until the process is finished. ";
close;}if($wrkb_crafting_state[.@wrkb_id]==2){
soundeffect "menu.wav",0;
mes "Here are your butcher items.";for(.@i=0;.@i< getarraysize(getd("$wrkb_"+.@wrkb_id+"_products"));.@i+=2)
getitem(getd("$wrkb_"+.@wrkb_id+"_products["+.@i+"]"), getd("$wrkb_"+.@wrkb_id+"_products["+(.@i+1)+"]"));
delwaitingroom;
$wrkb_crafting_state[.@wrkb_id]=0;
close;}
soundeffect "menu.wav",0;
mes "==============================";
mes "^ff0000 Any item created unattended by using the Public Butcher Table can be stolen by other players !! ^000000";
mes "==============================";
next;
soundeffect "menu.wav",0;
mes "Select";
soundeffect "menu.wav",0;
next;switch(select("- Take Out Meat:- Take Out Bone:- Take Out Skin:- Cancel")){case1:switch(select("- Take Out 1 Meat:- Take Out 10 Meat:- Take Out 100 Meat:- Cancel")){case1:if(countitem(40006)<1|| rentalcountitem(40005)<1){
soundeffect "menu.wav",0;
mes "^ff0000 Require";
mes "- 1 Monster Loot";
mes "- 1 Stone Knife ^000000";
close;}
soundeffect "menu.wav",0;
mes "^8fce00 Require";
mes "- 1 Monster Loot";
mes "- 1 Stone Knife ^000000";
next;
soundeffect "menu.wav",0;switch(select("- Start:- Cancel")){case1:
delitem(40006,1);
setarray(getd("$wrkb_"+.@wrkb_id+"_products"),40012,1,40011,1);
butcher_points +=1;
dispbottom "Gain +1 Butchering Points";gotoOnCraftingStart;case2:goto cancel;}case2:if(countitem(40006)<10|| rentalcountitem(40005)<1){
soundeffect "menu.wav",0;
mes "^ff0000 Require";
mes "- 10 Monster Loot";
mes "- 1 Stone Knife ^000000";
close;}
soundeffect "menu.wav",0;
mes "^8fce00 Require";
mes "- 10 Monster Loot";
mes "- 1 Stone Knife ^000000";
next;
soundeffect "menu.wav",0;switch(select("- Start:- Cancel")){case1:
delitem(40006,10);
setarray(getd("$wrkb_"+.@wrkb_id+"_products"),40012,10,40011,10);
butcher_points +=10;
dispbottom "Gain +10 Butchering Points";gotoOnCraftingStart;case2:goto cancel;}case3:if(countitem(40006)<100|| rentalcountitem(40005)<1){
soundeffect "menu.wav",0;
mes "^ff0000 Require";
mes "- 1 Monster Loot";
mes "- 100 Stone Knife ^000000";
close;}
soundeffect "menu.wav",0;
mes "^8fce00 Require";
mes "- 1 Monster Loot";
mes "- 100 Stone Knife ^000000";
next;
soundeffect "menu.wav",0;switch(select("- Start:- Cancel")){case1:
delitem(40006,100);
setarray(getd("$wrkb_"+.@wrkb_id+"_products"),40012,100,40011,100);
butcher_points +=100;
dispbottom "Gain +100 Butchering Points";gotoOnCraftingStart;case2:goto cancel;}case4:goto cancel;}case2:switch(select("- Take Out 1 Bone:- Take Out 10 Bone:- Take Out 100 Bone:- Cancel")){case1:if(countitem(40006)<1|| rentalcountitem(40005)<1){
soundeffect "menu.wav",0;
mes "^ff0000 Require";
mes "- 1 Monster Loot";
mes "- 1 Stone Knife ^000000";
close;}
soundeffect "menu.wav",0;
mes "^8fce00 Require";
mes "- 1 Monster Loot";
mes "- 1 Stone Knife ^000000";
next;
soundeffect "menu.wav",0;switch(select("- Start:- Cancel")){case1:
delitem(40006,1);
setarray(getd("$wrkb_"+.@wrkb_id+"_products"),40012,1,40009,1);
butcher_points +=1;
dispbottom "Gain +1 Butchering Points";gotoOnCraftingStart;case2:goto cancel;}case2:if(countitem(40006)<10|| rentalcountitem(40005)<1){
soundeffect "menu.wav",0;
mes "^ff0000 Require";
mes "- 10 Monster Loot";
mes "- 1 Stone Knife ^000000";
close;}
soundeffect "menu.wav",0;
mes "^8fce00 Require";
mes "- 10 Monster Loot";
mes "- 1 Stone Knife ^000000";
next;
soundeffect "menu.wav",0;switch(select("- Start:- Cancel")){case1:
delitem(40006,10);
setarray(getd("$wrkb_"+.@wrkb_id+"_products"),40012,10,40009,10);
butcher_points +=10;
dispbottom "Gain +10 Butchering Points";gotoOnCraftingStart;case2:goto cancel;}case3:if(countitem(40006)<100|| rentalcountitem(40005)<1){
soundeffect "menu.wav",0;
mes "^ff0000 Require";
mes "- 100 Monster Loot";
mes "- 1 Stone Knife ^000000";
close;}
soundeffect "menu.wav",0;
mes "^8fce00 Require";
mes "- 100 Monster Loot";
mes "- 1 Stone Knife ^000000";
next;
soundeffect "menu.wav",0;switch(select("- Start:- Cancel")){case1:
delitem(40006,100);
setarray(getd("$wrkb_"+.@wrkb_id+"_products"),40012,100,40009,100);
butcher_points +=100;
dispbottom "Gain +100 Butchering Points";gotoOnCraftingStart;case2:goto cancel;}}case3:switch(select("- Take Out 1 Skin:- Take Out 10 Skin:- Take Out 100 Skin:- Cancel")){case1:if(countitem(40006)<1|| rentalcountitem(40005)<1){
soundeffect "menu.wav",0;
mes "^ff0000 Require";
mes "- 1 Monster Loot";
mes "- 1 Stone Knife ^000000";
close;}
soundeffect "menu.wav",0;
mes "^8fce00 Require";
mes "- 1 Monster Loot";
mes "- 1 Stone Knife ^000000";
next;
soundeffect "menu.wav",0;switch(select("- Start:- Cancel")){case1:
delitem(40006,1);
setarray(getd("$wrkb_"+.@wrkb_id+"_products"),40012,1,40010,1);
butcher_points +=1;
dispbottom "Gain +1 Butchering Points";gotoOnCraftingStart;case2:goto cancel;}case2:if(countitem(40006)<10|| rentalcountitem(40005)<1){
soundeffect "menu.wav",0;
mes "^ff0000 Require";
mes "- 10 Monster Loot";
mes "- 1 Stone Knife ^000000";
close;}
soundeffect "menu.wav",0;
mes "^8fce00 Require";
mes "- 10 Monster Loot";
mes "- 1 Stone Knife ^000000";
next;
soundeffect "menu.wav",0;switch(select("- Start:- Cancel")){case1:
delitem(40006,10);
setarray(getd("$wrkb_"+.@wrkb_id+"_products"),40012,10,40010,10);
butcher_points +=10;
dispbottom "Gain +10 Butchering Points";gotoOnCraftingStart;case2:goto cancel;}case3:if(countitem(40006)<100|| rentalcountitem(40005)<1){
soundeffect "menu.wav",0;
mes "^ff0000 Require";
mes "- 100 Monster Loot";
mes "- 1 Stone Knife ^000000";
close;}
soundeffect "menu.wav",0;
mes "^8fce00 Require";
mes "- 100 Monster Loot";
mes "- 1 Stone Knife ^000000";
next;
soundeffect "menu.wav",0;switch(select("- Start:- Cancel")){case1:
delitem(40006,100);
setarray(getd("$wrkb_"+.@wrkb_id+"_products"),40012,100,40010,100);
butcher_points +=100;
dispbottom "Gain +100 Butchering Points";gotoOnCraftingStart;case2:goto cancel;}case4:goto cancel;}case4:goto cancel;}
end;
cancel:
soundeffect "menu.wav",0;
mes "Process Cancel";
close;OnCraftingStart:
$wrkb_crafting_state[.@wrkb_id]=1;
waitingroom("PROCESSING...",0);
initnpctimer;
end;OnTimer60000:
$wrkb_crafting_state[atoi(strnpcinfo(2))]=2;
delwaitingroom;
waitingroom("COMPLETED!",0);
end;OnInit:.@wrkb_id= atoi(strnpcinfo(2));if(.@wrkb_id<1) end;if($wrkb_crafting_state[.@wrkb_id]==1)gotoOnCraftingStart;}//Duplicate//=====================================================
new_1-3,99,128,6 duplicate(PublicButcherTable)PublicButcherTable#1 11004
new_1-3,95,128,6 duplicate(PublicButcherTable)PublicButcherTable#2 11004
new_1-3,91,128,6 duplicate(PublicButcherTable)PublicButcherTable#3 11004
new_1-3,99,134,6 duplicate(PublicButcherTable)PublicButcherTable#4 11004
new_1-3,95,134,6 duplicate(PublicButcherTable)PublicButcherTable#5 11004
new_1-3,91,134,6 duplicate(PublicButcherTable)PublicButcherTable#6 11004
Question
Dolphin86
The idea was when player talk to this npc it will have option to create an item, and it will require player to wait until the process is complete, that part works fine without an error, but the problem start when server reboot, restart or stop, if player was waiting the item to complete and server reboot or restart during that period, player will get stuck as the count time kinda stuck and it keep saying player to wait until the progress is done, can someone help me fix this script ?
thanks..
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.