Jump to content
  • 0

Vote NPC


Quesooo

Question


  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.07
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

Good day again rathena

 

Please help me modify this script

 

turbo_room,122,110,3	script	Vote Converter	504,{

	mes "^0000EE [Comelec Assistant] ^000000";

	mes "Hello!";

	mes "You've Total Cash Points ^EE0000"+#CASHPOINTS+"^000000 Cash Points.";

	if( select("Convert to Cash Points:Cancel") == 1 ){

	query_sql("SELECT `value` FROM `global_reg_value` WHERE account_id='"+getcharid(3)+"' LIMIT 1",.@points);

	set #CASHPOINTS,#CASHPOINTS + .@points;

	query_sql("UPDATE `global_reg_value` SET value=0 WHERE account_id='"+getcharid(3)+"'");

	dispbottom " Gained "+.@points+" Points . Total Cash Points "+#CASHPOINTS+" Points.";

	}

	close;

}

 i want that NPC to be exchange the vote points for conver mirror,field manual,job manual,kafra pass, bubble gum , advance field manual, advance job manual

 

i already modified it before but when i talk to npc the npc said that i dont have vote points

 

but on flux vote i already have 50 points please help me out

 

thank you ^_^

Link to comment
Share on other sites

23 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  261
  • Reputation:   53
  • Joined:  11/11/16
  • Last Seen:  

	query_sql("SELECT `value` FROM `global_reg_value` WHERE account_id='"+getcharid(3)+"' LIMIT 1",.@points);

	set #CASHPOINTS,#CASHPOINTS + .@points;

	query_sql("UPDATE `global_reg_value` SET value=0 WHERE account_id='"+getcharid(3)+"'");

If your using vote4points i believe it should be:

	query_sql("SELECT `points` FROM `cp_v4p_voters` WHERE account_id='"+getcharid(3)+"' LIMIT 1",.@points);

	set #CASHPOINTS,#CASHPOINTS + .@points;

	query_sql("UPDATE `cp_v4p_voters` SET points=0 WHERE account_id='"+getcharid(3)+"'");

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.07
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

i dont know where do i place that..

 

please modify my script thank you ^_^

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  261
  • Reputation:   53
  • Joined:  11/11/16
  • Last Seen:  

Its easy, Look at your script.

Where it says 

query_sql("SELECT `value` FROM `global_reg_value` WHERE account_id='"+getcharid(3)+"' LIMIT 1",.@points);

	set #CASHPOINTS,#CASHPOINTS + .@points;

	query_sql("UPDATE `global_reg_value` SET value=0 WHERE account_id='"+getcharid(3)+"'");

replace with

query_sql("SELECT `points` FROM `cp_v4p_voters` WHERE account_id='"+getcharid(3)+"' LIMIT 1",.@points);

	set #CASHPOINTS,#CASHPOINTS + .@points;

	query_sql("UPDATE `cp_v4p_voters` SET points=0 WHERE account_id='"+getcharid(3)+"'");

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.07
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

15 hours ago, srhmike said:

Its easy, Look at your script.

Where it says 


query_sql("SELECT `value` FROM `global_reg_value` WHERE account_id='"+getcharid(3)+"' LIMIT 1",.@points);

	set #CASHPOINTS,#CASHPOINTS + .@points;

	query_sql("UPDATE `global_reg_value` SET value=0 WHERE account_id='"+getcharid(3)+"'");

replace with


query_sql("SELECT `points` FROM `cp_v4p_voters` WHERE account_id='"+getcharid(3)+"' LIMIT 1",.@points);

	set #CASHPOINTS,#CASHPOINTS + .@points;

	query_sql("UPDATE `cp_v4p_voters` SET points=0 WHERE account_id='"+getcharid(3)+"'");

 

thanks bro i will try that

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.07
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

Its working fine but i want is vote points to be exchange into items

 

convex mirror

bubble gum

advance field manual

advance job manual

field manual

job manual

pots

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  24
  • Reputation:   0
  • Joined:  04/12/17
  • Last Seen:  

try to make some npc that convert points to items

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  261
  • Reputation:   53
  • Joined:  11/11/16
  • Last Seen:  

Well then you dont even need to convert it into cash.  You can just use the npc that came with the vote for points, and have the items there for sale, that can be bought with only vote for points.

In that script, it convert it to cash.  You can then make a cash shop that sell the item.

Which ever way you choose.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.07
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

15 hours ago, srhmike said:

Well then you dont even need to convert it into cash.  You can just use the npc that came with the vote for points, and have the items there for sale, that can be bought with only vote for points.

In that script, it convert it to cash.  You can then make a cash shop that sell the item.

Which ever way you choose.

what do you mean???

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  1137
  • Reputation:   290
  • Joined:  04/29/13
  • Last Seen:  

he means, there is an npc script included with the votepoint addon in npc folder,
you can just use it change the item id's,
else u can also use the script above and turn votepoints to cash points where players can buy stuffs from CP shops

 

 here is the script if you dont have one

/====================================================================================
//Script Name: Vote For Points NPC Script for FluxCP
//SVN: Tested in rAthena r156513
//Developed By: JayPee Mateo
//Version: 1.0
//Requirement(s): FluxCP V4P Addon
//Description: This is a npc script for FluxCP Vote for points in order for the players
//to claim their vote points
//====================================================================================

