Jump to content
  • 0
Sign in to follow this  
oblinez

request - npc who give hourly points

Question

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

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

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;}

Share this post


Link to post
Share on other sites
  • 0

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 by oblinez

Share this post


Link to post
Share on other sites
  • 0
-	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;

Share this post


Link to post
Share on other sites
  • 0

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 ;)

Share this post


Link to post
Share on other sites
  • 0

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 by oblinez

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.