| Lua for AC server | |
|
+6blabla4198 Nirude |HP| TheKiller samsattF Sveark 10 posters |
|
Author | Message |
---|
Nirude Admin
Messages : 176 Joined/Date d'inscription : 2010-04-21
Gema stats farthest jump: 38
| Subject: Re: Lua for AC server Tue Aug 30, 2011 5:29 am | |
| OK Ty. And for the setposition, I would just need a setpos at spawn. Maybe a spawn control would help: force a player to spawn at a chosen spawn point. Is it possible? Or force a player to spawn at a ffa spawn? | |
|
| |
Sveark
Messages : 124 Joined/Date d'inscription : 2011-05-02 Age : 30 Location/Localisation : Russia
| Subject: Re: Lua for AC server Thu Nov 03, 2011 6:15 am | |
| up! (added SvearkMod in Lua to Downloads section) | |
|
| |
Sveark
Messages : 124 Joined/Date d'inscription : 2011-05-02 Age : 30 Location/Localisation : Russia
| Subject: Re: Lua for AC server Fri Nov 04, 2011 12:21 am | |
| Update. Added 3 functions: 1) getprimary (integer player_cn) 2) setprimary (integer target_cn, integer weapon) 3) getflagkeeper (integer flag) Changed 1 function: 1) from: getammo (integer player_cn) to: getammo (integer player_cn, integer weapon) Fixed 4 functions: setfrags, setflags, setdeaths, setskin - now they work instantaneously | |
|
| |
Sveark
Messages : 124 Joined/Date d'inscription : 2011-05-02 Age : 30 Location/Localisation : Russia
| Subject: Re: Lua for AC server Sat Nov 05, 2011 5:01 am | |
| One more update! Added 3 functions: 1) giveitem (integer target_cn, integer item_type) 2) getdefaultammo (integer weapon) 3) getservermaps () Fixed one thing: calling some functions (spawn, dodamage, forcearenawin, forcemapend) was leading to calling corresponding handlers (spawn - onPlayerSpawn, dodamage - onPlayerDeath, forcearenawin - onArenaWin, forcemapend - onMapEnd). Now no function leads to calling handlers. You must do it yourself in Lua. | |
|
| |
Sveark
Messages : 124 Joined/Date d'inscription : 2011-05-02 Age : 30 Location/Localisation : Russia
| Subject: Re: Lua for AC server Sat Nov 05, 2011 9:00 am | |
| Update Added 1 function: shuffleteams () | |
|
| |
Sveark
Messages : 124 Joined/Date d'inscription : 2011-05-02 Age : 30 Location/Localisation : Russia
| Subject: Re: Lua for AC server Sun Nov 06, 2011 5:18 am | |
| Update. Fixed voteend function - it was leading to crash | |
|
| |
Nirude Admin
Messages : 176 Joined/Date d'inscription : 2010-04-21
Gema stats farthest jump: 38
| Subject: Re: Lua for AC server Sun Nov 06, 2011 6:01 am | |
| Sveark is back ^^ TY for all your work. | |
|
| |
Sveark
Messages : 124 Joined/Date d'inscription : 2011-05-02 Age : 30 Location/Localisation : Russia
| Subject: Re: Lua for AC server Thu Nov 10, 2011 3:19 am | |
| Update. Added --lua switch to set Lua's scripts directory. Example of using: ./server.sh --lua "packages/Lua scripts 2/" start server.bat --lua "packages/Lua scripts 2/" a slash is at the ending | |
|
| |
blabla4198
Messages : 8 Joined/Date d'inscription : 2011-11-18
| Subject: Re: Lua for AC server Tue Nov 22, 2011 8:47 pm | |
| I keep getting this error: AssaultCube fatal error: could not create server info socket
sorry, i'm a noob at servers, but what's the problem here? | |
|
| |
Sveark
Messages : 124 Joined/Date d'inscription : 2011-05-02 Age : 30 Location/Localisation : Russia
| Subject: Re: Lua for AC server Sat Nov 26, 2011 3:23 am | |
| blabla4198, maybe you should use different server port
Update. Added 3 functions: 1) setprotocol 2) getprotocol 3) getdefaultprotocol
If you're making some Lua script which alters AC's gameplay, then you must put this line in the beginning of your script: setprotocol(-getdefaultprotocol())
Added 3 modules: lua-ex, luasocket and luasql (merely with MySQL). Maybe I'll make a ladder using MySQL | |
|
| |
Sveark
Messages : 124 Joined/Date d'inscription : 2011-05-02 Age : 30 Location/Localisation : Russia
| Subject: Re: Lua for AC server Thu Feb 23, 2012 12:27 am | |
| Small, but significant update. Added a handler: onLuaNotice (string message) and a function whicn invokes this handler: luanotice (string message) Fixed the luasql module on Linux (didn't work because of wrong library name) Changed the sets of arguments of the 2 handlers: from onPlayerDamage (integer actor_cn, integer target_cn, integer damage) to onPlayerDamage (integer actor_cn, integer target_cn, integer damage, integer actor_gun, boolean gib) and from onPlayerDisconnect (integer actor_cn) to onPlayerDisconnect (integer actor_cn, integer reason) | |
|
| |
Sveark
Messages : 124 Joined/Date d'inscription : 2011-05-02 Age : 30 Location/Localisation : Russia
| Subject: Re: Lua for AC server Sun Jun 10, 2012 12:56 pm | |
| Version 1.2 has been released.
There added new constants describing voice commands (API: Constants, the Sound section).
New handlers: (B) onPlayerSayVoice onPlayerWeaponChange (B) onItemSpawn (B) onItemRespawn onPlayerNameChange (B) onPlayerRoleChange (B) onPlayerRoleChangeTry onMaprotRead onPasswordsRead onBlRead
New functions: getnextmode getnextmap getmapitems spawnitem removebans getscore setscore getadminpwd removeadminpwd setmasterserver getmaprotnextmap getmaprotnextmode getadminpwds getwholemaprot setwholemaprot getwholebl setwholebl strtoiprange
2 functions have had extended lists of arguments: ban (integer target_cn, integer minutes (= default ban time)) setadminpwd (string admin_password, integer line = 0, boolean denyadmin = false)
1 handler has had an ability to block its action: onPlayerDeath
The setmaxcl function has had spoofing effect (the maximum number of connected players ranges from 1 to 256) | |
|
| |
Park
Messages : 272 Joined/Date d'inscription : 2011-11-04
Gema stats farthest jump:
| Subject: Re: Lua for AC server Mon Jun 11, 2012 10:49 am | |
| hey thats cool, yep cool! can i use : - ban(acn) or do i have to write ban(acn, 20) ? - setadminpwd (string admin_password, 0, false) 0 (line) would overwrite line 0 ? or how does that work? how do i set it to add it, temporarily OR add it to serverpwd.cfg? | |
|
| |
Sveark
Messages : 124 Joined/Date d'inscription : 2011-05-02 Age : 30 Location/Localisation : Russia
| Subject: Re: Lua for AC server Mon Jun 11, 2012 12:46 pm | |
| You can use ban(cn) -- regular ban as well as ban(cn, 60) -- for 60 minutes
Lua's functions do not alter configs, they simply operate data in the memory. setadminpwd("thatpwd") -- just makes a static password with line = 0 and denyadmin = false setadminpwd("thatpwd", 2, false) -- overwrites (without altering serverpwd.cfg) the password loaded from the serverpwd.cfg at line 2 (or creates a new one)
Note that config files in an AC server are periodically read. If on some phase a config file has been reread, then your changes have been canceled. For this reason I recommend you to put your code into onPasswordsRead(), onBlRead() and onMaprotRead() handlers. But there is the only exception: if setadminpwd doesn't find the password at given line, then it creates a static one, which is not removed when the configs are reread | |
|
| |
Park
Messages : 272 Joined/Date d'inscription : 2011-11-04
Gema stats farthest jump:
| Subject: Re: Lua for AC server Mon Jun 11, 2012 1:55 pm | |
| | |
|
| |
Park
Messages : 272 Joined/Date d'inscription : 2011-11-04
Gema stats farthest jump:
| Subject: Re: Lua for AC server Tue Jun 12, 2012 7:31 am | |
| tested maxclient spoofing:
"maxclient exceeded: cannot register"
please fix that (maybe comment the line in serverms.cpp) | |
|
| |
|HP| Admin
Messages : 226 Joined/Date d'inscription : 2010-06-01
Gema stats farthest jump: MAX
| Subject: Re: Lua for AC server Tue Jun 12, 2012 7:43 am | |
| nice Sveark thx for the taking the time to update.... | |
|
| |
Sveark
Messages : 124 Joined/Date d'inscription : 2011-05-02 Age : 30 Location/Localisation : Russia
| Subject: Re: Lua for AC server Tue Jun 12, 2012 11:39 pm | |
| Park, oops... Allright, I fixed it, redownload the mod! thx, |HP| | |
|
| |
Sveark
Messages : 124 Joined/Date d'inscription : 2011-05-02 Age : 30 Location/Localisation : Russia
| Subject: Re: Lua for AC server Thu Jul 12, 2012 4:19 am | |
| Version 1.3!
New constants, describing: socket types needed by the setsockettype function; log levels used by the onLogLine handler.
New handlers: onLogLine onPlayerWeaponReload
New functions: addclient initclient delclient sayas voiceas setsockettype sethostname
New module: lualanes. This module implements an API to multithreading in Lua. May be useful in the handlers.
Fixed the cfg module: a Linux-server could only read config files generated by a Linux-server. Now a Lua-modded server reads config files generated in any OS (more precisely, in Windows or Linux).
And the last change: there applied the hitreg fix, which can be turned off by the --no-hitreg-fix switch. | |
|
| |
Sveark
Messages : 124 Joined/Date d'inscription : 2011-05-02 Age : 30 Location/Localisation : Russia
| Subject: Re: Lua for AC server Thu Jul 12, 2012 2:22 pm | |
| A bug has been found: after calling settimeleft(), players receive skew time updates from the server. So settimeleft() had an effect, that is a bit different from the expected: for example, if timeleft was set to 1 minute, the game was running 30 seconds longer. Thanks Chidori for finding the bug. It have taken a place throughout all the versions. Now it is fixed (jul 12th). If someone has already managed to download a bugged 1.3, feel free to redownload the mod! | |
|
| |
Park
Messages : 272 Joined/Date d'inscription : 2011-11-04
Gema stats farthest jump:
| Subject: Re: Lua for AC server Fri Jul 20, 2012 12:36 pm | |
| yo sveark, nice work, thanks again! ive got one question: How do i activate or use the multithreading API? or does it always run? | |
|
| |
Sveark
Messages : 124 Joined/Date d'inscription : 2011-05-02 Age : 30 Location/Localisation : Russia
| Subject: Re: Lua for AC server Fri Jul 20, 2012 12:54 pm | |
| The API is pluggable. To plug in it, write require "lanes" at the beginning of the script. - Code:
-
require "lanes"
function AVeryComplexCodeToRunInASeparateThread( SomeArgument ) -- blah-blah end
function onMapChange() local StartANewParallelThread = lanes.gen( AVeryComplexCodeToRunInASeparateThread )
local TheArgument = "ohayou gozaimasu" StartANewParallelThread( TheArgument )
-- asdaafadsf end
| |
|
| |
Park
Messages : 272 Joined/Date d'inscription : 2011-11-04
Gema stats farthest jump:
| Subject: Re: Lua for AC server Fri Jul 20, 2012 2:00 pm | |
| ok, i added it. Edit: for me it doesnt load eg. the geoip into a table; any thing into table, eg. gtop top.. admin pwds.... so i removed it again. what about a onvoteEnd( voteResult, voteDetailes...) handler? i could use it Thanks, anyways! [running in no-gui-mode] now it hangs when i reload or shut it down: lua: Destroying framework.... [with gui, just in a opened terminal:] instant quit after reload. most recent error on reload&exit: - Code:
-
Jul 20 22:34:20 <Lua> Destroying framework... threading.c 399: pthread_cond_destroy(ref) failed, 16 EBUSY stacktrace: .//bin_unix/linux_server() [0x8080c96] [0x110400] [0x110416] /lib/i386-linux-gnu/libc.so.6(gsignal+0x4f) [0x16b1ef] /lib/i386-linux-gnu/libc.so.6(abort+0x175) [0x16e835] ./lua/extra/lua51-lanes.so(+0x5ba5) [0x3d8ba5] ./lua/extra/lua51-lanes.so(+0x5df6) [0x3d8df6] ./lua/extra/lua51-lanes.so(+0x40da) [0x3d70da] ./lua/extra/lua51-lanes.so(+0x6f90) [0x3d9f90] ./liblua.so(+0xa2ae) [0x9eb2ae] ./liblua.so(+0xa66b) [0x9eb66b] ./liblua.so(+0xbdc2) [0x9ecdc2] ./liblua.so(+0xc3ff) [0x9ed3ff] ./liblua.so(+0x997e) [0x9ea97e] ./liblua.so(lua_close+0x76) [0x9f2736] ./lua/extra/lua51-lanes.so(+0x2b3c) [0x3d5b3c] /lib/i386-linux-gnu/libc.so.6(__cxa_finalize+0xab) [0x17030b] ./lua/extra/lua51-lanes.so(+0x25f4) [0x3d55f4] ./lua/extra/lua51-lanes.so(+0x8b3d) [0x3dbb3d] /lib/ld-linux.so.2(+0x14628) [0xf72628] stacktrace: ^C
i dont think its a problem of mine, but ill look. is there a way to force quit the ac server? | |
|
| |
Sveark
Messages : 124 Joined/Date d'inscription : 2011-05-02 Age : 30 Location/Localisation : Russia
| Subject: Re: Lua for AC server Sat Jul 21, 2012 1:08 pm | |
| Hm, this module seems to not work correctly under a 32-bit Linux . It works fine for me, but there's one thing: from a lanes' thread it's impossible to access Lua's API (getfrags, shuffleteams, PLUGIN_BLOCK, etc...). I can already see the solution for this and I'll try to implement it. Also, I think I made a bug in the 1.3 - onMapChange isn't called when someone joins the server when it's empty. Park, I'll need your help with compilling the sources under a 32-bit Linux machine. As to the onVoteEnd handler - ok, I'make it. And there's no way to shut down the server. Of course, I can make a function doing this, but what about restarting? Hmm, I'll think of restarting | |
|
| |
Park
Messages : 272 Joined/Date d'inscription : 2011-11-04
Gema stats farthest jump:
| Subject: Re: Lua for AC server Sat Jul 21, 2012 3:26 pm | |
| thy, well talk about compiling later. No need for restart/shutdown functions. I was thinking of killall linux_server cmnd. Forgot about it. sveark, maybe you can make the php script AND the lua side of the Interface i asked for via email. I wont have much time, the next weeks. Web Chat: enter site > Log in with a already registered name + password from the login system * > Chat window** * the userconfig file is called "AC_SUPPLY_users.cfg" looks like: [Lua Config File] dietrich=password username(lower)=password logging in adds the client with that addclient command, leaving (by a log out button or timeout) uses delclient .... ** Chat window: bla bla bla bla 10 lines of text bla bla bla bla [enter your text here - part ] [ Submit - button] Not neccessarrry but would be cool: Map overview with all clients position ... .... ... ... well only if your bored if i use setpwd and put a password, how do i remove it? Ill be here tonight. tomorrow gone for a week again. | |
|
| |
Sponsored content
| Subject: Re: Lua for AC server | |
| |
|
| |
| Lua for AC server | |
|