viewing paste Unknown #6597 | Plain 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
mellina,81,51,3 script  Vote For Points 405,{
 
        setarray @vote_item[0],                 7227; // Item ID
        setarray @vote_item_count[0],   1; // Item Count wich will be given
        setarray @vote_cost[0],                 1; // Cost in Vote Points
        set @min_vote, 0; // minimum count on Vote Points to see the Item List
        set @npcname$,"[^ff0000Vote For Points^000000]";
        set .@coinID, 7227; //Coin Item ID
 
        query_sql ("SELECT `points` FROM `cp_v4p_voters` WHERE `account_id` = '"+getcharid(3)+"'", @vote);
 
        mes @npcname$;
        mes "You have ^ff0000"+@vote+"^000000 Vote Points!";
        if( @vote < @min_vote ) {
                mes "^ff0000You will need "+@min_vote+" or more Vote Points to trade them with me!^000000";
                close;
        }
        if (select("Trade my Points!","Cancel~") == 2)
                close;
 
        next;
        mes "[^ff0000List^000000]";
        mes "^0000ffItem^000000 = ^00aa00Cost^000000";
        mes "^0000ff 500 maximum ^000000";
        for( set .@i, 0; .@i < getarraysize(@vote_item); set .@i, .@i + 1 ) {
                mes "^0000ff"+@vote_item_count[.@i]+"x "+getitemname(@vote_item[.@i])+"^000000 = ^00aa00"+@vote_cost[.@i]+"^000000";
                if( .@i < 1 )
                        set .@menu$, getitemname(@vote_item[.@i]);
                else
                        set .@menu$, .@menu$+":"+getitemname(@vote_item[.@i]);
        }
 
        next;
        select(.@menu$);
        set @choice, @menu - 1;
 
        mes @npcname$;
           //checks if player wants to exchange VPs for coin(s)
        if(.@coinID == @vote_item[@choice]){
        //tells the player to put how many coins they want to buy.
        mes "I see you want to buy "+getitemname(.@coinID)+"(s).";
        mes "Please enter a value for how many "+getitemname(.@coinID)+" you want to receive.";
        next;
        //prompts the buyer with an input
        input .@coinamnt;
        //new price of voting points (cost4onecoin x cost4amount)
        set @vote_cost[@choice], @vote_cost[@choice] * .@coinamnt;
        //changes the amount that the player is buying to the one he/she inputted
        set @vote_item_count[@choice], .@coinamnt;
    //closes coin check
    }
        if( @vote_cost[@choice] > @vote ) {
                mes "^ff0000You dont have enought Vote Point for "+@vote_item_count[@choice]+"x '"+getitemname(@vote_item[@choice])+"' :/^000000";
                close;
        }
        mes "Are u realy sure to trade "+@vote_item_count[@choice]+"x '^ff0000"+getitemname(@vote_item[@choice])+"^000000' for ^00aa00"+@vote_cost[@choice]+"^000000 Vote Points?";
        if(select("No! Cancel!:Yes, Trade me!") == 1 ) {
                mes "^ff0000Trade was canceled~^000000";
                close;
        }
 
        set .@new, @vote - @vote_cost[@choice];
        if( .@new < 0 ) // safty first..
                set .@new, 0;
        query_sql("UPDATE `cp_v4p_voters` SET `points` = '"+.@new+"' WHERE `account_id` = '"+getcharid(3)+"'");
        getitem @vote_item[@choice], @vote_item_count[@choice];
        mes "^00aa00Trade was Successfull  Hope to see u again =)!^000000";
        close;
}
Viewed 309 times, submitted by unknown.