awesomazingxed Posted January 27, 2015 Group: Members Topic Count: 51 Topics Per Day: 0.01 Content Count: 95 Reputation: 1 Joined: 10/24/14 Last Seen: August 7, 2015 Share Posted January 27, 2015 Halo rathena. Can someone edit this script. If a player bought any items in my donation, it will announce globally. Thanks. // Awesomazing Coin Rewards - shop Emistry_Shop1 -1,512:100 turbo_room,123,97,4 script Donation Rewards 829,{ function ShopSettings; function ValidateCost; function CurrencyInfo; function ClearData; function ValueConvert; function ErrorNotice; mes "[ RO2K15 Coin Rewards]"; mes "^d21838PODs^000000 can be traded here."; mes "You can obtain PODs from:"; mes "1. Donation"; mes "2. Lotti Girl"; mes "3. GM Held Events"; mes "4. Facebook Contest"; next; // Menu Selection select("Headgear","Mid Headgear","Lower Headgear","Consumables & ETC"); ClearData(); ShopSettings( @menu ); npcshopitem "Emistry_Shop1",512,100; npcshopdelitem "Emistry_Shop1",512; for(set .@i,0; .@i < getarraysize( @ItemLists ); set .@i,.@i+1) npcshopadditem "Emistry_Shop1",@ItemLists[.@i],@ItemCost[.@i]; CurrencyInfo( @Currency$ ); callshop "Emistry_Shop1",1; npcshopattach "Emistry_Shop1"; end; function ShopSettings { switch( getarg(0) ){ Case 1: // Currency [ Item ID / Variable Name ] set @Currency$,"7179"; // Item ID Lists setarray @ItemLists[0],5375,5376,5396,5498,5420,5383,5481,5423,5564,5399,5374,5518,5805,5452; // Item Price setarray @ItemCost[0],5,5,5,5,5,5,5,7,7,10,10,10,12,15; break; Case 2: // Currency [ Item ID / Variable Name ] set @Currency$,"7179"; // Item ID Lists setarray @ItemLists[0],5421,5325,5800,5389,5664,5471,5402; // Item Price setarray @ItemCost[0],5,5,5,5,5,5,5; break; Case 3: // Currency [ Item ID / Variable Name ] set @Currency$,"7179"; // Item ID Lists setarray @ItemLists[0],5532,5462,5155,5377,5521; // Item Price setarray @ItemCost[0],3,6,8,9,15; break; Case 4: // Currency [ Item ID / Variable Name ] set @Currency$,"7179"; // Item ID Lists setarray @ItemLists[0],7776,7619,7620; // Item Price setarray @ItemCost[0],1,1,1; break; // Case 4,5,6.....etc... default: ErrorNotice( "Invalid Menu Selection for Menu "+@menu+"." ); close; } if( @Currency$ == "" ) ErrorNotice( "Invalid Currency Setting in Menu "+@menu+" ." ); if( getarraysize( @ItemCost ) != getarraysize( @ItemLists ) || getarraysize( @ItemLists ) != getarraysize( @ItemCost ) ) ErrorNotice( "Missing or Extra Value of Item or Cost Settings in Menu "+@menu+" ." ); return; } function ErrorNotice { mes "^FF0000ERROR^000000 - "+getarg(0); mes "^00FF00____________________________^000000"; mes "Inform this Message to ^0000FFGame Staffs^000000 immediately !"; close; } function CurrencyInfo { if( getitemname( atoi( getarg(0) ) ) != "null" ){ mes "Item Currency : ^FF0000"+getitemname( atoi( getarg(0) ) )+"^000000"; mes "Available Amount : ^0000FF"+ValueConvert( countitem( atoi( getarg(0) ) ) )+"^000000"; }else if( getitemname( atoi( getarg(0) ) ) == "null" ){ mes "Variable Currency : ^FF0000"+getarg(0)+"^000000"; mes "Available Amount : ^0000FF"+ValueConvert( getd( getarg(0) ) )+"^000000"; } return; } function ValidateCost { if( getitemname( atoi( getarg(0) ) ) != "null" ){ if( countitem( atoi( getarg(0) ) ) < getarg(1) ) return 1; }else{ if( getd( getarg(0) ) < getarg(1) ) return 1; } return 0; } function ClearData { set @Currency$,""; set @TotalCost,0; deletearray @bought_nameid[0],getarraysize( @bought_nameid ); deletearray @bought_quantity[0],getarraysize( @bought_quantity ); deletearray @ItemLists[0],getarraysize( @ItemLists ); deletearray @ItemCost[0],getarraysize( @ItemCost ); return; } function ValueConvert { set .@num, atoi(""+getarg(0)); if ( .@num == 0 || .@num >= 2147483647 ) return getarg(0); set .@l, getstrlen(""+.@num); for ( set .@i,0; .@i < .@l; set .@i, .@i + 1 ) { set .@num$, .@num % pow(10,.@i+1) / pow(10,.@i) + .@num$; if ( (.@i+1) % 3 == 0 && .@i+1 != .@l ) set .@num$, ","+ .@num$; } return .@num$; } OnBuyItem: ShopSettings( @menu ); for(set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1) for(set @j,0; @j < getarraysize( @ItemLists ); set @j,@j+1) if( @ItemLists[@j] == @bought_nameid[@i] ) set @TotalCost,@TotalCost + ( @ItemCost[@j] * @bought_quantity[@i] ); for( set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1 ) mes "Reward : "+@bought_quantity[@i]+" "+getitemname( @bought_nameid[@i] )+""; mes "-----------------------------------"; if( getitemname( atoi( @Currency$ ) ) != "null" ) mes "Total Cost : "+ValueConvert( @TotalCost )+" "+getitemname( atoi( @Currency$ ) )+""; else if( getitemname( atoi( @Currency$ ) ) == "null" ){ mes "Total Cost : "+ValueConvert( @TotalCost )+" "+@Currency$+""; } if( ValidateCost( @Currency$,@TotalCost ) ){ if( getitemname( atoi( @Currency$ ) ) != "null" ) mes " Insufficient "+getitemname( atoi( @Currency$ ) )+""; else{ mes "[^00FF00Insufficient^000000"+@Currency$+""; } }else{ if( select( "^0000FFPurchase^000000:Cancel" ) == 1 ){ if( getitemname( atoi( @Currency$ ) ) != "null" ) delitem atoi( @Currency$ ),@TotalCost; else{ set getd( @Currency$ ),getd( @Currency$ ) - @TotalCost; } for(set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1) getitem @bought_nameid[@i],@bought_quantity[@i]; message strcharinfo(0),"Purchased "+getarraysize( @bought_nameid )+" Items."; mes "Thank you for purchasing!."; } } ClearData(); close; } Anyone? UP Quote Link to comment Share on other sites More sharing options...
Luciar Posted January 28, 2015 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 177 Reputation: 21 Joined: 01/31/12 Last Seen: March 8, 2020 Share Posted January 28, 2015 // Awesomazing Coin Rewards - shop Emistry_Shop1 -1,512:100 turbo_room,123,97,4 script Donation Rewards 829,{ function ShopSettings; function ValidateCost; function CurrencyInfo; function ClearData; function ValueConvert; function ErrorNotice; mes "[ RO2K15 Coin Rewards]"; mes "^d21838PODs^000000 can be traded here."; mes "You can obtain PODs from:"; mes "1. Donation"; mes "2. Lotti Girl"; mes "3. GM Held Events"; mes "4. Facebook Contest"; next; // Menu Selection select("Headgear","Mid Headgear","Lower Headgear","Consumables & ETC"); ClearData(); ShopSettings( @menu ); npcshopitem "Emistry_Shop1",512,100; npcshopdelitem "Emistry_Shop1",512; for(set .@i,0; .@i < getarraysize( @ItemLists ); set .@i,.@i+1) npcshopadditem "Emistry_Shop1",@ItemLists[.@i],@ItemCost[.@i]; CurrencyInfo( @Currency$ ); callshop "Emistry_Shop1",1; npcshopattach "Emistry_Shop1"; end; function ShopSettings { switch( getarg(0) ){ Case 1: // Currency [ Item ID / Variable Name ] set @Currency$,"7179"; // Item ID Lists setarray @ItemLists[0],5375,5376,5396,5498,5420,5383,5481,5423,5564,5399,5374,5518,5805,5452; // Item Price setarray @ItemCost[0],5,5,5,5,5,5,5,7,7,10,10,10,12,15; break; Case 2: // Currency [ Item ID / Variable Name ] set @Currency$,"7179"; // Item ID Lists setarray @ItemLists[0],5421,5325,5800,5389,5664,5471,5402; // Item Price setarray @ItemCost[0],5,5,5,5,5,5,5; break; Case 3: // Currency [ Item ID / Variable Name ] set @Currency$,"7179"; // Item ID Lists setarray @ItemLists[0],5532,5462,5155,5377,5521; // Item Price setarray @ItemCost[0],3,6,8,9,15; break; Case 4: // Currency [ Item ID / Variable Name ] set @Currency$,"7179"; // Item ID Lists setarray @ItemLists[0],7776,7619,7620; // Item Price setarray @ItemCost[0],1,1,1; break; // Case 4,5,6.....etc... default: ErrorNotice( "Invalid Menu Selection for Menu "+@menu+"." ); close; } if( @Currency$ == "" ) ErrorNotice( "Invalid Currency Setting in Menu "+@menu+" ." ); if( getarraysize( @ItemCost ) != getarraysize( @ItemLists ) || getarraysize( @ItemLists ) != getarraysize( @ItemCost ) ) ErrorNotice( "Missing or Extra Value of Item or Cost Settings in Menu "+@menu+" ." ); return; } function ErrorNotice { mes "^FF0000ERROR^000000 - "+getarg(0); mes "^00FF00____________________________^000000"; mes "Inform this Message to ^0000FFGame Staffs^000000 immediately !"; close; } function CurrencyInfo { if( getitemname( atoi( getarg(0) ) ) != "null" ){ mes "Item Currency : ^FF0000"+getitemname( atoi( getarg(0) ) )+"^000000"; mes "Available Amount : ^0000FF"+ValueConvert( countitem( atoi( getarg(0) ) ) )+"^000000"; }else if( getitemname( atoi( getarg(0) ) ) == "null" ){ mes "Variable Currency : ^FF0000"+getarg(0)+"^000000"; mes "Available Amount : ^0000FF"+ValueConvert( getd( getarg(0) ) )+"^000000"; } return; } function ValidateCost { if( getitemname( atoi( getarg(0) ) ) != "null" ){ if( countitem( atoi( getarg(0) ) ) < getarg(1) ) return 1; }else{ if( getd( getarg(0) ) < getarg(1) ) return 1; } return 0; } function ClearData { set @Currency$,""; set @TotalCost,0; deletearray @bought_nameid[0],getarraysize( @bought_nameid ); deletearray @bought_quantity[0],getarraysize( @bought_quantity ); deletearray @ItemLists[0],getarraysize( @ItemLists ); deletearray @ItemCost[0],getarraysize( @ItemCost ); return; } function ValueConvert { set .@num, atoi(""+getarg(0)); if ( .@num == 0 || .@num >= 2147483647 ) return getarg(0); set .@l, getstrlen(""+.@num); for ( set .@i,0; .@i < .@l; set .@i, .@i + 1 ) { set .@num$, .@num % pow(10,.@i+1) / pow(10,.@i) + .@num$; if ( (.@i+1) % 3 == 0 && .@i+1 != .@l ) set .@num$, ","+ .@num$; } return .@num$; } OnBuyItem: ShopSettings( @menu ); for(set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1) for(set @j,0; @j < getarraysize( @ItemLists ); set @j,@j+1) if( @ItemLists[@j] == @bought_nameid[@i] ) set @TotalCost,@TotalCost + ( @ItemCost[@j] * @bought_quantity[@i] ); for( set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1 ) mes "Reward : "+@bought_quantity[@i]+" "+getitemname( @bought_nameid[@i] )+""; mes "-----------------------------------"; if( getitemname( atoi( @Currency$ ) ) != "null" ) mes "Total Cost : "+ValueConvert( @TotalCost )+" "+getitemname( atoi( @Currency$ ) )+""; else if( getitemname( atoi( @Currency$ ) ) == "null" ){ mes "Total Cost : "+ValueConvert( @TotalCost )+" "+@Currency$+""; } if( ValidateCost( @Currency$,@TotalCost ) ){ if( getitemname( atoi( @Currency$ ) ) != "null" ) mes " Insufficient "+getitemname( atoi( @Currency$ ) )+""; else{ mes "[^00FF00Insufficient^000000"+@Currency$+""; } }else{ if( select( "^0000FFPurchase^000000:Cancel" ) == 1 ){ if( getitemname( atoi( @Currency$ ) ) != "null" ) delitem atoi( @Currency$ ),@TotalCost; else{ set getd( @Currency$ ),getd( @Currency$ ) - @TotalCost; } for(set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1) getitem @bought_nameid[@i],@bought_quantity[@i]; announce "Player "+ strcharinfo(0) +" has purchased "+ @bought_quantity[@i] +" "+ getitemname(@bought_nameid[@i]),bc_all; message strcharinfo(0),"Purchased "+getarraysize( @bought_nameid )+" Items."; mes "Thank you for purchasing!."; } } ClearData(); close; }Try that Quote Link to comment Share on other sites More sharing options...
awesomazingxed Posted January 28, 2015 Group: Members Topic Count: 51 Topics Per Day: 0.01 Content Count: 95 Reputation: 1 Joined: 10/24/14 Last Seen: August 7, 2015 Author Share Posted January 28, 2015 // Awesomazing Coin Rewards - shop Emistry_Shop1 -1,512:100 turbo_room,123,97,4 script Donation Rewards 829,{ function ShopSettings; function ValidateCost; function CurrencyInfo; function ClearData; function ValueConvert; function ErrorNotice; mes "[ RO2K15 Coin Rewards]"; mes "^d21838PODs^000000 can be traded here."; mes "You can obtain PODs from:"; mes "1. Donation"; mes "2. Lotti Girl"; mes "3. GM Held Events"; mes "4. Facebook Contest"; next; // Menu Selection select("Headgear","Mid Headgear","Lower Headgear","Consumables & ETC"); ClearData(); ShopSettings( @menu ); npcshopitem "Emistry_Shop1",512,100; npcshopdelitem "Emistry_Shop1",512; for(set .@i,0; .@i < getarraysize( @ItemLists ); set .@i,.@i+1) npcshopadditem "Emistry_Shop1",@ItemLists[.@i],@ItemCost[.@i]; CurrencyInfo( @Currency$ ); callshop "Emistry_Shop1",1; npcshopattach "Emistry_Shop1"; end; function ShopSettings { switch( getarg(0) ){ Case 1: // Currency [ Item ID / Variable Name ] set @Currency$,"7179"; // Item ID Lists setarray @ItemLists[0],5375,5376,5396,5498,5420,5383,5481,5423,5564,5399,5374,5518,5805,5452; // Item Price setarray @ItemCost[0],5,5,5,5,5,5,5,7,7,10,10,10,12,15; break; Case 2: // Currency [ Item ID / Variable Name ] set @Currency$,"7179"; // Item ID Lists setarray @ItemLists[0],5421,5325,5800,5389,5664,5471,5402; // Item Price setarray @ItemCost[0],5,5,5,5,5,5,5; break; Case 3: // Currency [ Item ID / Variable Name ] set @Currency$,"7179"; // Item ID Lists setarray @ItemLists[0],5532,5462,5155,5377,5521; // Item Price setarray @ItemCost[0],3,6,8,9,15; break; Case 4: // Currency [ Item ID / Variable Name ] set @Currency$,"7179"; // Item ID Lists setarray @ItemLists[0],7776,7619,7620; // Item Price setarray @ItemCost[0],1,1,1; break; // Case 4,5,6.....etc... default: ErrorNotice( "Invalid Menu Selection for Menu "+@menu+"." ); close; } if( @Currency$ == "" ) ErrorNotice( "Invalid Currency Setting in Menu "+@menu+" ." ); if( getarraysize( @ItemCost ) != getarraysize( @ItemLists ) || getarraysize( @ItemLists ) != getarraysize( @ItemCost ) ) ErrorNotice( "Missing or Extra Value of Item or Cost Settings in Menu "+@menu+" ." ); return; } function ErrorNotice { mes "^FF0000ERROR^000000 - "+getarg(0); mes "^00FF00____________________________^000000"; mes "Inform this Message to ^0000FFGame Staffs^000000 immediately !"; close; } function CurrencyInfo { if( getitemname( atoi( getarg(0) ) ) != "null" ){ mes "Item Currency : ^FF0000"+getitemname( atoi( getarg(0) ) )+"^000000"; mes "Available Amount : ^0000FF"+ValueConvert( countitem( atoi( getarg(0) ) ) )+"^000000"; }else if( getitemname( atoi( getarg(0) ) ) == "null" ){ mes "Variable Currency : ^FF0000"+getarg(0)+"^000000"; mes "Available Amount : ^0000FF"+ValueConvert( getd( getarg(0) ) )+"^000000"; } return; } function ValidateCost { if( getitemname( atoi( getarg(0) ) ) != "null" ){ if( countitem( atoi( getarg(0) ) ) < getarg(1) ) return 1; }else{ if( getd( getarg(0) ) < getarg(1) ) return 1; } return 0; } function ClearData { set @Currency$,""; set @TotalCost,0; deletearray @bought_nameid[0],getarraysize( @bought_nameid ); deletearray @bought_quantity[0],getarraysize( @bought_quantity ); deletearray @ItemLists[0],getarraysize( @ItemLists ); deletearray @ItemCost[0],getarraysize( @ItemCost ); return; } function ValueConvert { set .@num, atoi(""+getarg(0)); if ( .@num == 0 || .@num >= 2147483647 ) return getarg(0); set .@l, getstrlen(""+.@num); for ( set .@i,0; .@i < .@l; set .@i, .@i + 1 ) { set .@num$, .@num % pow(10,.@i+1) / pow(10,.@i) + .@num$; if ( (.@i+1) % 3 == 0 && .@i+1 != .@l ) set .@num$, ","+ .@num$; } return .@num$; } OnBuyItem: ShopSettings( @menu ); for(set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1) for(set @j,0; @j < getarraysize( @ItemLists ); set @j,@j+1) if( @ItemLists[@j] == @bought_nameid[@i] ) set @TotalCost,@TotalCost + ( @ItemCost[@j] * @bought_quantity[@i] ); for( set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1 ) mes "Reward : "+@bought_quantity[@i]+" "+getitemname( @bought_nameid[@i] )+""; mes "-----------------------------------"; if( getitemname( atoi( @Currency$ ) ) != "null" ) mes "Total Cost : "+ValueConvert( @TotalCost )+" "+getitemname( atoi( @Currency$ ) )+""; else if( getitemname( atoi( @Currency$ ) ) == "null" ){ mes "Total Cost : "+ValueConvert( @TotalCost )+" "+@Currency$+""; } if( ValidateCost( @Currency$,@TotalCost ) ){ if( getitemname( atoi( @Currency$ ) ) != "null" ) mes " Insufficient "+getitemname( atoi( @Currency$ ) )+""; else{ mes "[^00FF00Insufficient^000000"+@Currency$+""; } }else{ if( select( "^0000FFPurchase^000000:Cancel" ) == 1 ){ if( getitemname( atoi( @Currency$ ) ) != "null" ) delitem atoi( @Currency$ ),@TotalCost; else{ set getd( @Currency$ ),getd( @Currency$ ) - @TotalCost; } for(set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1) getitem @bought_nameid[@i],@bought_quantity[@i]; announce "Player "+ strcharinfo(0) +" has purchased "+ @bought_quantity[@i] +" "+ getitemname(@bought_nameid[@i]),bc_all; message strcharinfo(0),"Purchased "+getarraysize( @bought_nameid )+" Items."; mes "Thank you for purchasing!."; } } ClearData(); close; }Try that Hello Luciar, it works but it says Player "name" has purchased 0 null How to fix this? Quote Link to comment Share on other sites More sharing options...
Question
awesomazingxed
Halo rathena. Can someone edit this script. If a player bought any items in my donation, it will announce globally. Thanks.
Anyone? UP
Link to comment
Share on other sites
2 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.