royal_room3,80,136,5    script    VoteForPoints    89,{

//Function Prototypes
function garbagecol;//Garbage collection for the Character variables
garbagecol();
function add_item; //Syntanx: add_item(ITEMID,QUANTITY,POINTS,CATEGORY);
function makeCategory;//This will return a list of the categories
function getItemsByCat;//This will return the list of items associated to the particular category
function getItemDetails;//This will return the details of the item
function getPoints;//This will return the points of the player stored in the database
function updatePoints;//This will updates the points of the player stored in the database


//NPC Name
set .npcname$,"[ Vote For Points ]";
    
//Initialization of the Rewards
add_item(555,1,100,"Hello");
add_item(556,2,101,"Hello");
add_item(557,3,101,"Hello1");


//Script Start    
    mes .npcname$;
    mes "Hi! Do you want to exchange your vote points?:";
    switch(select("Yes, I want to exchange my points:See my points"))
    {
        case 1:
        next;
            mes .npcname$;
            mes "Please choose a category:";
            set .@selected,select(makeCategory())-1;
        next;
            mes .npcname$;
            mes "Please the item you want:";
            set .@selected,select(getItemsByCat(@listCat$[.@selected]))-1;
            
        next;
            mes .npcname$;                        
            set .@ritemid,getItemDetails(@itemKeys[.@selected],"itemid");
            set .@rquantity,getItemDetails(@itemKeys[.@selected],"quantity");
            set .@rpoints,getItemDetails(@itemKeys[.@selected],"points");
            mes "Item ID:"+.@ritemid;
            mes "Item Name: "+getitemname(.@ritemid);
            mes "Item Quantity: "+.@rquantity+" pc(s).";
            mes "Required Points: "+.@rpoints+" pt(s).";
            mes "\n";
            mes "Do you want to this item?";
            if(select("Yes:No")==1)
            {
                set .@points,getPoints(getcharid(3));
                if(.@points>=.@rpoints)
                {
                    next;
                    mes .npcname$;            
                    updatePoints(getcharid(3),.@rpoints);
                    getitem .@ritemid,.@rquantity;
                    mes "Here you go!. Thank you for voting. Don't forget to vote again. :D";
                }
                else
                    mes "Sorry, you do not have enough points for this item.";                
            }
            else
            {
                next;
                mes .npcname$;            
                mes "Okay bye!";
            }            
            garbagecol();
        close;
        case 2:
            next;
            mes .npcname$;            
            set .@points,getPoints(getcharid(3));            
            mes "You currently have "+.@points+" pt(s).";
            garbagecol();
        close;
    }
end;

//Functions Bodies
    function updatePoints {
        set .@account_id,getarg(0);
        set .@usedPoints,getarg(1);
        query_sql("UPDATE `cp_v4p_voters` SET points=(points-"+.@usedPoints+") WHERE account_id='"+.@account_id+"'");
        return;
    }

    function getPoints {
        set .@account_id,getarg(0);
        query_sql("SELECT `points` FROM `cp_v4p_voters` WHERE account_id="+.@account_id+" LIMIT 1",.@points);
        if(getarraysize(.@points)==0)
            return 0;        
        return .@points[0];
    }

    function getItemDetails {
        set .@key,getarg(0); //Key
        set .@detail$,getarg(1); //What details to return such as ItemID, Points, Quantity, Category
        
        if(strtolower(.@detail$) == strtolower("ItemID"))
            return @itemID[.@key];
        else if(strtolower(.@detail$) == strtolower("Quantity"))
            return @itemQ[.@key];
        else if(strtolower(.@detail$) == strtolower("Points"))
            return @points[.@key];
        else if(strtolower(.@detail$) == strtolower("Category"))
            return @category$[.@key];
    }

    function getItemsByCat {        
        set .@selectedCat$,getarg(0);
        set .@make_string$,"";
        set .@x,0;
        for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1)
        {
            if(strtolower(.@selectedCat$) == strtolower(@category$[.@i]))
            {
                setarray @itemKeys[.@x],.@i;
                if(.@make_string$ == "")
                    set .@make_string$,getitemname(@itemID[.@i]);
                else
                    set .@make_string$,.@make_string$+":"+getitemname(@itemID[.@i]);
                
                set .@x,.@x+1;
            }
        }
        return .@make_string$;
    }
    
    
    function makeCategory {
        set .@make_string$,"";
        for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1)
        {            
            if(.@make_string$ == "")
            {
                setarray @listCat$[getarraysize(@listCat$)],@category$[.@i];
                set .@make_string$,@category$[.@i];
            }
            else
            {
                if(compare(.@make_string$,@category$[.@i])==0)
                {
                    setarray @listCat$[getarraysize(@listCat$)],@category$[.@i];
                    set .@make_string$,.@make_string$+":"+@category$[.@i];                
                }
            }
        }
        return .@make_string$;
    }
            
    function add_item
    {
        set .@itemID,getarg(0,-1); //IteID
        set .@itemQ,getarg(1,-1); //Item Quantity
        set .@points,getarg(2,-1);
        set .@cat$,getarg(3,"Uncategorized"); //Category
        
        
        if(.@itemID == -1)
        {
            debugmes "Invalid Item ID. Script not completely loaded.";
            end;
        }
        else if(.@itemQ == -1)
        {
            debugmes "Invalid Item Quantity. Script not completely loaded.";
            end;
        }
        else if(.@points == -1)
        {
            debugmes "Points assignment error. Script not completely loaded.";
            end;
        }
        set .@key,getarraysize(@itemID);
        setarray @itemID[.@key],.@itemID;
        setarray @itemQ[.@key],.@itemQ;
        setarray @points[.@key],.@points;
        setarray @category$[.@key],.@cat$;
        return 1; //return 1 as success
    }
    
    function garbagecol{
        deletearray @itemID[0],128;
        deletearray @itemQ[0],128;
        deletearray @points[0],128;    
        deletearray @category$[0],128;    
        deletearray @listCat$[0],128;
        deletearray @itemKeys[0],128;
        return;
    }
}

 

