Difference between revisions of "Talk:Lua Mod API"

From WolfWiki
Jump to: navigation, search
(Fields for the next release)
 
(47 intermediate revisions by 8 users not shown)
Line 1: Line 1:
- et.G_SlotSound( slotnum, soundindex ) -> Plays the sound soundindex at for the player @ slotnum only. --[[User:RoadKillPuppy|RoadKillPuppy]] 14:17, 16 December 2005 (PST)
+
please call <b>et_Obituary()</b> and <b>et_Print()</b> at the end of the engine function because we can do better output then. example: the engine output (ETPlayer killed himself.) is after the lua output (Hahaha! ETPlayer seems to be a selfkill noob!). thx!! --[[User:Pdi|pdi]] 09:13, 26 December 2006 (PST)
:you can do this with tempentities and SVF_SINGLECLIENT ...
+
:It is called at the beginning of the function so lua mods can override obituary and print entirely if they want. I can make a separate lua hook which is called at the end of the function, eg et_ObituaryPost and et_PrintPost. [[User:Bani|Bani]] 11:52, 3 January 2007 (PST)
:--[[User:Bani|Bani]] 17:32, 16 December 2005 (PST)
+
::Ok, this sounds good to me! Big THX!! :) Please have also a look at field section of this page! ;) --[[User:Pdi|pdi]] 05:41, 4 January 2007 (PST)
  
