- 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.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;}
You can access character and account variables. In your example instead of doing too many query_sql commands. You can do likeohhh 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;
}
dispbottom "Current Balance = " + hourlypoints;
hey jabote!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![]()
We use essential cookies to make this site work, and optional cookies to enhance your experience.