Edited by Cyro
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.07
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

16 hours ago, Cyro said:

he means, there is an npc script included with the votepoint addon in npc folder,
you can just use it change the item id's,
else u can also use the script above and turn votepoints to cash points where players can buy stuffs from CP shops

 

 here is the script if you dont have one


/====================================================================================
//Script Name: Vote For Points NPC Script for FluxCP
//SVN: Tested in rAthena r156513
//Developed By: JayPee Mateo
//Version: 1.0
//Requirement(s): FluxCP V4P Addon
//Description: This is a npc script for FluxCP Vote for points in order for the players
//to claim their vote points
//====================================================================================

royal_room3,80,136,5    script    VoteForPoints    89,{

//Function Prototypes
function garbagecol;//Garbage collection for the Character variables
garbagecol();
function add_item; //Syntanx: add_item(ITEMID,QUANTITY,POINTS,CATEGORY);
function makeCategory;//This will return a list of the categories
function getItemsByCat;//This will return the list of items associated to the particular category
function getItemDetails;//This will return the details of the item
function getPoints;//This will return the points of the player stored in the database
function updatePoints;//This will updates the points of the player stored in the database


//NPC Name
set .npcname$,"[ Vote For Points ]";
    
//Initialization of the Rewards
add_item(555,1,100,"Hello");
add_item(556,2,101,"Hello");
add_item(557,3,101,"Hello1");


//Script Start    
    mes .npcname$;
    mes "Hi! Do you want to exchange your vote points?:";
    switch(select("Yes, I want to exchange my points:See my points"))
    {
        case 1:
        next;
            mes .npcname$;
            mes "Please choose a category:";
            set .@selected,select(makeCategory())-1;
        next;
            mes .npcname$;
            mes "Please the item you want:";
            set .@selected,select(getItemsByCat(@listCat$[.@selected]))-1;
            
        next;
            mes .npcname$;                        
            set .@ritemid,getItemDetails(@itemKeys[.@selected],"itemid");
            set .@rquantity,getItemDetails(@itemKeys[.@selected],"quantity");
            set .@rpoints,getItemDetails(@itemKeys[.@selected],"points");
            mes "Item ID:"+.@ritemid;
            mes "Item Name: "+getitemname(.@ritemid);
            mes "Item Quantity: "+.@rquantity+" pc(s).";
            mes "Required Points: "+.@rpoints+" pt(s).";
            mes "\n";
            mes "Do you want to this item?";
            if(select("Yes:No")==1)
            {
                set .@points,getPoints(getcharid(3));
                if(.@points>=.@rpoints)
                {
                    next;
                    mes .npcname$;            
                    updatePoints(getcharid(3),.@rpoints);
                    getitem .@ritemid,.@rquantity;
                    mes "Here you go!. Thank you for voting. Don't forget to vote again. :D";
                }
                else
                    mes "Sorry, you do not have enough points for this item.";                
            }
            else
            {
                next;
                mes .npcname$;            
                mes "Okay bye!";
            }            
            garbagecol();
        close;
        case 2:
            next;
            mes .npcname$;            
            set .@points,getPoints(getcharid(3));            
            mes "You currently have "+.@points+" pt(s).";
            garbagecol();
        close;
    }
end;

//Functions Bodies
    function updatePoints {
        set .@account_id,getarg(0);
        set .@usedPoints,getarg(1);
        query_sql("UPDATE `cp_v4p_voters` SET points=(points-"+.@usedPoints+") WHERE account_id='"+.@account_id+"'");
        return;
    }

    function getPoints {
        set .@account_id,getarg(0);
        query_sql("SELECT `points` FROM `cp_v4p_voters` WHERE account_id="+.@account_id+" LIMIT 1",.@points);
        if(getarraysize(.@points)==0)
            return 0;        
        return .@points[0];
    }

    function getItemDetails {
        set .@key,getarg(0); //Key
        set .@detail$,getarg(1); //What details to return such as ItemID, Points, Quantity, Category
        
        if(strtolower(.@detail$) == strtolower("ItemID"))
            return @itemID[.@key];
        else if(strtolower(.@detail$) == strtolower("Quantity"))
            return @itemQ[.@key];
        else if(strtolower(.@detail$) == strtolower("Points"))
            return @points[.@key];
        else if(strtolower(.@detail$) == strtolower("Category"))
            return @category$[.@key];
    }

    function getItemsByCat {        
        set .@selectedCat$,getarg(0);
        set .@make_string$,"";
        set .@x,0;
        for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1)
        {
            if(strtolower(.@selectedCat$) == strtolower(@category$[.@i]))
            {
                setarray @itemKeys[.@x],.@i;
                if(.@make_string$ == "")
                    set .@make_string$,getitemname(@itemID[.@i]);
                else
                    set .@make_string$,.@make_string$+":"+getitemname(@itemID[.@i]);
                
                set .@x,.@x+1;
            }
        }
        return .@make_string$;
    }
    
    
    function makeCategory {
        set .@make_string$,"";
        for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1)
        {            
            if(.@make_string$ == "")
            {
                setarray @listCat$[getarraysize(@listCat$)],@category$[.@i];
                set .@make_string$,@category$[.@i];
            }
            else
            {
                if(compare(.@make_string$,@category$[.@i])==0)
                {
                    setarray @listCat$[getarraysize(@listCat$)],@category$[.@i];
                    set .@make_string$,.@make_string$+":"+@category$[.@i];                
                }
            }
        }
        return .@make_string$;
    }
            
    function add_item
    {
        set .@itemID,getarg(0,-1); //IteID
        set .@itemQ,getarg(1,-1); //Item Quantity
        set .@points,getarg(2,-1);
        set .@cat$,getarg(3,"Uncategorized"); //Category
        
        
        if(.@itemID == -1)
        {
            debugmes "Invalid Item ID. Script not completely loaded.";
            end;
        }
        else if(.@itemQ == -1)
        {
            debugmes "Invalid Item Quantity. Script not completely loaded.";
            end;
        }
        else if(.@points == -1)
        {
            debugmes "Points assignment error. Script not completely loaded.";
            end;
        }
        set .@key,getarraysize(@itemID);
        setarray @itemID[.@key],.@itemID;
        setarray @itemQ[.@key],.@itemQ;
        setarray @points[.@key],.@points;
        setarray @category$[.@key],.@cat$;
        return 1; //return 1 as success
    }
    
    function garbagecol{
        deletearray @itemID[0],128;
        deletearray @itemQ[0],128;
        deletearray @points[0],128;    
        deletearray @category$[0],128;    
        deletearray @listCat$[0],128;
        deletearray @itemKeys[0],128;
        return;
    }
}

 

+1 thank you for this boss

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.07
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

16 hours ago, Cyro said:

he means, there is an npc script included with the votepoint addon in npc folder,
you can just use it change the item id's,
else u can also use the script above and turn votepoints to cash points where players can buy stuffs from CP shops

 

 here is the script if you dont have one


/====================================================================================
//Script Name: Vote For Points NPC Script for FluxCP
//SVN: Tested in rAthena r156513
//Developed By: JayPee Mateo
//Version: 1.0
//Requirement(s): FluxCP V4P Addon
//Description: This is a npc script for FluxCP Vote for points in order for the players
//to claim their vote points
//====================================================================================

royal_room3,80,136,5    script    VoteForPoints    89,{

//Function Prototypes
function garbagecol;//Garbage collection for the Character variables
garbagecol();
function add_item; //Syntanx: add_item(ITEMID,QUANTITY,POINTS,CATEGORY);
function makeCategory;//This will return a list of the categories
function getItemsByCat;//This will return the list of items associated to the particular category
function getItemDetails;//This will return the details of the item
function getPoints;//This will return the points of the player stored in the database
function updatePoints;//This will updates the points of the player stored in the database


//NPC Name
set .npcname$,"[ Vote For Points ]";
    
//Initialization of the Rewards
add_item(555,1,100,"Hello");
add_item(556,2,101,"Hello");
add_item(557,3,101,"Hello1");


//Script Start    
    mes .npcname$;
    mes "Hi! Do you want to exchange your vote points?:";
    switch(select("Yes, I want to exchange my points:See my points"))
    {
        case 1:
        next;
            mes .npcname$;
            mes "Please choose a category:";
            set .@selected,select(makeCategory())-1;
        next;
            mes .npcname$;
            mes "Please the item you want:";
            set .@selected,select(getItemsByCat(@listCat$[.@selected]))-1;
            
        next;
            mes .npcname$;                        
            set .@ritemid,getItemDetails(@itemKeys[.@selected],"itemid");
            set .@rquantity,getItemDetails(@itemKeys[.@selected],"quantity");
            set .@rpoints,getItemDetails(@itemKeys[.@selected],"points");
            mes "Item ID:"+.@ritemid;
            mes "Item Name: "+getitemname(.@ritemid);
            mes "Item Quantity: "+.@rquantity+" pc(s).";
            mes "Required Points: "+.@rpoints+" pt(s).";
            mes "\n";
            mes "Do you want to this item?";
            if(select("Yes:No")==1)
            {
                set .@points,getPoints(getcharid(3));
                if(.@points>=.@rpoints)
                {
                    next;
                    mes .npcname$;            
                    updatePoints(getcharid(3),.@rpoints);
                    getitem .@ritemid,.@rquantity;
                    mes "Here you go!. Thank you for voting. Don't forget to vote again. :D";
                }
                else
                    mes "Sorry, you do not have enough points for this item.";                
            }
            else
            {
                next;
                mes .npcname$;            
                mes "Okay bye!";
            }            
            garbagecol();
        close;
        case 2:
            next;
            mes .npcname$;            
            set .@points,getPoints(getcharid(3));            
            mes "You currently have "+.@points+" pt(s).";
            garbagecol();
        close;
    }
end;

//Functions Bodies
    function updatePoints {
        set .@account_id,getarg(0);
        set .@usedPoints,getarg(1);
        query_sql("UPDATE `cp_v4p_voters` SET points=(points-"+.@usedPoints+") WHERE account_id='"+.@account_id+"'");
        return;
    }

    function getPoints {
        set .@account_id,getarg(0);
        query_sql("SELECT `points` FROM `cp_v4p_voters` WHERE account_id="+.@account_id+" LIMIT 1",.@points);
        if(getarraysize(.@points)==0)
            return 0;        
        return .@points[0];
    }

    function getItemDetails {
        set .@key,getarg(0); //Key
        set .@detail$,getarg(1); //What details to return such as ItemID, Points, Quantity, Category
        
        if(strtolower(.@detail$) == strtolower("ItemID"))
            return @itemID[.@key];
        else if(strtolower(.@detail$) == strtolower("Quantity"))
            return @itemQ[.@key];
        else if(strtolower(.@detail$) == strtolower("Points"))
            return @points[.@key];
        else if(strtolower(.@detail$) == strtolower("Category"))
            return @category$[.@key];
    }

    function getItemsByCat {        
        set .@selectedCat$,getarg(0);
        set .@make_string$,"";
        set .@x,0;
        for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1)
        {
            if(strtolower(.@selectedCat$) == strtolower(@category$[.@i]))
            {
                setarray @itemKeys[.@x],.@i;
                if(.@make_string$ == "")
                    set .@make_string$,getitemname(@itemID[.@i]);
                else
                    set .@make_string$,.@make_string$+":"+getitemname(@itemID[.@i]);
                
                set .@x,.@x+1;
            }
        }
        return .@make_string$;
    }
    
    
    function makeCategory {
        set .@make_string$,"";
        for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1)
        {            
            if(.@make_string$ == "")
            {
                setarray @listCat$[getarraysize(@listCat$)],@category$[.@i];
                set .@make_string$,@category$[.@i];
            }
            else
            {
                if(compare(.@make_string$,@category$[.@i])==0)
                {
                    setarray @listCat$[getarraysize(@listCat$)],@category$[.@i];
                    set .@make_string$,.@make_string$+":"+@category$[.@i];                
                }
            }
        }
        return .@make_string$;
    }
            
    function add_item
    {
        set .@itemID,getarg(0,-1); //IteID
        set .@itemQ,getarg(1,-1); //Item Quantity
        set .@points,getarg(2,-1);
        set .@cat$,getarg(3,"Uncategorized"); //Category
        
        
        if(.@itemID == -1)
        {
            debugmes "Invalid Item ID. Script not completely loaded.";
            end;
        }
        else if(.@itemQ == -1)
        {
            debugmes "Invalid Item Quantity. Script not completely loaded.";
            end;
        }
        else if(.@points == -1)
        {
            debugmes "Points assignment error. Script not completely loaded.";
            end;
        }
        set .@key,getarraysize(@itemID);
        setarray @itemID[.@key],.@itemID;
        setarray @itemQ[.@key],.@itemQ;
        setarray @points[.@key],.@points;
        setarray @category$[.@key],.@cat$;
        return 1; //return 1 as success
    }
    
    function garbagecol{
        deletearray @itemID[0],128;
        deletearray @itemQ[0],128;
        deletearray @points[0],128;    
        deletearray @category$[0],128;    
        deletearray @listCat$[0],128;
        deletearray @itemKeys[0],128;
        return;
    }
}

 

the npc is not showing>???? i also ung tab on it

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.07
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

i figure it our sir cyro

 

but i have an error

 

the error said db error Table - 'ragnarok.cp_vp4_voters' doesnt exsist 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  1137
  • Reputation:   290
  • Joined:  04/29/13
  • Last Seen:  

import this tables 

CREATE TABLE `cp_v4p_votelogs` (
  `rtid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `f_site_id` int(10) unsigned NOT NULL,
  `unblock_time` datetime NOT NULL,
  `account_id` int(10) unsigned NOT NULL,
  `ip_address` varchar(100) DEFAULT '0',
  PRIMARY KEY (`rtid`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
CREATE TABLE `cp_v4p_voters` (
  `account_id` int(10) unsigned NOT NULL,
  `points` int(10) unsigned NOT NULL,
  PRIMARY KEY (`account_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

here is the script with increased items 

just modify it as your needs

//====================================================================================
//Script Name: Vote For Points NPC Script for FluxCP
//SVN: Tested in rAthena r156513
//Developed By: JayPee Mateo
//Version: 1.0
//Requirement(s): FluxCP V4P Addon
//Description: This is a npc script for FluxCP Vote for points in order for the players
//to claim their vote points
//====================================================================================

prontera,165,168,3	script	VoteForPoints	89,{

//Function Prototypes
function garbagecol;//Garbage collection for the Character variables
garbagecol();
function add_item; //Syntanx: add_item(ITEMID,QUANTITY,POINTS,CATEGORY);
function makeCategory;//This will return a list of the categories
function getItemsByCat;//This will return the list of items associated to the particular category
function getItemDetails;//This will return the details of the item
function getPoints;//This will return the points of the player stored in the database
function updatePoints;//This will updates the points of the player stored in the database


//NPC Name
set .npcname$,"[ Vote For Points ]";
	
//Initialization of the Rewards
add_item(14532,1,10,"25% manual");
add_item(14533,1,20,"50% job Manual");
add_item(13599,1,90,"50% base manual[5p box]");
add_item(30182,1,500,"zoro sword");
add_item(30129,1,600,"dragon blade");
add_item(30154,1,700,"runes of power");


//Script Start	
	mes .npcname$;
	mes "Hi! Do you want to exchange your vote points?:";
	switch(select("Yes, I want to exchange my points:See my points"))
	{
		case 1:
		next;
			mes .npcname$;
			mes "Please choose a category:";
			set .@selected,select(makeCategory())-1;
		next;
			mes .npcname$;
			mes "Please the item you want:";
			set .@selected,select(getItemsByCat(@listCat$[.@selected]))-1;
			
		next;
			mes .npcname$;						
			set .@ritemid,getItemDetails(@itemKeys[.@selected],"itemid");
			set .@rquantity,getItemDetails(@itemKeys[.@selected],"quantity");
			set .@rpoints,getItemDetails(@itemKeys[.@selected],"points");
			mes "Item ID:"+.@ritemid;
			mes "Item Name: "+getitemname(.@ritemid);
			mes "Item Quantity: "+.@rquantity+" pc(s).";
			mes "Required Points: "+.@rpoints+" pt(s).";
			mes "\n";
			mes "Do you want to this item?";
			if(select("Yes:No")==1)
			{
				set .@points,getPoints(getcharid(3));
				if(.@points>=.@rpoints)
				{
					next;
					mes .npcname$;			
					updatePoints(getcharid(3),.@rpoints);
					getitem .@ritemid,.@rquantity;
					mes "Here you go!. Thank you for voting. Don't forget to vote again. :D";
				}
				else
					mes "Sorry, you do not have enough points for this item.";				
			}
			else
			{
				next;
				mes .npcname$;			
				mes "Okay bye!";
			}			
			garbagecol();
		close;
		case 2:
			next;
			mes .npcname$;			
			set .@points,getPoints(getcharid(3));			
			mes "You currently have "+.@points+" pt(s).";
			garbagecol();
		close;
	}
end;

//Functions Bodies
	function updatePoints {
		set .@account_id,getarg(0);
		set .@usedPoints,getarg(1);
		query_sql("UPDATE `cp_v4p_voters` SET points=(points-"+.@usedPoints+") WHERE account_id='"+.@account_id+"'");
		return;
	}

	function getPoints {
		set .@account_id,getarg(0);
		query_sql("SELECT `points` FROM `cp_v4p_voters` WHERE account_id="+.@account_id+" LIMIT 1",.@points);
		if(getarraysize(.@points)==0)
			return 0;		
		return .@points[0];
	}

	function getItemDetails {
		set .@key,getarg(0); //Key
		set .@detail$,getarg(1); //What details to return such as ItemID, Points, Quantity, Category
		
		if(strtolower(.@detail$) == strtolower("ItemID"))
			return @itemID[.@key];
		else if(strtolower(.@detail$) == strtolower("Quantity"))
			return @itemQ[.@key];
		else if(strtolower(.@detail$) == strtolower("Points"))
			return @points[.@key];
		else if(strtolower(.@detail$) == strtolower("Category"))
			return @category$[.@key];
	}

	function getItemsByCat {		
		set .@selectedCat$,getarg(0);
		set .@make_string$,"";
		set .@x,0;
		for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1)
		{
			if(strtolower(.@selectedCat$) == strtolower(@category$[.@i]))
			{
				setarray @itemKeys[.@x],.@i;
				if(.@make_string$ == "")
					set .@make_string$,getitemname(@itemID[.@i]);
				else
					set .@make_string$,.@make_string$+":"+getitemname(@itemID[.@i]);
				
				set .@x,.@x+1;
			}
		}
		return .@make_string$;
	}
	
	
	function makeCategory {
		set .@make_string$,"";
		for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1)
		{			
			if(.@make_string$ == "")
			{
				setarray @listCat$[getarraysize(@listCat$)],@category$[.@i];
				set .@make_string$,@category$[.@i];
			}
			else
			{
				if(compare(.@make_string$,@category$[.@i])==0)
				{
					setarray @listCat$[getarraysize(@listCat$)],@category$[.@i];
					set .@make_string$,.@make_string$+":"+@category$[.@i];				
				}
			}
		}
		return .@make_string$;
	}
			
	function add_item
	{
		set .@itemID,getarg(0,-1); //IteID
		set .@itemQ,getarg(1,-1); //Item Quantity
		set .@points,getarg(2,-1);
		set .@cat$,getarg(3,"Uncategorized"); //Category
		
		
		if(.@itemID == -1)
		{
			debugmes "Invalid Item ID. Script not completely loaded.";
			end;
		}
		else if(.@itemQ == -1)
		{
			debugmes "Invalid Item Quantity. Script not completely loaded.";
			end;
		}
		else if(.@points == -1)
		{
			debugmes "Points assignment error. Script not completely loaded.";
			end;
		}
		set .@key,getarraysize(@itemID);
		setarray @itemID[.@key],.@itemID;
		setarray @itemQ[.@key],.@itemQ;
		setarray @points[.@key],.@points;
		setarray @category$[.@key],.@cat$;
		return 1; //return 1 as success
	}
	
	function garbagecol{
		deletearray @itemID[0],128;
		deletearray @itemQ[0],128;
		deletearray @points[0],128;	
		deletearray @category$[0],128;	
		deletearray @listCat$[0],128;
		deletearray @itemKeys[0],128;
		return;
	}
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.07
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

15 hours ago, Cyro said:

import this tables 


CREATE TABLE `cp_v4p_votelogs` (
  `rtid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `f_site_id` int(10) unsigned NOT NULL,
  `unblock_time` datetime NOT NULL,
  `account_id` int(10) unsigned NOT NULL,
  `ip_address` varchar(100) DEFAULT '0',
  PRIMARY KEY (`rtid`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;

CREATE TABLE `cp_v4p_voters` (
  `account_id` int(10) unsigned NOT NULL,
  `points` int(10) unsigned NOT NULL,
  PRIMARY KEY (`account_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

here is the script with increased items 

just modify it as your needs


//====================================================================================
//Script Name: Vote For Points NPC Script for FluxCP
//SVN: Tested in rAthena r156513
//Developed By: JayPee Mateo
//Version: 1.0
//Requirement(s): FluxCP V4P Addon
//Description: This is a npc script for FluxCP Vote for points in order for the players
//to claim their vote points
//====================================================================================

prontera,165,168,3	script	VoteForPoints	89,{

//Function Prototypes
function garbagecol;//Garbage collection for the Character variables
garbagecol();
function add_item; //Syntanx: add_item(ITEMID,QUANTITY,POINTS,CATEGORY);
function makeCategory;//This will return a list of the categories
function getItemsByCat;//This will return the list of items associated to the particular category
function getItemDetails;//This will return the details of the item
function getPoints;//This will return the points of the player stored in the database
function updatePoints;//This will updates the points of the player stored in the database


//NPC Name
set .npcname$,"[ Vote For Points ]";
	
//Initialization of the Rewards
add_item(14532,1,10,"25% manual");
add_item(14533,1,20,"50% job Manual");
add_item(13599,1,90,"50% base manual[5p box]");
add_item(30182,1,500,"zoro sword");
add_item(30129,1,600,"dragon blade");
add_item(30154,1,700,"runes of power");


//Script Start	
	mes .npcname$;
	mes "Hi! Do you want to exchange your vote points?:";
	switch(select("Yes, I want to exchange my points:See my points"))
	{
		case 1:
		next;
			mes .npcname$;
			mes "Please choose a category:";
			set .@selected,select(makeCategory())-1;
		next;
			mes .npcname$;
			mes "Please the item you want:";
			set .@selected,select(getItemsByCat(@listCat$[.@selected]))-1;
			
		next;
			mes .npcname$;						
			set .@ritemid,getItemDetails(@itemKeys[.@selected],"itemid");
			set .@rquantity,getItemDetails(@itemKeys[.@selected],"quantity");
			set .@rpoints,getItemDetails(@itemKeys[.@selected],"points");
			mes "Item ID:"+.@ritemid;
			mes "Item Name: "+getitemname(.@ritemid);
			mes "Item Quantity: "+.@rquantity+" pc(s).";
			mes "Required Points: "+.@rpoints+" pt(s).";
			mes "\n";
			mes "Do you want to this item?";
			if(select("Yes:No")==1)
			{
				set .@points,getPoints(getcharid(3));
				if(.@points>=.@rpoints)
				{
					next;
					mes .npcname$;			
					updatePoints(getcharid(3),.@rpoints);
					getitem .@ritemid,.@rquantity;
					mes "Here you go!. Thank you for voting. Don't forget to vote again. :D";
				}
				else
					mes "Sorry, you do not have enough points for this item.";				
			}
			else
			{
				next;
				mes .npcname$;			
				mes "Okay bye!";
			}			
			garbagecol();
		close;
		case 2:
			next;
			mes .npcname$;			
			set .@points,getPoints(getcharid(3));			
			mes "You currently have "+.@points+" pt(s).";
			garbagecol();
		close;
	}
end;

//Functions Bodies
	function updatePoints {
		set .@account_id,getarg(0);
		set .@usedPoints,getarg(1);
		query_sql("UPDATE `cp_v4p_voters` SET points=(points-"+.@usedPoints+") WHERE account_id='"+.@account_id+"'");
		return;
	}

	function getPoints {
		set .@account_id,getarg(0);
		query_sql("SELECT `points` FROM `cp_v4p_voters` WHERE account_id="+.@account_id+" LIMIT 1",.@points);
		if(getarraysize(.@points)==0)
			return 0;		
		return .@points[0];
	}

	function getItemDetails {
		set .@key,getarg(0); //Key
		set .@detail$,getarg(1); //What details to return such as ItemID, Points, Quantity, Category
		
		if(strtolower(.@detail$) == strtolower("ItemID"))
			return @itemID[.@key];
		else if(strtolower(.@detail$) == strtolower("Quantity"))
			return @itemQ[.@key];
		else if(strtolower(.@detail$) == strtolower("Points"))
			return @points[.@key];
		else if(strtolower(.@detail$) == strtolower("Category"))
			return @category$[.@key];
	}

	function getItemsByCat {		
		set .@selectedCat$,getarg(0);
		set .@make_string$,"";
		set .@x,0;
		for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1)
		{
			if(strtolower(.@selectedCat$) == strtolower(@category$[.@i]))
			{
				setarray @itemKeys[.@x],.@i;
				if(.@make_string$ == "")
					set .@make_string$,getitemname(@itemID[.@i]);
				else
					set .@make_string$,.@make_string$+":"+getitemname(@itemID[.@i]);
				
				set .@x,.@x+1;
			}
		}
		return .@make_string$;
	}
	
	
	function makeCategory {
		set .@make_string$,"";
		for(set .@i,0; .@i<getarraysize(@category$); set .@i,.@i+1)
		{			
			if(.@make_string$ == "")
			{
				setarray @listCat$[getarraysize(@listCat$)],@category$[.@i];
				set .@make_string$,@category$[.@i];
			}
			else
			{
				if(compare(.@make_string$,@category$[.@i])==0)
				{
					setarray @listCat$[getarraysize(@listCat$)],@category$[.@i];
					set .@make_string$,.@make_string$+":"+@category$[.@i];				
				}
			}
		}
		return .@make_string$;
	}
			
	function add_item
	{
		set .@itemID,getarg(0,-1); //IteID
		set .@itemQ,getarg(1,-1); //Item Quantity
		set .@points,getarg(2,-1);
		set .@cat$,getarg(3,"Uncategorized"); //Category
		
		
		if(.@itemID == -1)
		{
			debugmes "Invalid Item ID. Script not completely loaded.";
			end;
		}
		else if(.@itemQ == -1)
		{
			debugmes "Invalid Item Quantity. Script not completely loaded.";
			end;
		}
		else if(.@points == -1)
		{
			debugmes "Points assignment error. Script not completely loaded.";
			end;
		}
		set .@key,getarraysize(@itemID);
		setarray @itemID[.@key],.@itemID;
		setarray @itemQ[.@key],.@itemQ;
		setarray @points[.@key],.@points;
		setarray @category$[.@key],.@cat$;
		return 1; //return 1 as success
	}
	
	function garbagecol{
		deletearray @itemID[0],128;
		deletearray @itemQ[0],128;
		deletearray @points[0],128;	
		deletearray @category$[0],128;	
		deletearray @listCat$[0],128;
		deletearray @itemKeys[0],128;
		return;
	}
}

 