----
+
Can we have a intercepted version of '''et_Obituary()''' to return '''1''' to intercept it with a mod and return '''0''' to pass it through to the server? --[[User:Pdi|pdi]] 15:16, 8 March 2007 (PST)
some of this can be done via function et_Print(text).. but this would greatly simplify life,<br>
+
:Or a simple '''return STRING''' would be cool. So we can override the normal server output with other texts like "PlayerA does something with PlayerB.". Atm no returncode can replace et_Obituary's output!? Thx! --[[User:Pdi|pdi]] 03:44, 9 March 2007 (PST)
my wish list for christmas:<br>
+
- getUserEguid(cno) - get a client's etpro guid?<br>
+
- repair gentity_set for vec3 - scotty fix the transporter please<br>
+
:[http://bani.anime.net/banimod/forums/viewtopic.php?t=6279 fixed.]--[[User:Bani|Bani]] 17:56, 22 December 2005 (PST)
+
- et.trap_SendServerCommand(cno, "kill") - punish client as alternative to setting health<br>
+
--[[User:Hadr0|Hadr0]] 02:10, 20 December 2005 (PST)<br>
+
:You can use et.G_Damage() in the new test version to do that.--[[User:Bani|Bani]] 01:38, 23 December 2005 (PST)
+
 
+
trap sen server cmd is a ET engine trap the comand u send it send to the client and recived as a server command no a client command
+
 
+
to add ill well that would be al ot of coding for not much [[User:=FF=im2good4u|=FF=Im2good4u]] 12:12, 20 December 2005 (PST)
+
 
+
aight thnx.<br>
+
heres another api request, i'd like to be able to get a clients xp directly. et.gentity_get(cno, "sess.game_points") seems to return 0 always (?)<br>
+
--[[User:Hadr0|Hadr0]] 15:38, 21 December 2005 (PST)
+
:oh nevermind, i see this can be done now with xp = et.gentity_get(cno, "ps.stats", 8)
+
:nice... --[[User:Hadr0|Hadr0]] 16:58, 23 December 2005 (PST)
+
--------
+
add a way to determine if a client is 999, and if possible why he's 999 (loading, connecting, loosing packets, etc)<br>
+
--Gotenks
+
 
+
999 means: server has not been sent data from client for > 1000 ms. So there is no way to certainly tell why.
+
The timeoutflag is stored in the pmflags IIRC. Don't know if lua can read them right now. --[[User:Deus|Deus]] 23:12, 22 December 2005 (PST)<br>
+
Still would like access to the ping, or a dummy variable if they are 999, but also the ammount of time they are inactive.<br>
+
--[[User:Gotenks|Gotenks]] (Sorry for double post) 1:53, 31 December 2005 (CST)
+
:[http://bani.anime.net/banimod/forums/viewtopic.php?t=6291 fixed].--[[User:Bani|Bani]] 02:40, 7 February 2006 (PST)
+
----
+
Access to weapon stats during game similar to end of round stats that are displayed.<br>
+
--[[User:LethalInjection|LethalInjection]] 23:52, 22 December 2005 (PST)
+
:[http://bani.anime.net/banimod/forums/viewtopic.php?t=6291 fixed].--[[User:Bani|Bani]] 02:40, 7 February 2006 (PST)
+
  
 +
Please add a third var to et_ClientCommand() function: et_ClientCommand(clientnum, command, '''isspam''') - '''isspam''' indicates if the client command is ignored by spam filter limit (1) or not (0). Thx!! --[[User:Pdi|pdi]] 05:01, 13 May 2007 (PDT)
 +
:Or can someone explain how spam protection is calculated by etpro mod? Any source code example please!? So I can reproduce it in LUA! THX! --[[User:Pdi|pdi]] 05:34, 17 May 2007 (PDT)
 +
::Try loading my 'client command filter' before your mod -[[User:Hadr0|Hadr0]] 05:04, 8 October 2007 (PDT)
 +
:::Sorry. I wrote my own function but it isn't really the same. I need an copy of the original code segment or the '''isspam''' flag! --[[User:Pdi|pdi]] 03:43, 10 October 2007 (PDT)
 
----
 
----
  
Line 54: Line 28:
 
apart from that returning a value will be more handy since tnhe u cna contine in 1 funtion else u got to reacise it in the recieve funtion [[User:=FF=im2good4u|=FF=Im2good4u]] 10:45, 9 January 2006 (PST)
 
apart from that returning a value will be more handy since tnhe u cna contine in 1 funtion else u got to reacise it in the recieve funtion [[User:=FF=im2good4u|=FF=Im2good4u]] 10:45, 9 January 2006 (PST)
  
<hr>
 
bani i need a console print function on the client that does sepport ascii plz [[User:=FF=im2good4u|=FF=Im2good4u]] 12:49, 12 January 2006 (PST)
 
:et.trap_SendServerCommand( clientnum, "print \"hello ascii console on the client\n\" ) ) --[[User:Bani|Bani]] 22:33, 15 January 2006 (PST)
 
<hr>
 
bani: how about a et_sound(id, sound) event? [[User:gotenks|gotenks]] 20:45, 17 January 2006 (CST)
 
:[http://wolfwiki.anime.net/index.php/ETPro:Lua_Mod_API#sound et.G_Sound( entnum, soundindex )] --[[User:Bani|Bani]] 22:07, 18 January 2006 (PST)
 
:bani, i was referring to an on event call, so when a sound is played et_sound(id,sound) would be called.[[User:gotenks|gotenks]] 21:45, 20 January 2006 (CST)
 
::most sounds are clientside... this would not be of much use. --[[User:Bani|Bani]] 04:42, 22 January 2006 (PST)
 
:::except for checking when something like a killing spree sound is activated--[[User:gotenks|gotenks]] 07:54, 23 January 2006 (CST)
 
:::::There would be no way for you to know what sound was activated. You can't get a filename from the soundindex.--[[User:Bani|Bani]] 10:19, 24 January 2006 (PST)
 
:::::This is a case where IPCSend/IPCReceive would be useful, so mods can notify each other of specific events.--[[User:Bani|Bani]] 02:40, 7 February 2006 (PST)
 
 
----
 
 
== Fields for the next release ==
 
== Fields for the next release ==
Is it possible to get a player's live angles? Fieldname "s.angles" only gives the spawn angles. Tried "rotate", "s.angles2", "TargetAngles", "r.currentAngles" as well but they just give 0.000000 for each element. thanks for any help --[[User:Hadr0|Hadr0]] 01:35, 25 January 2006 (PST)
+
I think Kotoko wants the '''ps.velocity''' field here. It would be a good idea, I think. --[[User:FARMICEUDICAL|FARMICEUDICAL]] 20:23, 5 December 2006 (PST)
:This will be fixed in the next release, where you will get access to ps.viewangles--[[User:Bani|Bani]] 02:33, 7 February 2006 (PST)
+
  
Would it be possible to set the player's liveangle?Just like setting one's position(origin).I would also like to set player's velocities(maybe a vec3 field), 'speed' is not working. --[[User:Kotoko|Kotoko]] 06:06, 26 May 2006 (PDT)
+
bani: RW access to all "sess.*" fields (sess.skillpoints, sess.startskillpoints, sess.startxptotal, ...) would be great. thanx! --[[User:Pdi|pdi]] 05:55, 2 August 2006 (PDT)
:viewangles is what you want --[[User:ReyalP|ReyalP]] 14:00, 26 May 2006 (PDT)
+
Seems i get it ..It WILL BE AVAILABLE at NEXT release ..not now .. right?-_- [[User:Kotoko|Kotoko]] 22:49, 26 May 2006 (PDT)
+
  
bani: please give access to fieldname 'r.eventParm' so we can do a global client only sound. --[[User:Pdi|pdi]] 01:52, 6 July 2006 (PDT)
+
bani: please make all "pers.*" fields (pers.clientTimeNudge, pers.clientMaxPackets, ...) available. thanx! --[[User:Pdi|pdi]] 01:04, 17 August 2006 (PDT)
 +
:you can get timenudge and maxpackets from the userinfo --[[User:ReyalP|ReyalP]] 20:19, 18 August 2006 (PDT)
 +
::i know, but i ask for all pers.* fields. pers.clientTimeNudge and pers.clientMaxPackets are only examples. :) --[[User:Pdi|pdi]] 01:56, 21 August 2006 (PDT)
 +
 
 +
bani: will we have rw access to those fields (all sess.* and all pers.*) with next update? please!! --[[User:Pdi|pdi]] 07:02, 19 October 2006 (PDT)
 +
: we are not going to add all the fields. A lot of them don't make sense for lua mods. Explain which ones you need --[[User:ReyalP|ReyalP]] 20:57, 5 February 2007 (PST)
 +
::Ok, didn't know why i'm asking for (long time ago) but fields for xp/skill (sess.skillpoints array - if i remember) control would be great. THX!! --[[User:Pdi|pdi]] 00:54, 7 February 2007 (PST)
 +
 
 +
'''ps.weapon''', so arbitrary weapons can be added to or removed from arbitrary classes. For example, trickjump servers don't like Field Ops spamming airstrikes or artillery, but they do appreciate the ammo they give out. --[[User:FARMICEUDICAL|FARMICEUDICAL]] 21:09, 5 December 2006 (PST)
 +
: ps.weapon won't do that for you. ps.weapon'''s''' might :) --[[User:ReyalP|ReyalP]] 17:14, 6 December 2006 (PST)
 +
 
 +
Okay then, '''ps.weapon''' so that medics can be set to spawn with the adrenaline needle out instead of the smg. --[[User:FARMICEUDICAL|FARMICEUDICAL]] 03:23, 11 December 2006 (PST)
 +
 
 +
Please give read access to '''g_campaignInfo_t''' in a field like '''campaignInfo'''. Thx!! --[[User:Pdi|pdi]] 08:57, 7 January 2007 (PST)
 +
 
 +
access to lasthurt_client and lasthurt_mod would be really nice. --[[User:Syd|Syd]] 02:30, 25 February 2007 (PST)
  
 
== LoadLib ==
 
== LoadLib ==
Line 82: Line 55:
  
 
(on windows it gives an error attept to call global load lin a nil valua)[[User:=FF=im2good4u|=FF=Im2good4u]] 05:16, 15 February 2006 (PST)
 
(on windows it gives an error attept to call global load lin a nil valua)[[User:=FF=im2good4u|=FF=Im2good4u]] 05:16, 15 February 2006 (PST)
----
+
 
 
== XP control not just skill ==
 
== XP control not just skill ==
  
Line 88: Line 61:
  
 
At least a callback on et.G_AddSkillPoints ( '''cno''', '''skill''', '''points''' ) [[User:=FF=im2good4u|=FF=Im2good4u]] 07:45, 8 March 2006 (PST)
 
At least a callback on et.G_AddSkillPoints ( '''cno''', '''skill''', '''points''' ) [[User:=FF=im2good4u|=FF=Im2good4u]] 07:45, 8 March 2006 (PST)
 +
 +
== Locations ==
 +
[22:08:57] <Vetinari> [NW]reyalP: if you're exposing map coords, it would
 +
  be nice to have something like et.PostitionName( et.gentity_get(id, "r.currentOrigin"))
 +
  <-- location name or map coords "(B, 3)", so I don't have to parse the _loc.dat ;->
 +
 +
== et_ClientSay ? ==
 +
err.. what's this:
 +
-- et_ClientSay had to be removed in order to intercept all commands
 +
-- so here's a wrapper for that
 +
    arg0 = et.trap_Argv(0) -- get the main command
 +
    if arg0 == "say" then
 +
        return et_ClientSay( clientNum, et.SAY_ALL, et.ConcatArgs(1))
 +
 +
This should be
 +
        return et.G_Say( clientNum, et.SAY_ALL, et.ConcatArgs(1))
 +
?
 +
 +
:No, et_ClientSay is a function you would define yourself to filter or do something with chats. It was it's own callback in earlier version of the API. -[[User:ReyalP|ReyalP]] 17:19, 24 February 2007 (PST)
 +
 +
== additional libs ==
 +
 +
HI i'd like LuaBit and LuaSocket support so we can enhance ET banishments: http://lua-users.org/wiki/BitwiseOperators
 +
http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/old/luasocket-2.0-alpha/dns.html
 +
(static compile if loadlib isnt gonna happen plx) -[[User:Hadr0|Hadr0]] 05:16, 8 October 2007 (PDT)
 +
:hmm been thinking about the hostname from the socket request.. this may not a practical as a hostname lookup can take several tenth of a second.. so there may be too much lag when a player connects.. since et is single-threaded and has to wait for the call to complete (?) Still, bit-support would come in handy for a variety of purposes. [[User:Hadr0|Hadr0]] 13:34, 9 November 2007 (PST)
 +
 +
== et_ClientSpawn + intermission ==
 +
<p>Instead of using the vulnerable et_Print(text) to find the medic, i'd like et_ClientSpawn(clientNum,the_guy_who_gave_the_vive_or_-1_if_spawned)</p><p>
 +
Hell why not add a trigger-intermission event? its so messy to monitor the gamestate-cvar within the runframe-event. and i just don't trust et_print().. players can change their name/inject BS into that function at will. Thank you!!</p>
 +
-[[User:Hadr0|Hadr0]] 06:46, 8 October 2007 (PDT)
 +
 +
== b_anticheat ==
 +
maybe a wild idea but hows about a callback function if a cheater is spotted via the etpro anticheat system? cos i dont want to kick 'em for 99999 seconds (on average our server is rebooted once per week) so i'd like to intercept the call with lua and do a proper ban. (+perhaps axx to the arrays where kicks are held, or is that engine stuff?) -[[User:Hadr0|Hadr0]] 05:56, 9 October 2007 (PDT)
 +
 +
== bug? ==
 +
et.trap_DropClient doesn't trigger the lua's own et_ClientDisconnect(). its not a big deal as its possible to call that function explicitly before dropping, and it does trigger other lua's disconnect-event. PB-drops for example DO trigger the disconnect event. So i was wondering if this was intentional? (i dont think earlier versions had it) -[[User:Hadr0|Hadr0]] 03:50, 10 October 2007 (PDT)

Latest revision as of 21:34, 9 November 2007

please call et_Obituary() and et_Print() at the end of the engine function because we can do better output then. example: the engine output (ETPlayer killed himself.) is after the lua output (Hahaha! ETPlayer seems to be a selfkill noob!). thx!! --pdi 09:13, 26 December 2006 (PST)

It is called at the beginning of the function so lua mods can override obituary and print entirely if they want. I can make a separate lua hook which is called at the end of the function, eg et_ObituaryPost and et_PrintPost. Bani 11:52, 3 January 2007 (PST)
Ok, this sounds good to me! Big THX!! :) Please have also a look at field section of this page! ;) --pdi 05:41, 4 January 2007 (PST)

Can we have a intercepted version of et_Obituary() to return 1 to intercept it with a mod and return 0 to pass it through to the server? --pdi 15:16, 8 March 2007 (PST)

Or a simple return STRING would be cool. So we can override the normal server output with other texts like "PlayerA does something with PlayerB.". Atm no returncode can replace et_Obituary's output!? Thx! --pdi 03:44, 9 March 2007 (PST)

Please add a third var to et_ClientCommand() function: et_ClientCommand(clientnum, command, isspam) - isspam indicates if the client command is ignored by spam filter limit (1) or not (0). Thx!! --pdi 05:01, 13 May 2007 (PDT)

Or can someone explain how spam protection is calculated by etpro mod? Any source code example please!? So I can reproduce it in LUA! THX! --pdi 05:34, 17 May 2007 (PDT)
Try loading my 'client command filter' before your mod -Hadr0 05:04, 8 October 2007 (PDT)
Sorry. I wrote my own function but it isn't really the same. I need an copy of the original code segment or the isspam flag! --pdi 03:43, 10 October 2007 (PDT)

IPC stuff


i would like a et_IPCReceive whit an return value so u can send info back on a request

i would like a et_IPCSend that can send to all lua mods then them mods can decide if the wana use that message or not =FF=Im2good4u 12:35, 8 January 2006 (PST)


 et_IPCReceive wouldn't send it to the other mod... afaik... so just use another send
 just et_IPCSend to all modules (afaik, you can even send to ones not there), simple loop function

gotenks 20:04, 8 January 2006 (CST)

yeh probely but its not verry handy its better to get the good vmnumber or to e able to send on mod filenames

apart from that returning a value will be more handy since tnhe u cna contine in 1 funtion else u got to reacise it in the recieve funtion =FF=Im2good4u 10:45, 9 January 2006 (PST)

Fields for the next release

I think Kotoko wants the ps.velocity field here. It would be a good idea, I think. --FARMICEUDICAL 20:23, 5 December 2006 (PST)

bani: RW access to all "sess.*" fields (sess.skillpoints, sess.startskillpoints, sess.startxptotal, ...) would be great. thanx! --pdi 05:55, 2 August 2006 (PDT)

bani: please make all "pers.*" fields (pers.clientTimeNudge, pers.clientMaxPackets, ...) available. thanx! --pdi 01:04, 17 August 2006 (PDT)

you can get timenudge and maxpackets from the userinfo --ReyalP 20:19, 18 August 2006 (PDT)
i know, but i ask for all pers.* fields. pers.clientTimeNudge and pers.clientMaxPackets are only examples. :) --pdi 01:56, 21 August 2006 (PDT)

bani: will we have rw access to those fields (all sess.* and all pers.*) with next update? please!! --pdi 07:02, 19 October 2006 (PDT)

we are not going to add all the fields. A lot of them don't make sense for lua mods. Explain which ones you need --ReyalP 20:57, 5 February 2007 (PST)
Ok, didn't know why i'm asking for (long time ago) but fields for xp/skill (sess.skillpoints array - if i remember) control would be great. THX!! --pdi 00:54, 7 February 2007 (PST)

ps.weapon, so arbitrary weapons can be added to or removed from arbitrary classes. For example, trickjump servers don't like Field Ops spamming airstrikes or artillery, but they do appreciate the ammo they give out. --FARMICEUDICAL 21:09, 5 December 2006 (PST)

ps.weapon won't do that for you. ps.weapons might :) --ReyalP 17:14, 6 December 2006 (PST)

Okay then, ps.weapon so that medics can be set to spawn with the adrenaline needle out instead of the smg. --FARMICEUDICAL 03:23, 11 December 2006 (PST)

Please give read access to g_campaignInfo_t in a field like campaignInfo. Thx!! --pdi 08:57, 7 January 2007 (PST)

access to lasthurt_client and lasthurt_mod would be really nice. --Syd 02:30, 25 February 2007 (PST)

LoadLib

Add loadlib ppl it says u have lua basic included but not loadlib !!

(on windows it gives an error attept to call global load lin a nil valua)=FF=Im2good4u 05:16, 15 February 2006 (PST)

XP control not just skill

I would like to request RW access to the "sess.skillpoints" array

At least a callback on et.G_AddSkillPoints ( cno, skill, points ) =FF=Im2good4u 07:45, 8 March 2006 (PST)

Locations

[22:08:57] <Vetinari> [NW]reyalP: if you're exposing map coords, it would 
  be nice to have something like et.PostitionName( et.gentity_get(id, "r.currentOrigin")) 
  <-- location name or map coords "(B, 3)", so I don't have to parse the _loc.dat ;->

et_ClientSay ?

err.. what's this:

-- et_ClientSay had to be removed in order to intercept all commands 
-- so here's a wrapper for that
   arg0 = et.trap_Argv(0) -- get the main command
   if arg0 == "say" then
       return et_ClientSay( clientNum, et.SAY_ALL, et.ConcatArgs(1))

This should be

       return et.G_Say( clientNum, et.SAY_ALL, et.ConcatArgs(1))

?

No, et_ClientSay is a function you would define yourself to filter or do something with chats. It was it's own callback in earlier version of the API. -ReyalP 17:19, 24 February 2007 (PST)

additional libs

HI i'd like LuaBit and LuaSocket support so we can enhance ET banishments: http://lua-users.org/wiki/BitwiseOperators http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/old/luasocket-2.0-alpha/dns.html (static compile if loadlib isnt gonna happen plx) -Hadr0 05:16, 8 October 2007 (PDT)

hmm been thinking about the hostname from the socket request.. this may not a practical as a hostname lookup can take several tenth of a second.. so there may be too much lag when a player connects.. since et is single-threaded and has to wait for the call to complete (?) Still, bit-support would come in handy for a variety of purposes. Hadr0 13:34, 9 November 2007 (PST)

et_ClientSpawn + intermission

Instead of using the vulnerable et_Print(text) to find the medic, i'd like et_ClientSpawn(clientNum,the_guy_who_gave_the_vive_or_-1_if_spawned)

Hell why not add a trigger-intermission event? its so messy to monitor the gamestate-cvar within the runframe-event. and i just don't trust et_print().. players can change their name/inject BS into that function at will. Thank you!!

-Hadr0 06:46, 8 October 2007 (PDT)

b_anticheat

maybe a wild idea but hows about a callback function if a cheater is spotted via the etpro anticheat system? cos i dont want to kick 'em for 99999 seconds (on average our server is rebooted once per week) so i'd like to intercept the call with lua and do a proper ban. (+perhaps axx to the arrays where kicks are held, or is that engine stuff?) -Hadr0 05:56, 9 October 2007 (PDT)

bug?

et.trap_DropClient doesn't trigger the lua's own et_ClientDisconnect(). its not a big deal as its possible to call that function explicitly before dropping, and it does trigger other lua's disconnect-event. PB-drops for example DO trigger the disconnect event. So i was wondering if this was intentional? (i dont think earlier versions had it) -Hadr0 03:50, 10 October 2007 (PDT)