viewing paste Unknown #19346 | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
// Vote Points Exchanger by Myzter
function    script  VoteExchange    {
    set .@CurrVotePoints, callfunc("getVotePoints");
    mes "[^0000ff" + getarg(0) + "^000000]";
    mes "Hello ^0000ff" + strcharinfo(0) + "^000000, i'm " + getarg(0) + ".";
    mes "I'm offering ^ff0000" + getarg(1) + "^000000 ^0000ff" + getitemname(getarg(2)) + (getarg(1)>1?"'s":"") + "^000000 for every ^ff0000" + getarg(3) + "^000000 Vote Point" + (getarg(3)>1?"s":"") + " you pay.";
    if (.@CurrVotePoints < getarg(3)) {
        mes " ";
        mes "Vote for us and win Vote Points!";
        close;
    }
 
    // Maximum quantity by Points
    set .@MaxQtt, .@CurrVotePoints / getarg(3);
 
    // Maximum quantity by Weight
    while (!checkweight(getarg(2),.@MaxQtt * getarg(1)) && .@MaxQtt > 0) {
        set .@MaxQtt, .@MaxQtt - 1;
    };
 
    if (!.@MaxQtt) {
        mes "Please free some space and back back later.";
        close;
    }
 
    mes " ";
    mes "Are you interested?";
    next;
 
    if (select("Yes, please!:Maybe later " + getarg(0) + ".") == 2) goto l_Exit;
 
    // Limit the trades to 50 options each time
    if (.@MaxQtt > 50) set .@MaxQtt,50;
    
    mes "[^0000ff" + getarg(0) + "^000000]";
    if (.@MaxQtt > 1) {
        mes "How many ^0000ff" + getitemname(getarg(2)) + (getarg(1)>1?"'s":"") + "^000000 you want to trade?";
        mes " ";
        mes "^ff0000" + getarg(1) + "^000000 ^0000ff" + getitemname(getarg(2)) + (getarg(1)>1?"'s":"") + "^000000 x ^ff0000" + getarg(3) + "^000000 Vote Point" + (getarg(3)>1?"s":"") + " ^c0c0c0(" + .@CurrVotePoints + " VP)";
        next;
        set .@Menu$, "";
        for (set .@x,1; .@x <= .@MaxQtt; set .@x, .@x + 1) {
            set .@Menu$, .@Menu$ + "- " + (.@x * getarg(1)) + " " + getitemname(getarg(2)) + (.@x>1?"'s":"") + " (" + (.@x * getarg(3)) + " VP):";
        }
        set .@Menu$, .@Menu$ + ":^ff0000Cancel^000000";
        set .@SelOpt, select(.@Menu$);
        if (.@SelOpt == .@x + 1) goto l_Exit;
 
        set .@SelQtt, .@SelOpt * getarg(1);
        mes "[^0000ff" + getarg(0) + "^000000]";
    } else {
        set .@SelQtt, getarg(1);
    }
 
    set .@SelPay, .@SelQtt / getarg(1) * getarg(3);
 
    mes "Are you sure you want to trade ^ff0000" + .@SelQtt + " ^0000ff" + getitemname(getarg(2)) + (getarg(1)>1?"'s":"") + "^000000 for ^ff0000" + .@SelPay + "^000000 Vote Point" + (getarg(3)>1?"s?":"?");
    next;
    if (select("Yes, please","No, thanks") == 2) goto l_Exit;
 
    mes "[^0000ff" + getarg(0) + "^000000]";
    if (.@CurrVotePoints < .@SelPay) {
        mes "Something is wrong, you don't have enought Vote Points, are you trying to cheat?";
        close;
    }
 
    getitem getarg(2),.@SelQtt;
    set .@CurrVotePoints, .@CurrVotePoints - .@SelPay;
    callfunc "usePoints",.@SelPay;
 
    mes "Thank you very much for the deal, I'd love to see you again ^0000ff" + strcharinfo(0) + "^000000.";
    mes " ";
    mes "> Your Balance: ^ff0000" + .@CurrVotePoints + "^000000 ^0000ffVote Point" + (.@CurrVotePoints==1?"":"s") + "^000000";
    mes " ";
    mes "~ ^0080FFDo not forget to vote for us~ ";
    close;
 
l_Exit:
    mes "[^0000ff" + getarg(0) + "^000000]";
    mes "As you want, i hope to see you again ^0000ff" + strcharinfo(0) + "^000000.";
    mes " ";
    mes "~ ^0080FFDo not forget to vote for us~ la la ~";
    close;
}
 
// Retrieve the Vote Points: For use with FluxCP Addon: Vote For Points 1.2 by JayPee Mateo
function    script  getVotePoints   {
    if (query_sql("select sum(`points`) from `cp_v4p_voters` where account_id=" + getcharid(3),.@points)) return .@points[0];
    return 0;
}
// Discount Vote Points: For use with FluxCP Addon: Vote For Points 1.2 by JayPee Mateo
function    script  usePoints   {
    query_sql "update `cp_v4p_voters` set points=points-" + getarg(0) + " where account_id=" + getcharid(3);
    return;
}
 
// The function use this parameters:
// 0 -> NPC Name, don't change it because is using the name you set in the NPC
// 1 -> Quantity of Items to exchange
// 2 -> Item ID to exchange
// 3 -> Amount of Vote Points to Pay for that amount of items
 
 
// This NPC change 1 Poring Coint for 1 Vote Point
prontera,165,173,5  script  V4P#002 437,{
    callfunc "VoteExchange",strnpcinfo(1),1,7539,1;
}
Viewed 610 times, submitted by Guest.