iamkevin Posted April 27, 2017 Group: Members Topic Count: 30 Topics Per Day: 0.01 Content Count: 104 Reputation: 3 Joined: 09/15/16 Last Seen: July 20, 2024 Share Posted April 27, 2017 (edited) Bump for this topic, how can we make a shop and appoint only the guild master to use the points and buy items in the shop? Edited May 1, 2017 by Emistry Splitted posts. Please don't hijack other member's topic. Quote Link to comment Share on other sites More sharing options...
0 Cyro Posted April 28, 2017 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 1138 Reputation: 290 Joined: 04/29/13 Last Seen: July 20, 2024 Share Posted April 28, 2017 14 hours ago, iamkevin said: Bump for this topic, how can we make a shop and appoint only the guild master to use the points and buy items in the shop? - script woeshop -1,{ OnInit: bindatcmd "woeshop", strnpcinfo(3) +"::OnWOESHOP"; end; OnWOESHOP: if (getguildmasterid(getcharid(2)) == getcharid(0)) { message strcharinfo(0),"here u go."; callshop "woe_shop",0; end; } message strcharinfo(0),"You must be a guild master to use this command."; end; } //Modify to your liking, by default it sells like the Tool Dealer - pointshop woe_shop -1,woe_points,1750:-1,501:-1,502:-1,503:-1,504:-1,506:-1,645:-1,656:-1,601:-1,602:-1,1065:-1 Quote Link to comment Share on other sites More sharing options...
0 iamkevin Posted April 28, 2017 Group: Members Topic Count: 30 Topics Per Day: 0.01 Content Count: 104 Reputation: 3 Joined: 09/15/16 Last Seen: July 20, 2024 Author Share Posted April 28, 2017 On 2017-4-28 at 11:37 AM, Cyro said: - script woeshop -1,{ OnInit: bindatcmd "woeshop", strnpcinfo(3) +"::OnWOESHOP"; end; OnWOESHOP: if (getguildmasterid(getcharid(2)) == getcharid(0)) { message strcharinfo(0),"here u go."; callshop "woe_shop",0; end; } message strcharinfo(0),"You must be a guild master to use this command."; end; } //Modify to your liking, by default it sells like the Tool Dealer - pointshop woe_shop -1,woe_points,1750:-1,501:-1,502:-1,503:-1,504:-1,506:-1,645:-1,656:-1,601:-1,602:-1,1065:-1 Thanks for your reply but will this work since it is an sql added points? How to make a sql querry shop for this WoE Point System to be used in purchasing items? thank you Quote Link to comment Share on other sites More sharing options...
0 Cyro Posted April 30, 2017 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 1138 Reputation: 290 Joined: 04/29/13 Last Seen: July 20, 2024 Share Posted April 30, 2017 2 hours ago, iamkevin said: How to make a sql querry shop for this WoE Point System to be used in purchasing items? thank you prontera,165,168,3 script woepoints 89,{ //Function Prototypes //modfied by cyro function garbagecol;//Garbage collection for the Character variables garbagecol(); function add_item; //Syntanx: add_item(ITEMID,QUANTITY,POINTS,CATEGORY); function makeCategory;//This will return a list of the categories function getItemsByCat;//This will return the list of items associated to the particular category function getItemDetails;//This will return the details of the item function getPoints;//This will return the points of the player stored in the database function updatePoints;//This will updates the points of the player stored in the database //NPC Name set .npcname$,"[ Woe Points ]"; //Initialization of the Rewards add_item(14532,1,10,"25% manual"); add_item(14533,1,20,"50% job Manual"); add_item(13599,1,90,"50% base manual[5p box]"); add_item(30182,1,500,"zoro sword"); add_item(30129,1,600,"dragon blade"); add_item(30154,1,700,"runes of power"); //Script Start if (getguildmasterid(getcharid(2)) == getcharid(0)) { mes .npcname$; mes "Hi! Do you want to exchange your woe points?:"; switch(select("Yes, I want to exchange my points:See my points")) { case 1: next; mes .npcname$; mes "Please choose a category:"; set .@selected,select(makeCategory())-1; next; mes .npcname$; mes "Please the item you want:"; set .@selected,select(getItemsByCat(@listCat$[.@selected]))-1; next; mes .npcname$; set .@ritemid,getItemDetails(@itemKeys[.@selected],"itemid"); set .@rquantity,getItemDetails(@itemKeys[.@selected],"quantity"); set .@rpoints,getItemDetails(@itemKeys[.@selected],"points"); mes "Item ID:"+.@ritemid; mes "Item Name: "+getitemname(.@ritemid); mes "Item Quantity: "+.@rquantity+" pc(s)."; mes "Required Points: "+.@rpoints+" pt(s)."; mes "\n"; mes "Do you want to this item?"; if(select("Yes:No")==1) { set .@points,getPoints(getcharid(3)); if(.@points>=.@rpoints) { next; mes .npcname$; updatePoints(getcharid(3),.@rpoints); getitem .@ritemid,.@rquantity; mes "Here you go!:D"; } else mes "Sorry, you do not have enough points for this item."; } else { next; mes .npcname$; mes "Okay bye!"; } garbagecol(); close; case 2: next; mes .npcname$; set .@points,getPoints(getcharid(3)); mes "You currently have "+.@points+" pt(s)."; garbagecol(); close; } else { next; mes .npcname$; mes "You must be guild leader to use my services!"; } } end; //Functions Bodies function updatePoints { set .@account_id,getarg(0); set .@usedPoints,getarg(1); query_sql("UPDATE `guild_points` SET points=(woe_points-"+.@usedPoints+") WHERE guild_id='"+.@guild_id+"'"); return; } function getPoints { set .@account_id,getarg(0); query_sql("SELECT `woe_points` FROM `guild_points` WHERE guild_id="+.@guild_id+" LIMIT 1",.@points); if(getarraysize(.@points)==0) return 0; return .@points[0]; } function getItemDetails { set .@key,getarg(0); //Key set .@detail$,getarg(1); //What details to return such as ItemID, Points, Quantity, Category if(strtolower(.@detail$) == strtolower("ItemID")) return @itemID[.@key]; else if(strtolower(.@detail$) == strtolower("Quantity")) return @itemQ[.@key]; else if(strtolower(.@detail$) == strtolower("Points")) return @points[.@key]; else if(strtolower(.@detail$) == strtolower("Category")) return @category$[.@key]; } function getItemsByCat { set .@selectedCat$,getarg(0); set .@make_string$,""; set .@x,0; for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1) { if(strtolower(.@selectedCat$) == strtolower(@category$[.@i])) { setarray @itemKeys[.@x],.@i; if(.@make_string$ == "") set .@make_string$,getitemname(@itemID[.@i]); else set .@make_string$,.@make_string$+":"+getitemname(@itemID[.@i]); set .@x,.@x+1; } } return .@make_string$; } function makeCategory { set .@make_string$,""; for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1) { if(.@make_string$ == "") { setarray @listCat$[getarraysize(@listCat$)],@category$[.@i]; set .@make_string$,@category$[.@i]; } else { if(compare(.@make_string$,@category$[.@i])==0) { setarray @listCat$[getarraysize(@listCat$)],@category$[.@i]; set .@make_string$,.@make_string$+":"+@category$[.@i]; } } } return .@make_string$; } function add_item { set .@itemID,getarg(0,-1); //IteID set .@itemQ,getarg(1,-1); //Item Quantity set .@points,getarg(2,-1); set .@cat$,getarg(3,"Uncategorized"); //Category if(.@itemID == -1) { debugmes "Invalid Item ID. Script not completely loaded."; end; } else if(.@itemQ == -1) { debugmes "Invalid Item Quantity. Script not completely loaded."; end; } else if(.@points == -1) { debugmes "Points assignment error. Script not completely loaded."; end; } set .@key,getarraysize(@itemID); setarray @itemID[.@key],.@itemID; setarray @itemQ[.@key],.@itemQ; setarray @points[.@key],.@points; setarray @category$[.@key],.@cat$; return 1; //return 1 as success } function garbagecol{ deletearray @itemID[0],128; deletearray @itemQ[0],128; deletearray @points[0],128; deletearray @category$[0],128; deletearray @listCat$[0],128; deletearray @itemKeys[0],128; return; } } this is not tested, please update me if you see any errors Quote Link to comment Share on other sites More sharing options...
0 iamkevin Posted May 1, 2017 Group: Members Topic Count: 30 Topics Per Day: 0.01 Content Count: 104 Reputation: 3 Joined: 09/15/16 Last Seen: July 20, 2024 Author Share Posted May 1, 2017 On 2017-4-30 at 3:30 PM, Cyro said: prontera,165,168,3 script woepoints 89,{ //Function Prototypes //modfied by cyro function garbagecol;//Garbage collection for the Character variables garbagecol(); function add_item; //Syntanx: add_item(ITEMID,QUANTITY,POINTS,CATEGORY); function makeCategory;//This will return a list of the categories function getItemsByCat;//This will return the list of items associated to the particular category function getItemDetails;//This will return the details of the item function getPoints;//This will return the points of the player stored in the database function updatePoints;//This will updates the points of the player stored in the database //NPC Name set .npcname$,"[ Woe Points ]"; //Initialization of the Rewards add_item(14532,1,10,"25% manual"); add_item(14533,1,20,"50% job Manual"); add_item(13599,1,90,"50% base manual[5p box]"); add_item(30182,1,500,"zoro sword"); add_item(30129,1,600,"dragon blade"); add_item(30154,1,700,"runes of power"); //Script Start if (getguildmasterid(getcharid(2)) == getcharid(0)) { mes .npcname$; mes "Hi! Do you want to exchange your woe points?:"; switch(select("Yes, I want to exchange my points:See my points")) { case 1: next; mes .npcname$; mes "Please choose a category:"; set .@selected,select(makeCategory())-1; next; mes .npcname$; mes "Please the item you want:"; set .@selected,select(getItemsByCat(@listCat$[.@selected]))-1; next; mes .npcname$; set .@ritemid,getItemDetails(@itemKeys[.@selected],"itemid"); set .@rquantity,getItemDetails(@itemKeys[.@selected],"quantity"); set .@rpoints,getItemDetails(@itemKeys[.@selected],"points"); mes "Item ID:"+.@ritemid; mes "Item Name: "+getitemname(.@ritemid); mes "Item Quantity: "+.@rquantity+" pc(s)."; mes "Required Points: "+.@rpoints+" pt(s)."; mes "\n"; mes "Do you want to this item?"; if(select("Yes:No")==1) { set .@points,getPoints(getcharid(3)); if(.@points>=.@rpoints) { next; mes .npcname$; updatePoints(getcharid(3),.@rpoints); getitem .@ritemid,.@rquantity; mes "Here you go!:D"; } else mes "Sorry, you do not have enough points for this item."; } else { next; mes .npcname$; mes "Okay bye!"; } garbagecol(); close; case 2: next; mes .npcname$; set .@points,getPoints(getcharid(3)); mes "You currently have "+.@points+" pt(s)."; garbagecol(); close; } else { next; mes .npcname$; mes "You must be guild leader to use my services!"; } } end; //Functions Bodies function updatePoints { set .@account_id,getarg(0); set .@usedPoints,getarg(1); query_sql("UPDATE `guild_points` SET points=(woe_points-"+.@usedPoints+") WHERE guild_id='"+.@guild_id+"'"); return; } function getPoints { set .@account_id,getarg(0); query_sql("SELECT `woe_points` FROM `guild_points` WHERE guild_id="+.@guild_id+" LIMIT 1",.@points); if(getarraysize(.@points)==0) return 0; return .@points[0]; } function getItemDetails { set .@key,getarg(0); //Key set .@detail$,getarg(1); //What details to return such as ItemID, Points, Quantity, Category if(strtolower(.@detail$) == strtolower("ItemID")) return @itemID[.@key]; else if(strtolower(.@detail$) == strtolower("Quantity")) return @itemQ[.@key]; else if(strtolower(.@detail$) == strtolower("Points")) return @points[.@key]; else if(strtolower(.@detail$) == strtolower("Category")) return @category$[.@key]; } function getItemsByCat { set .@selectedCat$,getarg(0); set .@make_string$,""; set .@x,0; for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1) { if(strtolower(.@selectedCat$) == strtolower(@category$[.@i])) { setarray @itemKeys[.@x],.@i; if(.@make_string$ == "") set .@make_string$,getitemname(@itemID[.@i]); else set .@make_string$,.@make_string$+":"+getitemname(@itemID[.@i]); set .@x,.@x+1; } } return .@make_string$; } function makeCategory { set .@make_string$,""; for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1) { if(.@make_string$ == "") { setarray @listCat$[getarraysize(@listCat$)],@category$[.@i]; set .@make_string$,@category$[.@i]; } else { if(compare(.@make_string$,@category$[.@i])==0) { setarray @listCat$[getarraysize(@listCat$)],@category$[.@i]; set .@make_string$,.@make_string$+":"+@category$[.@i]; } } } return .@make_string$; } function add_item { set .@itemID,getarg(0,-1); //IteID set .@itemQ,getarg(1,-1); //Item Quantity set .@points,getarg(2,-1); set .@cat$,getarg(3,"Uncategorized"); //Category if(.@itemID == -1) { debugmes "Invalid Item ID. Script not completely loaded."; end; } else if(.@itemQ == -1) { debugmes "Invalid Item Quantity. Script not completely loaded."; end; } else if(.@points == -1) { debugmes "Points assignment error. Script not completely loaded."; end; } set .@key,getarraysize(@itemID); setarray @itemID[.@key],.@itemID; setarray @itemQ[.@key],.@itemQ; setarray @points[.@key],.@points; setarray @category$[.@key],.@cat$; return 1; //return 1 as success } function garbagecol{ deletearray @itemID[0],128; deletearray @itemQ[0],128; deletearray @points[0],128; deletearray @category$[0],128; deletearray @listCat$[0],128; deletearray @itemKeys[0],128; return; } } this is not tested, please update me if you see any errors not working, i also modified this: function updatePoints { set .@account_id,getarg(0); set .@usedPoints,getarg(1); -- query_sql("UPDATE `guild_points` SET points=(woe_points-"+.@usedPoints+") WHERE guild_id='"+.@guild_id+"'"); ++ query_sql("UPDATE `guild` SET points=(woe_points-"+.@usedPoints+") WHERE guild_id='"+.@guild_id+"'"); return; } function getPoints { set .@account_id,getarg(0); -- query_sql("SELECT `woe_points` FROM `guild_points` WHERE guild_id="+.@guild_id+" LIMIT 1",.@points); ++ query_sql("SELECT `woe_points` FROM `guild` WHERE guild_id="+.@guild_id+" LIMIT 1",.@points); if(getarraysize(.@points)==0) I was able to run the script without errors.. and i changed the items and categories but it just shows Blank in the category selection same as through when checking available points.. PS: i am using same script as for vote4points. thank you for the effort.. lets fix this XD On 2017-5-1 at 2:09 AM, realRO said: Hi what are the working scripts on these topic? none at this moment yet. still waiting for someone to help me with this XD Quote Link to comment Share on other sites More sharing options...
0 iamkevin Posted May 25, 2017 Group: Members Topic Count: 30 Topics Per Day: 0.01 Content Count: 104 Reputation: 3 Joined: 09/15/16 Last Seen: July 20, 2024 Author Share Posted May 25, 2017 any? Quote Link to comment Share on other sites More sharing options...
-1 realRO Posted April 30, 2017 Group: Members Topic Count: 29 Topics Per Day: 0.01 Content Count: 84 Reputation: 0 Joined: 12/24/13 Last Seen: June 13, 2017 Share Posted April 30, 2017 Hi what are the working scripts on these topic? Quote Link to comment Share on other sites More sharing options...
-1 iamkevin Posted May 5, 2017 Group: Members Topic Count: 30 Topics Per Day: 0.01 Content Count: 104 Reputation: 3 Joined: 09/15/16 Last Seen: July 20, 2024 Author Share Posted May 5, 2017 Bump? any script where we can make use of existing sql points to be used in buying to a shop? Bump any idea on how to make a shop for this sql querries? help Quote Link to comment Share on other sites More sharing options...
Question
iamkevin
Bump for this topic,
how can we make a shop and appoint only the guild master to use the points and buy items in the shop?
Edited by EmistrySplitted posts. Please don't hijack other member's topic.
Link to comment
Share on other sites
7 answers 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.