request - npc who give hourly points

oblinez

New member
Messages
9
Points
0
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 @autotrade

Thanks in advance
 
There you go. Edit it to further suit your needs:

Code:
-	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;}
 
Last edited by a moderator:
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;
}
 
Last edited by a moderator:
- 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 

Code:
dispbottom "Current Balance = " + hourlypoints;
 
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
default_wink.png


 
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
default_wink.png
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)

 
Last edited by a moderator:
Back
Top