Jump to content
  • 0

Need a little help here!


zXoOm

Question


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  73
  • Reputation:   2
  • Joined:  12/19/11
  • Last Seen:  

i dont know what is the problem here, i think cash points is not being detected by my npcs or am i using wrong currency?

post-903-0-23433400-1349430053_thumb.jpg

post-903-0-79886700-1349430251_thumb.jpg

Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2350
  • Joined:  10/28/11
  • Last Seen:  

refer both your script.....maybe you are using different variable to store cash points....

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  73
  • Reputation:   2
  • Joined:  12/19/11
  • Last Seen:  

Here are the scripts Emisty.

How to know if i'm using different variable to store cash points?

// Settings :
// - Only required to edit the ShopSetting() Function
//   Notes : You may also add / remove Menu ( If any )
// - Shop Currency can be either ItemID or Variable Name, but must write within Quotation Marks ( "" )
//   Ex. of Variable. -> Zeny , #CASHPOINTS , #KAFRAPOINTS , CustomVariable , #CustomVariable
// - ERROR Message are used to show Invalid Settings in your NPC.

// Leave this alone...
- shop Emistry_Shop -1,512:100

prontera,145,168,5 script Sample 757,{
function ShopSettings;
function ValidateCost;
function CurrencyInfo;
function ClearData;
function ValueConvert;
function ErrorNotice;
mes "Each Shop from the Menu may purchase using ^FF0000Different Currency^000000.";
mes "^00FF00____________________________^000000";
mes "So,Which shop you would like to look at it";
next;
// Menu Selection
select("Shop 1","Shop 2","Shop 3");
ClearData();
ShopSettings( @menu );
npcshopitem "Emistry_Shop",512,100;
npcshopdelitem "Emistry_Shop",512;
for(set .@i,0; .@i < getarraysize( @ItemLists ); set .@i,.@i+1)
npcshopadditem "Emistry_Shop",@ItemLists[.@i],@ItemCost[.@i];
mes "Okay...wait awhile";
mes "^00FF00____________________________^000000";
CurrencyInfo( @Currency$ );
mes "^00FF00____________________________^000000";
callshop "Emistry_Shop",1;
npcshopattach "Emistry_Shop";
end;

function ShopSettings {
switch( getarg(0) ){
 Case 1:
  // Currency [ Item ID / Variable Name ]
  set @Currency$,"7179";
  // Item ID Lists
  setarray @ItemLists[0],6153,7227;
  // Item Price
  setarray @ItemCost[0],100,1;
  break;
 Case 2:
  // Currency [ Item ID / Variable Name ]
  set @Currency$,"7227";
  // Item ID Lists
  setarray @ItemLists[0],2306,2302,2303,2304,2305,2301;
  // Item Price
  setarray @ItemCost[0],2,2,3,4,5,6;
  break;
 Case 3:
  // Currency [ Item ID / Variable Name ]
  set @Currency$,"#CASHPOINTS";
  // Item ID Lists
  setarray @ItemLists[0],2306,2302,2303,2304,2305,2301;
  // Item Price
  setarray @ItemCost[0],20,22,34,445,52,641;
  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] );
mes "^FF0000	   BILLING LIST^000000";
mes "^00FF00____________________________^000000";
for( set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1 )
  mes "^FF0000"+@bought_quantity[@i]+" x ^0000FF"+getitemname( @bought_nameid[@i] )+"^000000";
mes "^00FF00____________________________^000000";
if( getitemname( atoi( @Currency$ ) ) != "null" )
 mes "Total Cost : ^0000FF"+ValueConvert( @TotalCost )+" x "+getitemname( atoi( @Currency$ ) )+"^000000";
else if( getitemname( atoi( @Currency$ ) ) == "null" ){
 mes "Total Cost : ^0000FF"+ValueConvert( @TotalCost )+" "+@Currency$+"^000000";
}

mes "^00FF00____________________________^000000";
if( ValidateCost( @Currency$,@TotalCost ) ){
 if( getitemname( atoi( @Currency$ ) ) != "null" )
  mes "[ ^FF0000X^000000 ] Insufficient ^0000FF"+getitemname( atoi( @Currency$ ) )+"^000000";
 else{
  mes "[ ^FF0000X^000000 ] Insufficient ^0000FF"+@Currency$+"^000000";
 }
}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 shopping.";
 }
}
ClearData();
close;
}

//############################################################
//By:/"/################################################\"\###
//##| |#   #   #	  #   ####	  ###	 ##	###   #| |##
//##\ \#	  ##   ####   ####   #   #   #   #	 ##   #/ /##
//###\__	 ###	  #   ####   #   #   #   #	  #   __/###
//######	  ##   ####   ####   #   #   #   #   #	  ######
//######   #   #	  #	  #	  ###	 ##   ##	 ######
//############################################################			
//############################################################
// Clench your eyes a little to see the message above. like this >.< ... lol
//== Mega Lotto														  
//																		
//#######################################################
//== Edited by Keldon												
//#######################################################
//Mega Lotto--------------------------------------------------------------------------------------------------------
prontera,147,174,5 script Mega Lotto 874,{
waitingroom "MEGA LOTTO",0;
mes "[^FF0000Mega Lotto^000000]";
mes "Wanna put your money where your mouth is?";
mes "I'm thinking of a number between ^0000FF1^000000 and ^0000FF100^000000, can you guess what it is? If you get it right i'll give you ^FF0000"+.jackpot+"^000000 cash points, if you get it wrong i'll take away ^FF000050^000000 cash points from you.";
mes "So, are you up for it?";
menu "Sure",L_oklotto,"Nah...",L_nolotto;
L_oklotto:
if (#cashpoints < 50) goto L_nocash;
next;
mes "[^FF0000Mega Lotto^000000]";
mes "Put a number between 1 and 100";
set @number,rand(1,100);
input @guess;
if (@guess == @number) goto L_winlotto;
if (@guess == 0) goto L_invalidnumber;
if (@guess > 100) goto L_invalidnumber;
next;
mes "[^FF0000Mega Lotto^000000]";
mes "WRONG!!! Ha! Ha! Ha!";
emotion 18;
specialeffect2 585;
set #cashpoints,#cashpoints -50;
mes "You now have ^FF0000"+#cashpoints+"^000000 cash points.";
set .jackpot,.jackpot +500;
announce "Mega Lotto: The winning price for the lotto currently is "+.jackpot+" cash points",0;
close;
L_nolotto:
next;
mes "[^FF0000Mega Lotto^000000]";
mes "Whats the matter? CHICKEN!!";
emotion 18;
close;
L_winlotto:
next;
mes "[^FF0000Mega Lotto^000000]";
mes "Congratulations! You won ^FF0000"+.jackpot+"^000000 cash points!";
emotion 46;
specialeffect2 371;
announce "Mega Lotto: "+strcharinfo(0)+" just won "+.jackpot+" cash points!",0;
set #cashpoints,#cashpoints +.jackpot;
mes "You now have ^FF0000"+#cashpoints+"^000000 cash points.";
set .jackpot,.jackpot +1000;
close;
L_nocash:
next;
mes "[^FF0000Mega Lotto^000000]";
mes "Stop shittin' me you don't even have cash to give me.";
close;
L_invalidnumber:
next;
mes "[^FF0000Mega Lotto^000000]";
mes "The number you gave me is not between ^0000FF1^000000 and ^0000FF100^000000.";
close;
}

Edited by zXoOm
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...