Jump to content
  • 0
madtoyz

Change Cash Point by Happ5 become unlimited exchange

Question

How to make this script can exchange any ammount player want.

100 poring coin = 30 cashpoint.

//===== eAthena Script =======================================//= Cash Point Exchanger//===== By: ==================================================//= Happ5//===== Current Version: =====================================//= v1//===== Description: =========================================//= exchange coins into point//============================================================izlude,160,149,4	script	Point Exchanger	714,{	mes "[Point Exchanger]";  	mes "Hi there..i can exchange Poring Coins into points?!"; 	next; 	menu "500 Poring Coins to 10 Point",-, "1000 Poring Coins to 30 Point",L_Bl,"Cancel",L_Cancel;	mes "[Point Exchanger]";	mes "Good good, let me just check"; 	next;	if(countitem(7539)<500) goto L_NoMake; 	delitem 7539,500;	mes "[Point Exchanger]";	mes "wait a second.....";	next;	set #CASHPOINTS, #CASHPOINTS+10;	mes "[Point Exchanger]";	mes "Total  " + #CASHPOINTS + " Cash Points.";	close;L_NoMake:	mes "[Point Exchanger]";	mes "You don't have enough gold coins to exchange..";	close;L_Bl: 	mes "[Point Exchanger]";	mes "Good good, let me just check"; 	next;	if(countitem(7539)<1000) goto L_NoMake; 	delitem 7539,1000;	mes "[Point Exchanger]";	mes "Give me a second.....";	next;	set #CASHPOINTS, #CASHPOINTS+30;	mes "[Point Exchanger]";	mes "You now have " + #CASHPOINTS + " Cash Points.";	close;L_Leave:	mes "[Point Exchanger]";	mes "Maybe another time?";	close;L_Cancel:	mes "[Point Exchanger]";	mes "Aw, what a shame";	close;}

 

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Here's my method.

 

 