sorry sir please guide me where do i import it and please guide me what i do first step by step thank you

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  1137
  • Reputation:   290
  • Joined:  04/29/13
  • Last Seen:  

Just now, Questune09 said:

sorry sir please guide me where do i import it and please guide me what i do first step by step thank you

You must be added cp_v4p_sites.sql already,

this are sql tables , import then in your mysql(phpmyadmin) in same wau then add script to your npc folder 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.07
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

15 hours ago, Cyro said:

You must be added cp_v4p_sites.sql already,

this are sql tables , import then in your mysql(phpmyadmin) in same wau then add script to your npc folder 

you mean i creat a table and paste it inside??

 

first i make 2 tables and insert that script??

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  1137
  • Reputation:   290
  • Joined:  04/29/13
  • Last Seen:  

Save As.. Name.sql

Open MySQL Query . Click on your main database. then, File Open Script the one that you had saved. then Execute.

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.07
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

15 hours ago, Cyro said:

You must be added cp_v4p_sites.sql already,

this are sql tables , import then in your mysql(phpmyadmin) in same wau then add script to your npc folder 

sorry sir im just new on SQL please guide me step by step thank you

 

sorry for being nood lol

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.07
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

15 hours ago, Cyro said:

Save As.. Name.sql

Open MySQL Query . Click on your main database. then, File Open Script the one that you had saved. then Execute.

