A website for every gema-assaultcube fan
 
HomeHome  CalendarCalendar  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  Log in  

Share | 
 

 Lua for AC server

View previous topic View next topic Go down 
Go to page : Previous  1, 2, 3, 4  Next
AuthorMessage
Park



Messages : 265
Joined/Date d'inscription : 2011-11-04

Gema stats
farthest jump:

PostSubject: Re: Lua for AC server   Mon Jul 30, 2012 2:44 pm

sveark can you include a
checkmap(mapname) (this checks if the map is good, or bad.)
(or)
(getmapinfo command, returning area, hight ... .. . and stuff )
and a command that allows the vote of any, even not working maps?
like allowAnyMap(bool)

Thanks
Back to top Go down
View user profile http://mgpmax.dyndns.org
Baruch



Messages : 105
Joined/Date d'inscription : 2012-08-04
Age : 25
Location/Localisation : France

Gema stats
farthest jump:

PostSubject: Re: Lua for AC server   Fri Sep 07, 2012 7:23 am

I don't see any difference between getprimary and getnextprimary, is is just me ?
Back to top Go down
View user profile
Sveark



Messages : 124
Joined/Date d'inscription : 2011-05-02
Age : 23
Location/Localisation : Russia

PostSubject: Re: Lua for AC server   Thu Oct 11, 2012 2:22 pm

Baruch wrote:
I don't see any difference between getprimary and getnextprimary, is is just me ?
As a round starts, getprimary and getnextprimary give the same number — id of the weapon the player is using.
After the player pressed B and changed his primary weapon, getprimary still returns id of the weapon the player is using, but getnextprimary already returns id of the weapon the player will be using in next round.
As the next round starts, the player has got desired weapon, and these functions give the same value again (until the player changes his primary weapon via B-menu).
Back to top Go down
View user profile http://sveark.info/ac
Baruch



Messages : 105
Joined/Date d'inscription : 2012-08-04
Age : 25
Location/Localisation : France

Gema stats
farthest jump:

PostSubject: Re: Lua for AC server   Thu Oct 11, 2012 2:53 pm