izlude,160,149,4    script    Point Exchanger::point_x    714,{    mes .name$;      mes "Hello there, "+ strcharinfo(0) +"!";    mes "I can exchange your "+ getitemname(.item_id) +" for "+ .x_rate +" Points each!";    next;        // End the session if player chooses to    if (select("Exchange "+ getitemname(.item_id) +":^FF0000End session^000000") == 2)    {        mes .name$;        mes "Aw, what a shame! See you later, then!";        close;    }        mes .name$;    mes "Please input the amount of coins you would like to exchange. Remember, 1 "+ getitemname(.item_id) +" is equivalent to "+ .x_rate +" Points!";    next;        input .@amount;    // Input coin amount to be exchanged        // User does not have specified amount of coins    if (countitem(.item_id) < .@amount)    {        mes .name$;        mes "I'm sorry, but you do not have "+ .@amount +" "+ getitemname(.item_id) +" in your inventory! You currently have "+ countitem(.item_id) +".";        close;    }        delitem .item_id, .@amount;            // Delete specified amount of coins    .@exchange = .@amount * .x_rate;    // Calculate amount to be updated    #CASHPOINTS += .@exchange;            // Update points        mes .name$;    mes "The transaction was successful! You traded "+ .@amount +" "+ getitemname(.item_id) +" for "+ .@exchange +" Points! You now have "+ #CASHPOINTS +" Points.";    close;            OnWhisperGlobal:        // Whisper anything to initialize settings        message strcharinfo(0), strnpcinfo(1) +" : 'OnInit' label has been intialized.";        OnInit:        // Configuration        .name$ = "[^0000FFPoint Exchanger^000000]";    // NPC name        .item_id = 7539;    // Item ID of coin to exchange        .x_rate = 30;        // Exchange rate (1 coin for x points)        end;    }

 

It's commented in a way that explains how the script progresses. If you load this into a live server, whisper anything to npc:point_x to initialize its settings.

Share this post


Link to post
Share on other sites
  • 0

Here's my method.

 

 

izlude,160,149,4    script    Point Exchanger::point_x    714,{    mes .name$;      mes "Hello there, "+ strcharinfo(0) +"!";    mes "I can exchange your "+ getitemname(.item_id) +" for "+ .x_rate +" Points each!";    next;        // End the session if player chooses to    if (select("Exchange "+ getitemname(.item_id) +":^FF0000End session^000000") == 2)    {        mes .name$;        mes "Aw, what a shame! See you later, then!";        close;    }        mes .name$;    mes "Please input the amount of coins you would like to exchange. Remember, 1 "+ getitemname(.item_id) +" is equivalent to "+ .x_rate +" Points!";    next;        input .@amount;    // Input coin amount to be exchanged        // User does not have specified amount of coins    if (countitem(.item_id) < .@amount)    {        mes .name$;        mes "I'm sorry, but you do not have "+ .@amount +" "+ getitemname(.item_id) +" in your inventory! You currently have "+ countitem(.item_id) +".";        close;    }        delitem .item_id, .@amount;            // Delete specified amount of coins    .@exchange = .@amount * .x_rate;    // Calculate amount to be updated    #CASHPOINTS += .@exchange;            // Update points        mes .name$;    mes "The transaction was successful! You traded "+ .@amount +" "+ getitemname(.item_id) +" for "+ .@exchange +" Points! You now have "+ #CASHPOINTS +" Points.";    close;            OnWhisperGlobal:        // Whisper anything to initialize settings        message strcharinfo(0), strnpcinfo(1) +" : 'OnInit' label has been intialized.";        OnInit:        // Configuration        .name$ = "[^0000FFPoint Exchanger^000000]";    // NPC name        .item_id = 7539;    // Item ID of coin to exchange        .x_rate = 30;        // Exchange rate (1 coin for x points)        end;    }

 

It's commented in a way that explains how the script progresses. If you load this into a live server, whisper anything to npc:point_x to initialize its settings.

 

Missing function

 

missingfunc_zps13ceb677.jpg

Share this post


Link to post
Share on other sites
  • 0

Missing function

 

missingfunc_zps13ceb677.jpg

 

o.O;

 

Are you not using Hercules? It seems to be erroring at the variable declarations. Here's an adapted version that uses the set command for variable declarations.

 

 

izlude,160,149,4    script    Point Exchanger::point_x    714,{    mes .name$;      mes "Hello there, "+ strcharinfo(0) +"!";    mes "I can exchange your "+ getitemname(.item_id) +" for "+ .x_rate +" Points each!";    next;        // End the session if player chooses to    if (select("Exchange "+ getitemname(.item_id) +":^FF0000End session^000000") == 2)    {        mes .name$;        mes "Aw, what a shame! See you later, then!";        close;    }        mes .name$;    mes "Please input the amount of coins you would like to exchange. Remember, 1 "+ getitemname(.item_id) +" is equivalent to "+ .x_rate +" Points!";    next;        input .@amount;    // Input coin amount to be exchanged        // User does not have specified amount of coins    if (countitem(.item_id) < .@amount)    {        mes .name$;        mes "I'm sorry, but you do not have "+ .@amount +" "+ getitemname(.item_id) +" in your inventory! You currently have "+ countitem(.item_id) +".";        close;    }        delitem .item_id, .@amount;                    // Delete specified amount of coins    set .@exchange, .@amount * .x_rate;            // Calculate amount to be updated    set #CASHPOINTS, #CASHPOINTS + .@exchange;    // Update points        mes .name$;    mes "The transaction was successful! You traded "+ .@amount +" "+ getitemname(.item_id) +" for "+ .@exchange +" Points! You now have "+ #CASHPOINTS +" Points.";    close;            OnWhisperGlobal:        // Whisper anything to initialize settings        message strcharinfo(0), strnpcinfo(1) +" : 'OnInit' label has been intialized.";        OnInit:        // Configuration        set .name$, "[^0000FFPoint Exchanger^000000]";    // NPC name        set .item_id, 7539;        // Item ID of coin to exchange        set .x_rate, 30;        // Exchange rate (1 coin for x points)        end;    }

Share this post


Link to post
Share on other sites
  • 0

@ Via: BTW OnInit labels are now automatically fired when a NPC is loaded so there's no longer need to whisper to any npc or using the messy if (!.init) donpcevent strnpcinfo(3)+"::OnInit"; and these 'dirty' tricks to make the NPCs start working when they aren't loaded on server start ;).

Share this post


Link to post
Share on other sites
  • 0

 

@ Via: BTW OnInit labels are now automatically fired when a NPC is loaded so there's no longer need to whisper to any npc or using the messy if (!.init) donpcevent strnpcinfo(3)+"::OnInit"; and these 'dirty' tricks to make the NPCs start working when they aren't loaded on server start ;).

Whoa, I wasn't aware of that! I got so used to triggering that label manually lol. That's great that we no longer need to; thanks for the heads up! c:

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.