wallaby
New member
- Messages
- 78
- Points
- 0
Heya guys, I'm using this script by Annie? What happened is that, the stylist reads from my offline server fine... but when it's online, it doesn't... I don't know what seems to be the matter tho... can anyone help? Thanks for looking!
Code:
// credits to Annieruru
function script 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$;
}
- script Stylist -1,{
OnTalk:
mes "^0055FF[ Stylist ]^000000";
mes "I can change your appearance.";
next;
if( .cost_size ){
mes " ";
mes "^777777[ SERVICES PAYMENT ]^000000";
for( .@i = 0; .@i < .menu_size; .@i++ )
if( .npc_mode & ( 1 << .@i ) )
if( .cost[.@i] )
mes "^0055FF"+.menu_name$[.@i]+" : ^777777"+ValueConvert( .cost[.@i] )+" "+.currency_name$[.@i]+"^000000";
else
mes "^0055FF"+.menu_name$[.@i]+" : ^777777Free of Charge^000000";
}
next;
@style = ( select( .npc_menu$ ) - 1 );
@style_value = getlook( .look_type[@style] );
deletearray .@blacklist;
switch( @style ){
case 0: .@blacklist$ = ","+getd( ".blacklist_hairstyle_"+Sex+"$" )+","; break;
case 1: .@blacklist$ = ","+getd( ".blacklist_haircolor_"+Sex+"$" )+","; break;
case 2: if((Class > 4212) || (Class > 4215) || (Class > 4217) || (Class > 4218) || (Class > 4219) || (Class > 4220) || (Class > 4221) || (Class > 4222) || (Class > 4223) || (Class > 4224) || (Class > 4225) || (Class > 4226) || (Class > 4227) || (Class > 4228) || (Class > 4229) || (Class > 4230) || (Class > 4231) || (Class > 4232) || (Class > 4233) || (Class > 4234) || (Class > 4235) || (Class > 4236) || (Class > 4237) || (Class > 4238) || (Class > 4239) || (Class > 4240) || (Class > 4241) || (Class > 4242) || (Class > 4243) || (Class > 4244)){
mes "^0055FF[ Stylist ]^000000";
mes "Sorry, I cannot help you right now.";
close;
} else{
.@blacklist$ = ","+getd( ".blacklist_cloth_"+Sex+"$" )+","; break;
}
default: break;
}
.@style_number = .min_style[@style];
addtimer 1000,strnpcinfo(0)+"::OnPCLogoutEvent";
do{
next;
message strcharinfo(0),.menu_name$[@style]+" : "+.@style_number+"th";
.@removed = 0;
if( compare( .@blacklist$,","+.@style_number+"," ) ){
message strcharinfo(0),"[ REMOVED ] "+.menu_name$[@style]+" : "+.@style_number+"th";
.@removed = 1;
// setlook .look_type[@style],.min_style[@style];
}else{
setlook .look_type[@style],.@style_number;
}
.@next = .@style_number + 1;
.@prev = .@style_number - 1;
if( .@next > .max_style[@style] ) .@next = .min_style[@style];
if( .@prev < .min_style[@style] ) .@prev = .max_style[@style];
@select = prompt( (( .@backward )?"Backward":"Forward" )+" - [ ^777777"+(( .@backward )? .@prev:.@next )+"th Style^000000 ]",
(( !.@backward )?"Backward":"Forward" )+" - [ ^777777"+(( !.@backward )? .@prev:.@next )+"th Style^000000 ]",
"Jump to a Style",
( .@removed )?"":"^0055FFOkay, I want this "+.menu_name$[@style]+"^000000" );
if( @select == 2 ) .@backward = !.@backward;
switch( @select ){
case 1:
case 2:
.@style_number = (( .@backward )? .@prev:.@next );
break;
case 3:
message strcharinfo(0),"Available Style : "+.min_style[@style]+" ~ "+.max_style[@style]+".";
input .@style_number,.min_style[@style],.max_style[@style];
break;
case 4:
.@atoi_currency = atoi( .currency$[@style] );
if( @style_value == .@style_number ){
message strcharinfo(0),"Swt..that is your original hairstyles.";
break;
} else if( .@atoi_currency ){
if( countitem( .@atoi_currency ) >= .cost[@style] ){
.@success = 1;
delitem .@atoi_currency,.cost[@style];
}
}else{
if( getd( ""+.currency$[@style] ) >= .cost[@style] ){
.@success = 1;
setd( ""+.currency$[@style] ),( getd( ""+.currency$[@style] ) - .cost[@style] );
}
}
if( .@success ){
message strcharinfo(0),"Enjoy your NEW "+.menu_name$[@style]+" !!";
@style_value = .@style_number;
close2;
}else{
mes "You dont have enough "+.currency_name$[@style]+" to change this "+.menu_name$[@style]+".";
mes "Cost : ^777777"+ValueConvert( .cost[@style] )+" "+.currency_name$[@style]+"^000000";
close2;
}
default:
setlook .look_type[@style],@style_value;
break;
}
}while( @select != 4 && @select != 255 );
deltimer strnpcinfo(0)+"::OnPCLogoutEvent";
@select = 0;
end;
OnPCLogoutEvent:
if( @select )
setlook .look_type[@style],@style_value;
end;
OnInit:
// NPC Mode ( Bitmask )
// 1 - Enable Hairstyle
// 2 - Enable Hair Color
// 4 - Enable Cloth Color
.npc_mode = 7;
// Menu Name
setarray .menu_name$,
"Hair Style",
"Hair Color",
"Cloth Color";
// Payment Currency + Cost
// Can be ITEM ID or Any Variable.
setarray .currency$,
"0", // Hairstyle - Ex. need Apple
"0", // Hair Color - Ex. need CASHPOINTS
"0"; // Cloth Color - Ex. need Zeny
setarray .cost,
0, // Hairstyle ( 123 Apple )
0, // Hair Color ( 5,432 CASHPOINTS )
0; // Cloth Color ( 12,345 Zeny )
// Blacklisted Style for each style and each gender.
// --- Female ---
.blacklist_hairstyle_0$ = "0";
.blacklist_haircolor_0$ = "0";
.blacklist_cloth_0$ = "0";
// --- Male ---
.blacklist_hairstyle_1$ = "0";
.blacklist_haircolor_1$ = "0";
.blacklist_cloth_1$ = "0";
// Dont edit
setarray .min_style,getbattleflag( "min_hair_style" ),getbattleflag( "min_hair_color" ),getbattleflag( "min_cloth_color" );
setarray .max_style,getbattleflag( "max_hair_style" ),getbattleflag( "max_hair_color" ),getbattleflag( "max_cloth_color" );
.menu_size = getarraysize( .menu_name$ );
.cost_size = getarraysize( .cost );
setarray .look_type,LOOK_HAIR,LOOK_HAIR_COLOR,LOOK_CLOTHES_COLOR;
for( .npc_menu$ = ""; .@i < .menu_size; .@i++ )
.npc_menu$ = .npc_menu$ + ( ( .npc_mode & ( 1 << .@i ) )? .menu_name$[.@i]:"" ) +":";
for( .@i = 0; .@i < .cost_size; .@i++ ){
.@atoi = atoi( .currency$[.@i] );
.currency_name$[.@i] = ( ( !.@atoi || getitemname( .@atoi ) == "null" )? .currency$[.@i]:getitemname( .@atoi ) );
}
end;
}
// NPC Lists
prontera,164,186,3 script Stylist#main 122,{
doevent "Stylist::OnTalk";
}
//prontera,115,181,5 duplicate(Adv. Stylist#main) Adv. Stylist#1 878
//prontera,115,181,5 duplicate(Adv. Stylist#main) Adv. Stylist#2 878
//prontera,115,181,5 duplicate(Adv. Stylist#main) Adv. Stylist#3 878