oblinez 3 Posted July 13, 2014 hi can i request an npc? a simple npc who gives hourly points with a sistem security this npc dont give points for player who stay stopped for more than 15 minutes and this npc dont give points for players under @autotradeThanks in advance Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted July 13, 2014 There you go. Edit it to further suit your needs: - script hourly_points -1,{OnInit: //Configs .time = 60 * 60 * 1000; // Time in milliseconds. Default: 1 hour (60 * 60 * 1000) .max_idle = 15 * 30; // Maximum idle time in seconds .points = 1; // Points to give the user each active hour. .points_variable$ = "#CASHPOINTS"; // Variable name to store the points end;OnPCLoginEvent: addtimer .time, strnpcinfo(3)+"::OnPoints"; end;OnPoints: if (checkidle() < .max_idle && checkvending() != 2) { setd .points_variable$, getd(.points_variable$) + .points; } end;} 1 oblinez reacted to this Quote Share this post Link to post Share on other sites
0 oblinez 3 Posted July 14, 2014 (edited) ohhh bro i love you! rsrsr i'm joke! kkkkk thx for the npc thx alot but =/ i forget to say one detail u.u can you edit this npc to work with a "horlypoints" table in the logindb? this npc dont give point to player under @at, @autotrade or any command to open shop? checkvending() <<is it? how this npc will do a loop on timer? to stay giving points all the hours can you explain this?? sorry, i'm new on scripting... u.u jaBote can i do this? - script hourly_points -1,{ OnInit: //Configs .time = 60 * 60 * 1000; // Time in milliseconds. Default: 1 hour (60 * 60 * 1000) .max_idle = 15 * 30; // Maximum idle time in seconds .points = 1; // Points to give the user each active hour. .hptab$ = "hourlypoints"; // table name on logindb end; OnPCLoginEvent: addtimer .time, strnpcinfo(3)+"::OnPoints"; end; OnPoints: if (checkidle() < .max_idle && checkvending() != 2) { query_sql "SELECT `account_id` FROM `char` WHERE `name`='"+strcharinfo(0)+"'",.@id; query_sql "UPDATE `login` SET `"+.hptab$+"` = `"+.hptab$+"`+"+.points+" WHERE `account_id`='"+.@id+"'"; dispbottom "You received "+.points+" Point by staying in-game for 1 hour"; query_sql "SELECT `"+.hptab$+"` FROM `login` WHERE `account_id`='"+.@id+"'",.@hp; dispbottom "Current Balance = "+.@hp+" Cash"; } dispbottom "You will not earn points if you stay afk for 15 minutes or open shop."; dispbottom "Current Balance = "+.@hp+" Cash"; end; } Edited July 14, 2014 by oblinez Quote Share this post Link to post Share on other sites
0 Patskie 88 Posted July 14, 2014 - script hourly_points -1,{OnInit: //Configs .time = 60 * 60 * 1000; // Time in milliseconds. Default: 1 hour (60 * 60 * 1000) .max_idle = 15 * 30; // Maximum idle time in seconds .points = 1; // Points to give the user each active hour. .points_variable$ = "#CASHPOINTS"; // Variable name to store the points end;OnPCLoginEvent: addtimer .time, strnpcinfo(3)+"::OnPoints"; end;OnPoints: if (checkidle() < .max_idle && checkvending() != 2) { setd .points_variable$, getd(.points_variable$) + .points; dispbottom "Current Balance = " + #CASHPOINTS; goto OnPCLoginEvent; } end;} There you go. Edit it to further suit your needs: - script hourly_points -1,{OnInit: //Configs .time = 60 * 60 * 1000; // Time in milliseconds. Default: 1 hour (60 * 60 * 1000) .max_idle = 15 * 30; // Maximum idle time in seconds .points = 1; // Points to give the user each active hour. .points_variable$ = "#CASHPOINTS"; // Variable name to store the points end;OnPCLoginEvent: addtimer .time, strnpcinfo(3)+"::OnPoints"; end;OnPoints: if (checkidle() < .max_idle && checkvending() != 2) { setd .points_variable$, getd(.points_variable$) + .points; } end;} Would trigger once only after script has been executed. ohhh bro i love you! rsrsr i'm joke! kkkkk thx for the npc thx alot but =/ i forget to say one detail u.u can you edit this npc to work with a "horlypoints" table in the logindb? this npc dont give point to player under @at, @autotrade or any command to open shop? checkvending() <<is it? how this npc will do a loop on timer? to stay giving points all the hours can you explain this?? sorry, i'm new on scripting... u.u jaBote can i do this? - script hourly_points -1,{ OnInit: //Configs .time = 60 * 60 * 1000; // Time in milliseconds. Default: 1 hour (60 * 60 * 1000) .max_idle = 15 * 30; // Maximum idle time in seconds .points = 1; // Points to give the user each active hour. .hptab$ = "hourlypoints"; // table name on logindb end; OnPCLoginEvent: addtimer .time, strnpcinfo(3)+"::OnPoints"; end; OnPoints: if (checkidle() < .max_idle && checkvending() != 2) { query_sql "SELECT `account_id` FROM `char` WHERE `name`='"+strcharinfo(0)+"'",.@id; query_sql "UPDATE `login` SET `"+.hptab$+"` = `"+.hptab$+"`+"+.points+" WHERE `account_id`='"+.@id+"'"; dispbottom "You received "+.points+" Point by staying in-game for 1 hour"; query_sql "SELECT `"+.hptab$+"` FROM `login` WHERE `account_id`='"+.@id+"'",.@hp; dispbottom "Current Balance = "+.@hp+" Cash"; } dispbottom "You will not earn points if you stay afk for 15 minutes or open shop."; dispbottom "Current Balance = "+.@hp+" Cash"; end; } You can access character and account variables. In your example instead of doing too many query_sql commands. You can do like dispbottom "Current Balance = " + hourlypoints; 1 jaBote reacted to this Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted July 14, 2014 Whops sorry, Patskie is true, the timer runs only once, my fault. @oblinez: Please tell me the structure of the table or the column in which you wish to give the points and give as many details as possible so that I can rework the script to fix that. Once I've got all the new info I'll remake this if possible Quote Share this post Link to post Share on other sites
0 oblinez 3 Posted July 20, 2014 (edited) Whops sorry, Patskie is true, the timer runs only once, my fault. @oblinez: Please tell me the structure of the table or the column in which you wish to give the points and give as many details as possible so that I can rework the script to fix that. Once I've got all the new info I'll remake this if possible hey jabote! you asked me for information about npc... here is the information: this npc will work with sql and here is the table who npc will work ALTER TABLE `login` ADD `globalpoints` INT NOT NULL ; this npc will give hourly points(each hour)... but i need an security sistem within... like this: the npc does not deliver points if the player stay away,afk by 15minuts or more. (to prevent the player let the char online all night long) the npc does not deliver points if the player is under @at,@autotrade or any command to open shop. (to prevent the player let the char in @autotrade to gain poits) if you can do this information configurable like "afkmaxtime, points" will be better sorry to ask so much =/ and sorry my bad english... Thank you in advance p.s now this is not private support =D (i need this npc u.u) Edited July 20, 2014 by oblinez Quote Share this post Link to post Share on other sites
Thanks in advance
Share this post
Link to post
Share on other sites