this is what i do sir

first i login to my sql then i saw bar at the left side 

information_schema

log

mysql

ragnarok

 

what should i do next?

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  1137
  • Reputation:   290
  • Joined:  04/29/13
  • Last Seen:  

Download attached files
login to your phpmyadmin
click on ragnarok under log,mysql
click on import 
locate this files in your pc
clikc ok
repeat the process for three tables
and load npc in ur server



ps-make sure to take backup before you do anything in sql ( if you dont knw how to take backup, GOOGLE) 

cp_v4p_sites.sql

cp_v4p_votelogs.sql

cp_v4p_voters.sql

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.07
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

15 hours ago, Cyro said:

Download attached files
login to your phpmyadmin
click on ragnarok under log,mysql
click on import 
locate this files in your pc
clikc ok
repeat the process for three tables
and load npc in ur server



ps-make sure to take backup before you do anything in sql ( if you dont knw how to take backup, GOOGLE) 

cp_v4p_sites.sql

cp_v4p_votelogs.sql

cp_v4p_voters.sql

done sir what should i do now

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  1137
  • Reputation:   290
  • Joined:  04/29/13
  • Last Seen:  

just use your npc, you are done

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.07
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

15 hours ago, Cyro said:

just use your npc, you are done

i already have a points on my votepoints inside the website but when i talk to npc the npc said that i dont have points

 

this is what i do

 

i click on ragnarok the on the right side i click import then import 3 times as you said the 3 files

 

after that i recompeile the server and test the npc

 

still nothing show

Edited by Questune09
Link to comment
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.   Paste as plain text instead

  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.

×
×
  • Create New...