English Autosay every any minutes

5 replies
Goto Page
To the start Previous 1 Next To the start
30.01.19 03:55:45 pm
Up
Vennece
User
Offline Off
Simple script for saying "hello" in 120 seconds ?

needing this in order to save automatically on my rpg private server
【=◈︿◈=】
30.01.19 05:37:40 pm
Up
Joghurt
User
Offline Off
you are looking for cs2d lua cmd timer
on the help site are some examples that should help you
loading...
30.01.19 06:59:45 pm
Up
Varna97
User
Offline Off
Code:
1
2
3
4
5
6
7
8
if sample==nil then sample={} end
sample.ads={}

addhook("minute","sample.ads.minute")
function sample.ads.minute()
     msg("This script was stolen from")
     msg("=> sys/lua/samples/advertise.lua")
end


Stolen from sys/lua/samples/advertise.lua √
IMG:http://steamsignature.com/status/english/76561198124843516.png
30.01.19 07:17:30 pm
Up
KingShadow
User
Offline Off
Code:
1
2
3
4
timer(120000,'Hello','',0)
function Hello()
msg('\169000255000Hello Everyone!.')
end
30.01.19 07:34:46 pm
Up
TrialAndError
User
Offline Off
user Vennece has written:
needing this in order to save automatically on my rpg private server


I am guessing that you are talking about "Tibia" based on your comment from another thread.

Tibia actually has an auto-saves which saves every 5 minutes (minute hook) depending if your server has a password or not, which you can remove and change the timer to whatever you want.

Code:
1
2
3
4
5
6
7
8
9
10
11
--Change this line; remove game'sv_password' == '' and change the 5 to whatever timer you want.
--If you want it to save every minute, you can remove the whole if-statement

--hooks.lua ; minute-hook
if game'sv_password' == '' and MINUTES%5 == 0 then

     --You could print out a message to the console or to the players 
     --to let them know that the server has been saved
     --msg("Server saved!")
     saveserver()
end


Quoted from thread cs2d Script Not Save
user Vennece has written:
this is my problem in my own tibia private server too..
its not saving while quitting the server or closes it


To make it save when you shutdown your server or when you change map, you just need to add the hooks: cs2d lua hook shutdown and cs2d lua hook mapchange in cs2dtibia/hooks.lua

Code:
1
2
3
4
5
6
7
8
9
addhook("shutdown", "EXPshutdown")
function EXPshutdown()
     saveserver()
end

addhook("mapchange", "EXPmapchange")
function EXPmapchange()
     saveserver()
end
31.01.19 12:45:19 pm
Up
Vennece
User
Offline Off
@user Joghurt: i dont have much knowledge on lua than last 4 years of me which is pretty good of editing, but since the cs2d updates it will change and the some lua scripts will begin to malfunction.

@user KingShadow: thanks very much so @user Varna97: learn me a good trick, but yours was line shorted to fit in other lua scripts

@user Varna97: so sorry for not realizing it there was example luas on the cs2d, and thanks for the stole script but it was cool somehow to autosay it.

@user TrialAndError: u are absolutely great lua programmer dude.. all of them worked (just a little bit fix to put more end) it because of updated version, the hooks didn't support autosave anymore.. really thanks u might save the future who having this problem..
【=◈︿◈=】
To the start Previous 1 Next To the start