Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- prontera,149,193,5 script Vote For Points 62,{
- if(getgmlevel()>=99)
- {
- mes "[Vote For Points - CP]";
- mes "Please choose your desired command.";
- switch(select("Add Item:Delete Item:Exchange Center"))
- {
- case 1:
- next;
- mes "[Vote For Points - CP]";
- mes "Enter the Item Number";
- input .@itemID;
- mes "How many Vote Points?";
- input .@itemPOINTS;
- mes "Item Name:"+getitemname(.@itemID);
- mes "Vote Points:"+.@itemPOINTS;
- next;
- mes "[Vote For Points = CP]";
- if((.@itemID>=501) && (.@itemPOINTS!=0))
- {
- query_sql "select `item_no` from `v4p_npc` where item_no='"+.@itemID+"'",.@itemNO;
- if(getarraysize(.@itemNO)==0)
- {
- query_sql "insert into `v4p_npc`(item_no,points) values('"+.@itemID+"','"+.@itemPOINTS+"')";
- mes "Item Successfully Added.";
- close;
- }
- else
- {
- mes "Item already exist in the database.";
- close;
- }
- end;
- }
- else
- {
- goto itemnotexist;
- }
- end;
- case 2:
- next;
- mes "[Vote For Points - CP]";
- query_sql "select `item_no`,`points` from `v4p_npc`",.@itemNO,.@itemPOINTS;
- if(.@itemNO!=0)
- {
- mes "Choose the item you want to delete.";
- for(set .@i,0;.@i<getarraysize(.@itemNO);set .@i,.@i+1)
- {
- if(.@i<1)
- set .@itemLIST$,"["+.@itemPOINTS[.@i]+" vpts] - "+getitemname(.@itemNO[0]);
- else
- set .@itemLIST$,.@itemLIST$+":["+.@itemPOINTS[.@i]+" vpts] - "+getitemname(.@itemNO[.@i]);
- }
- set .@selected, select(.@itemLIST$)-1;
- next;
- mes "[Vote For Points - CP]";
- mes "Are you sure you want to delete this item?";
- mes "Item Name:"+getitemname(.@itemNO[.@selected]);
- switch(select("Yes, delete this item to the list"))
- {
- case 1:
- query_sql "delete from `v4p_npc` where item_no='"+.@itemNO[.@selected]+"'";
- mes "Item successfully deleted";
- close;
- }
- end;
- }
- else
- {
- mes "No items found in the database.";
- close;
- }
- end;
- case 3:
- next;
- goto exchangecenter;
- end;
- }
- }
- else
- {
- goto exchangecenter;
- }
- end;
- exchangecenter:
- mes "[Vote For Points]";
- mes "Choose your desired items.";
- mes "=================================";
- query_sql "select `points` from v4p_voters_info where accountid='"+getcharid(3,strcharinfo(0))+"'",.@points;
- mes "Your Points:"+.@points[0];
- mes "=================================";
- query_sql "select `item_no`,`points` from `v4p_npc`",.@itemNO,.@itemPOINTS;
- if(.@itemNO!=0)
- {
- for(set .@i,0;.@i<getarraysize(.@itemNO);set .@i,.@i+1)
- {
- if(.@i<1)
- set .@itemLIST$,"["+.@itemPOINTS[.@i]+" vpts] - "+getitemname(.@itemNO[0]);
- else
- set .@itemLIST$,.@itemLIST$+":["+.@itemPOINTS[.@i]+" vpts] - "+getitemname(.@itemNO[.@i]);
- }
- set .@selected, select(.@itemLIST$)-1;
- next;
- mes "[Vote For Points]";
- mes getitemname(.@itemNO[.@selected])+" - ["+.@itemPOINTS[.@selected]+" vpts]";
- menu "Exchange",trade,"Back to the list",exchangecenter;
- end;
- trade:
- if(.@points[0]>=.@itemPOINTS[.@selected])
- {
- next;
- mes "[Vote For Points]";
- mes "Here you go. Thank you for voting RemedyRO.";
- query_sql "update `v4p_voters_info` set points='"+(.@points-.@itemPOINTS[.@selected])+"' where accountid='"+getcharid(3,strcharinfo(0))+"'";
- getitem .@itemNO[.@selected],1;
- announce strcharinfo(0)+" just got "+getitemname(.@itemNO[.@selected])+" by voting. Thank you for voting RemedyRO.",0;
- close;
- }
- else
- {
- next;
- mes "[Vote For Points]";
- mes "Issuficient vote points";
- close;
- }
- close;
- }
- else
- {
- mes "Sorry there are not items available for exchange.";
- close;
- }
- end;
- itemnotexist:
- mes "Item doest not exist or make sure the points you assigned is not equal to zero.";
- close;
- end;
- }
Add Comment
Please, Sign In to add comment