Hmmm ok. I wanted to avoid shotguns to spawn on gema. But when a player is in spec mode and modifies his weapon with B menu, getnextprimary is updated when the player spawns ? Because I had coded something like : onPlayerSpawn, return PLUGIN_BLOCK until getnextprimary is different from shotgun. It didn't work, don't really remember why... (I'll test)
Back to top Go down
View user profile
Sveark



Messages : 124
Joined/Date d'inscription : 2011-05-02
Age : 23
Location/Localisation : Russia

PostSubject: Re: Lua for AC server   Wed Jan 09, 2013 2:55 pm

Version 1.4 has been released!

New constants: vote errors and force-team reasons (API: Constants)

New functions:
players
spectators
rvsf
cla
sendspawn
isonfloor
isonladder
isscoping
iscrouching
getscore
getspawnmillis
getsessionid
clienthasflag
getvote
getspectcn
getacversion
getacbuildtype
getconnectmillis
setping
setangle
setscoping
setcrouching
setip (this function does the same as sethostname: setip = sethostname)
setstate
getmasterserver
getmasterservers
addms
updatems
removems
removeban
getbans
getmaprotnextentry
getmaprotnexttimeleft
logline
setmaprotnextentry
setmaprotnextmap
setmaprotnextmode
setmaprotnexttimeleft
getreloadtime
getattackdelay
getmagsize
shootas
reloadas
pickupas
removemap
mapisok
mapexists
voteas
getitempos
isitemspawned
getmappath
getpushfactor
genpwdhash
gettotalsent
gettotalreceived
cleargbans
addgban
checkgban
cfg.vars
cfg.exists
cfg.totable
cfg.fromtable
tmr.create(timer_id, period_millis, function)

New handlers:
(B) onVoteEnd
onPlayerSpawnClientSide
onPlayerSwitchSpectCn
(B) onPlayerSuicide
onPlayerVote
(B) onPlayerSendMap
onPlayerDeathAfter
onPlayerSpawnAfter
onPlayerDamageAfter
onPlayerTeamChangeAfter
onServerProcessAfter
onPlayerItemPickupAfter
onPlayerSayTextAfter
onPlayerRoleChangeAfter
onItemRespawnAfter
onItemSpawnAfter
onPlayerSayVoiceAfter
onVoteEndAfter
onPlayerSendMapAfter
(B) onWhois
onWhoisAfter
onPlayerDisconnectAfter
LuaLoopAfter
onPlayerShootAfter
onInitAfter
onMasterServerUpdate
onMasterServerCommand
onMasterServerCommandAfter

Generator is a simple handler which is intended to return a value which is used by the server.
New generators:
yieldIsSpamDetected
yieldServerOperator
yieldCanSpeech
yieldIsBanned
yieldIsBlacklisted

3 functions have had extended lists of arguments:
clientprint (integer target_cn, string message, integer exclude_cn = -1)
getservermaps (boolean including_official = false)
setteam (integer target_cn, integer team, integer forceteam_reason = FTR_INFO)

5 handlers have had extended lists of arguments:
onPlayerSayText (integer sender_cn, string message, boolean team, boolean me)
onPlayerRoleChangeTry (integer actor_cn, integer new_role, string hash, boolean player_is_connecting)
onPlayerRoleChange (integer actor_cn, integer new_role, string hash, integer adminpwd_line, boolean player_is_connecting)
onPlayerCallVote (integer actor_cn, integer type, string text, integer number, integer vote_error)
onPlayerTeamChange (integer actor_cn, integer new_team, integer forceteam_reason)

[!] 1 function has been remade:
luanotice (object message, string target)

[!] 1 handler has been remade:
onLuaNotice (object message, string target)


Other changes:
  1. tmr.remove function now works in a timer handler;
  2. getvelocity function has been fixed and now returns the same value as in a client;
  3. setwholemaprot and setmaprotnextentry now have default values for the following params: allowVote (1), minplayer (0), maxplayer (0), skiplines (0);
  4. Dietrich, probably I fixed your rare segfauls (error 11). I think they occured because of end-of-line styles. Now cfg module can read a cfg file with any end-of-line style;
  5. ac_server.inc file has had three new functions: slice, team_isactive, team_isspect;
  6. onPlayerCallVote handler has had a generator status. It may return vote error code when needed and may return nothing (nil) when no need to change server's decision;
  7. Fixed Windows XP's problem (no one could use admin passwords);
  8. Servers have had an ability to use multiple master servers (along with the main master server which is specified in servercmdline.txt or in command line); To add a master server, do this:

    Code:
    function onInitAfter()
      addms("shad-99.org")
    end
  9. Fixed lanes module;
  10. Lua version changed from 5.1.4 to 5.1.5.


Notes:
  1. *_AFTER handler is NOT called if at least one handler of this action returned PLUGIN_BLOCK. Exception: onVoteEndAfter;
  2. No Lua mod's function entails a handler execution. Exceptions: logline (onLogLine); luanotice (onLuaNotice);
  3. Be careful using lanes module: AC server is not multithreaded. Being made in several threads at the same time, some Lua mod's API calls may cause a crash;
  4. [!] denotes that the change may entail script modification.


Last edited by Sveark on Wed Jan 16, 2013 8:09 pm; edited 4 times in total
Back to top Go down
View user profile http://sveark.info/ac
Park



Messages : 265
Joined/Date d'inscription : 2011-11-04

Gema stats
farthest jump:

PostSubject: Re: Lua for AC server   Wed Jan 09, 2013 3:10 pm

There will return awesome for this... and if i find time besides school a bunch of news n upadatas ...
Thanks sveark! Very brilliant.

Ps can you give me an eggsample of a generator function?
Back to top Go down
View user profile http://mgpmax.dyndns.org
Sveark



Messages : 124
Joined/Date d'inscription : 2011-05-02
Age : 23
Location/Localisation : Russia

PostSubject: Re: Lua for AC server   Wed Jan 09, 2013 3:29 pm

Working examples of a generator:

Any vote fails.
Code:
function onPlayerCallVote()
  return VOTEE_DISABLED
end

No server operator (no player with red nickname).
Code:
function yieldServerOperator()
  return -1
end

Reverse text message ability (only allowed text messages that contain at least one bad word mentioned in forbidden.cfg).

Code:
function yieldCanSpeech(cn, text, can_speech)
  return not can_speech
end

Everyone but server owner is banned forever.
Code:
function yieldIsBanned(ip, is_banned)
  if ip == "127.0.0.1" then return false end
  return true
end

Server owner cannot be banned.
Code:
function yieldIsBanned(ip, is_banned)
  if ip == "127.0.0.1" then return false end
  return is_banned
end


Last edited by Sveark on Wed Jan 09, 2013 3:35 pm; edited 1 time in total
Back to top Go down
View user profile http://sveark.info/ac
Park



Messages : 265
Joined/Date d'inscription : 2011-11-04

Gema stats
farthest jump:

PostSubject: Re: Lua for AC server   Wed Jan 09, 2013 3:33 pm

Haha nice
Back to top Go down
View user profile http://mgpmax.dyndns.org
Baruch



Messages : 105
Joined/Date d'inscription : 2012-08-04
Age : 25
Location/Localisation : France

Gema stats
farthest jump:

PostSubject: Re: Lua for AC server   Thu Jan 10, 2013 10:01 am

Awesome ! Very Happy Thanks a lot

I'll test all this as soon as possible... when my pc works again xD
Back to top Go down
View user profile
Park



Messages : 265
Joined/Date d'inscription : 2011-11-04

Gema stats
farthest jump:

PostSubject: Re: Lua for AC server   Thu Jan 10, 2013 12:17 pm

i keep on getting a Speicherzugriffsfehler
with an immediate kill of ac server, no call of ondestroy.
(Speicherzugriffsfehler is your Segmentation fault.)
Back to top Go down
View user profile http://mgpmax.dyndns.org
Sveark



Messages : 124
Joined/Date d'inscription : 2011-05-02
Age : 23
Location/Localisation : Russia

PostSubject: Re: Lua for AC server   Thu Jan 10, 2013 2:51 pm

Park, why don't you send me the error text? Am I telepathist?!
My home internet connection has broken for some reason, I'm writing from my phone, it's not unlimited, so for the time being I won't be online
Back to top Go down
View user profile http://sveark.info/ac
Park



Messages : 265
Joined/Date d'inscription : 2011-11-04

Gema stats
farthest jump:

PostSubject: Re: Lua for AC server   Thu Jan 10, 2013 2:58 pm

The erreo msg is "Speicherzugriffsfehler" or whatever i wrote before. Nothing more. Dont hurry and loose phoneinternet because of me... ill be alright!
EDIT:

as far as i have can find the problem, it is produced by calling voteend(VOTE_YES) (or what it was, anyways voteend command)

there may be other commands that are bugged too. dont know#

'###############

Seems to have the segfault error on vps serv too, also totally random..

Any tips to check for bugs/.... on my side ?

### if i call voteend( VOTE_YES ) ( or whatever it was ) it does NOT work. it KILLS the server.
I call it with a command. (!vote yes) to force my vote after taking admin...
is it maybe the problem: i f1 to a vote, then remember im not admin, take admin, and use !vote yes? is it this? shouldnt be or?


Last edited by Park on Sun Jan 13, 2013 8:31 am; edited 2 times in total
Back to top Go down
View user profile http://mgpmax.dyndns.org
Sveark



Messages : 124
Joined/Date d'inscription : 2011-05-02
Age : 23
Location/Localisation : Russia

PostSubject: Re: Lua for AC server   Sat Jan 12, 2013 5:03 pm

Hmm, I've found one bug - it's in tmr module, but voteend works fine for me
Back to top Go down
View user profile http://sveark.info/ac
Nirude
Admin


Messages : 176
Joined/Date d'inscription : 2010-04-21

Gema stats
farthest jump: 38

PostSubject: Re: Lua for AC server   Tue Jan 15, 2013 2:05 am

Thank you Sveark \o/
Is it possible to do a coop vs IA with all this stuff? ^^
Back to top Go down
View user profile http://gema.forumactif.com
Sveark



Messages : 124
Joined/Date d'inscription : 2011-05-02
Age : 23
Location/Localisation : Russia

PostSubject: Re: Lua for AC server   Tue Jan 15, 2013 3:49 am

Nirude, what does IA stand for?
Back to top Go down
View user profile http://sveark.info/ac
Park



Messages : 265
Joined/Date d'inscription : 2011-11-04

Gema stats
farthest jump:

PostSubject: Re: Lua for AC server   Tue Jan 15, 2013 4:45 am

you mean like play DM on a not working map ( in multiplayer )?

Sveark can i return VOTEE_NOERROR (or waht it was ( from now on ill call "or whatever it was" "//" so its shorter Razz) to force, a vote to no errors, like vote dm on a "bad" map?
Back to top Go down
View user profile http://mgpmax.dyndns.org
Sveark



Messages : 124
Joined/Date d'inscription : 2011-05-02
Age : 23
Location/Localisation : Russia

PostSubject: Re: Lua for AC server   Tue Jan 15, 2013 4:34 pm

Park, yes, you can mute these errors:
  • "voting is currently disabled" (VOTEE_DISABLED),
  • "there is already a vote pending" (VOTEE_CUR),
  • "already voted" (VOTEE_MUL),
  • "can't vote that often" (VOTEE_MAX),
  • "this vote is not allowed in the current environment (singleplayer/multiplayer)" (VOTEE_AREA),
  • "no permission" (VOTEE_PERMISSION),
  • "invalid vote" (VOTEE_INVALID),
  • "server denied your call" (VOTEE_WEAK),
  • "the next map/mode is already set" (VOTEE_NEXT)

All the rest is client side
Back to top Go down
View user profile http://sveark.info/ac
Sveark



Messages : 124
Joined/Date d'inscription : 2011-05-02
Age : 23
Location/Localisation : Russia

PostSubject: Re: Lua for AC server   Wed Jan 16, 2013 7:45 pm

There accumulated some new features during the time of catching bugs... I think I'll make 1.5 at an early date (don't use 1.4)
Back to top Go down
View user profile http://sveark.info/ac
Park



Messages : 265
Joined/Date d'inscription : 2011-11-04

Gema stats
farthest jump:

PostSubject: Re: Lua for AC server   Thu Jan 17, 2013 2:20 pm

There is also some bug on/after disconnect. check: ondisconnectafter (//) and c side disconnect, it quits after saying "blanla disconnected, 2312321seconds played...."
Back to top Go down
View user profile http://mgpmax.dyndns.org
Sveark



Messages : 124
Joined/Date d'inscription : 2011-05-02
Age : 23
Location/Localisation : Russia

PostSubject: Re: Lua for AC server   Fri Jan 18, 2013 5:43 am

Park, I didn't touch neither onPlayerDisconnect handler, nor disconnect function...
Back to top Go down
View user profile http://sveark.info/ac
Park



Messages : 265
Joined/Date d'inscription : 2011-11-04

Gema stats
farthest jump:

PostSubject: Re: Lua for AC server   Fri Jan 18, 2013 2:07 pm

so your ASM fix fixed the crashes, god thanks, and thank you.

but theres still some disconnect problem. some people (Uknowme, myself, and a bunch of unknown ppl) disconnect pretty randomly for reasons like tagt, eup (...?). this happens only on mine, and only since lua 1.4, im sure its not my script. the only possibility i can think of is the LAG commands like mapisok(..) or some load/network functions produce. if thats the error ( the lag of lua ) maybe you could run lua externally(///) to run it "besides" ac, or is that not possible?
Back to top Go down
View user profile http://mgpmax.dyndns.org
Sveark



Messages : 124
Joined/Date d'inscription : 2011-05-02
Age : 23
Location/Localisation : Russia

PostSubject: Re: Lua for AC server   Thu Jan 31, 2013 4:27 am

I just realized what did you mean, Nirude...
No, COOP-ing is a destiny of a human being, not AI
Back to top Go down
View user profile http://sveark.info/ac
UKnowMe?



Messages : 51
Joined/Date d'inscription : 2012-10-08
Location/Localisation : Germany

Gema stats
farthest jump:

PostSubject: Re: Lua for AC server   Mon Feb 11, 2013 3:41 pm

Sveark, it seems that setnextmode() isn't working. When I call setnextmode(13) the next gamemode is still CTF or the gamemode the current map is in.
Back to top Go down
View user profile
Park



Messages : 265
Joined/Date d'inscription : 2011-11-04

Gema stats
farthest jump:

PostSubject: Re: Lua for AC server   Mon Feb 11, 2013 3:55 pm

setnextmode(GM_CTF) ?!
Back to top Go down
View user profile http://mgpmax.dyndns.org
Sveark



Messages : 124
Joined/Date d'inscription : 2011-05-02
Age : 23
Location/Localisation : Russia

PostSubject: Re: Lua for AC server   Mon Feb 11, 2013 4:25 pm

The thing is that you must use both setnextmap and setnextmode functions to set next map, because at the end of a map server checks if the name of next map is set (if it is, loads that map and clears the name of next map), think of /setnext <mode> <map>, server simulates executing of it.
Also, there is a command /gonext. If it's executed, server ignores what did setnextmap and setnextmode set and unconditionally loads next map from maprot, therefore, I suggest you to use setmaprotnextmap (string mapname) / setmaprotnextmode (integer mode) / setmaprotnexttimeleft (integer timeleft) which change parameters of maprot's next map (and you can singly call setmaprotnextmap, setmaprotnextmode or setmaprotnexttimeleft)
Back to top Go down
View user profile http://sveark.info/ac
Sponsored content




PostSubject: Re: Lua for AC server   Today at 8:15 pm

Back to top Go down
 
Lua for AC server
View previous topic View next topic Back to top 
Page 3 of 4Go to page : Previous  1, 2, 3, 4  Next
 Similar topics
-
» [ASC] CoD|Conviction of Destiny CTF Server
» IP Saint Server
» Server just crashed
» nIke Unl!m!ted cw server AKA konza !!! verujte na rec
» Server bill is due between Sept 6th and 13th..

Permissions in this forum:You cannot reply to topics in this forum
gema :: International :: General-
Jump to: