if(Goldpc_Points < .@cost) {
mes "[Goldpoint Manager]";
mes "You have ^0000ff"+Goldpc_Points+"^000000 points remaining.";
mes "You cannot get the prize with this amount of points.";
close;
}
mes "[Goldpoint Manager]";
mes "You chose the "+.@cost+" points gift. We will reward you immediately.";
Goldpc_Points -= .@cost;
getitem .@itemid,.@amount;
mes "You have ^0000ff"+Goldpc_Points+"^000000 points remaining.";
close;
}
Note: I don't know C++ (if this is the language we're using here) but I do know javascript because of my job which helps me manage somehow (they're almost the same LOL which surprised me, there's just a lot of difference when it comes to syntax)
Question
imat1
Hello guys. Please help me confirm if what I changed from my script could cause any harm or bug/exploit to my server.
Here's the raw NPC script from Initial implementation of the goldpc timer
prontera,0,0,0 script Goldpoint Manager::GOLDPCCAFE 4_F_02,{
// ID:AMOUNT:PRICE
setarray .items$[1],
"25464:1:2", // World_Tour_Ticket 1
"23919:1:10", // K_Secret_Key 1
"23919:11:100",// K_Secret_Key 11
"23919:33:300";// K_Secret_Key 33
mes "[Goldpoint Manager]";
mes "You currently have ^0000ff"+Goldpc_Points+"^000000 points.";
mes "What reward do you want?";
next;
.@menu$ = "View current points";
for(.@i = 1; .@i < getarraysize(.items$); .@i++) {
explode(.@array$, .items$[.@i], ":");
.@cost = atoi(.@array$[2]);
.@menu$ += ":" + .@cost + " points gift";
if( Goldpc_Points < .@cost ){
.@menu$ += " ^ff0000(not enough points)^000000";
}
}
.@s = select(.@menu$)-1;
if(.@s == 0) {
mes "[Goldpoint Manager]";
mes "You currently have ^0000ff"+Goldpc_Points+"^000000 points.";
close;
}
explode(.@array$, .items$[.@s], ":");
.@itemid = atoi(.@array$[0]);
.@amount = atoi(.@array$[1]);
.@cost = atoi(.@array$[2]);
if(Goldpc_Points < .@cost) {
mes "[Goldpoint Manager]";
mes "You have ^0000ff"+Goldpc_Points+"^000000 points remaining.";
mes "You cannot get the prize with this amount of points.";
close;
}
mes "[Goldpoint Manager]";
mes "You chose the "+.@cost+" points gift. We will reward you immediately.";
Goldpc_Points -= .@cost;
getitem .@itemid,.@amount;
mes "You have ^0000ff"+Goldpc_Points+"^000000 points remaining.";
close;
}
Here's what i did.
- shop hourly_shop -1,13534:-1.
prontera,0,0,5 script Hourly Point Manager::GOLDPCCAFE 10380,{
cutin "ep18_merchant.png",2;
callshop "hourly_shop",1;
npcshopattach "hourly_shop";
end;
OnBuyItem:
for (.@i = 0; .@i < getarraysize(@bought_nameid); .@i++){
.@j = inarray(.Shop, @bought_nameid[.@i]);
.@cost += (.Shop[.@j+1] * @bought_quantity[.@i]);
}
mes "[Hourly Point Manager]";
if (.@cost > Goldpc_Points)
mes "You don't have enough Hourly Points.";
else {
for (.@i = 0; .@i < getarraysize(@bought_nameid); .@i++) {
getitem @bought_nameid[.@i], @bought_quantity[.@i];
dispbottom "Purchased " + @bought_quantity[.@i] + "x " + getitemname(@bought_nameid[.@i]) + ".";
}
Goldpc_Points -= .@cost;
mes "Purchased successfully!";
mes "You have ^0000ff"+Goldpc_Points+"^000000 points remaining.";
}
deletearray @bought_quantity, getarraysize(@bought_quantity);
deletearray @bought_nameid, getarraysize(@bought_nameid);
close;
OnInit:
setarray .Shop[0],13534,1,13810,1,14532,1,14606,1,12211,1,7776,25;
npcshopitem "hourly_shop", 13534,1,13810,1,14532,1,14606,1,12211,1,7776,25;
end;
}
It's working fine as I have tested. But I don't trust myself.
Also I refer a lot from rathena's hunting missions.
I'm open for suggestions. Thanks in advance!
Note: I don't know C++ (if this is the language we're using here) but I do know javascript because of my job which helps me manage somehow (they're almost the same LOL which surprised me, there's just a lot of difference when it comes to syntax)
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.