User talk:Major Zeman

From WolfWiki
Revision as of 13:22, 20 April 2007 by Major Zeman (talk | contribs) (init)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
http://forums.acidrainclan.com/uploads/MajorZeman/2006-04-26_152247_avatar_zeman.jpg Major Zeman can be currently (= for about last 3 years) found at forums.acidrainclan.com.





LUA Code fragments

During my first adventure into the world of LUA+ETPro, I ran into several problems. Here are a few functions/code fragments that I think are worth mentioning or could be useful to someone in future:


get GUID

A simple function that gives you guid of the player in given slot. The function performs some checks and converts the guid to uppercase for exact matches.

-- gets user's guid
-- returns nil if not applicable to entity number
function getguid(targetID)
    if (targetID == nil) or (targetID > tonumber(et.trap_Cvar_Get("sv_maxclients"))) or (not et.gentity_get(targetID,"inuse")) then
        return nil
    end

    local userinfo = et.trap_GetUserinfo( targetID )
    local guid = et.Info_ValueForKey( userinfo, "cl_guid" )
    -- upcase for exact matches
    guid = string.upper(guid)

    return guid
end




MZ's TJ mod

version: 1.5
released: 25.3.2007
[download zip | lua]


Description

Yet another /save /load mod - this one should be useful for learning and teaching how to trickjump, for pro TJ servers it's probably rather useless.

The mod is based on Kyoko's HSP_TJmod, with fragments of code (sometimes big fragments eh) from ==FF==im2good4u, Furion and robably also from ReyalP. Feengur's ZeN mod was a source of inspiration for me, too.


Key features (as found in Kyoko's TJmod)

  • /save and /load - stores your possition on map for each team separately and allows you to teleport back
  • /gotohell - server console command, gibs player
  • /goto and /iwant - server console commands, teleport one person to another
  • /goback - if the person was teleported using /iwant, this server console command moves them back to original location


New features (differences from original mod)

  • some code cleanup and formating, parameter checks blah blah blah etc.
  • /save2 and /load2 - second save slot. This one is common for both teams and you can /save2 and /load2 also as spectator
  • easy jump skipping using /save2 as spectator (here you'll have to decide whether this mod is good or bad for your server)
  • some more administrative commands: /rmsaves, /sdisable, /senable (inspired by ZeN)
  • all commands allow partial name match as player identification in parameters (altered code from im2good4u)
  • saves and /sdisable are persistent across player's reconnects (as long as the script is not reloaded by loading other map etc. the saves persist - the save slots are indexed by guid not player slot)
  • /iwant and /goback print explanatory script to target
  • /gotohell (and alias /gib) play a sound (again a bit of code from im2good4u) and print a message to everyone
  • /disarm command strips a player off all weapons except syringes, knife, binocs and pliers (maybe some more but no shooting weapons) - either for current life or permanently (again altered im2good4u's code)
  • /dist gives you distance from others - rather useless but fun command that I found has one practical use after all - you can see who specs you
  • /realsay and /realvsay - sends message only to players close to you - this sounds pretty weird but it's useful if you want to explain a trickjump in one room and don't want to confuse those at other jumps
  • /TJplayers server console command gives admins overview of info held about the connected players
  • /TJhelp gives overview of client commands, /rcon TJhelp gives help for server console commands
  • all server commands behave properly and print their output back to caller's console even if used through SemiAdmin command (found a workaround :)


Drawbacks

  • no support for etadmin - never worked with that and don't know how it works
  • tried to make users stop on load and failed just like all before me did :D
  • the workaround to print output back to semiadmin is a bit messy and uses et_Print callback (possible server performance decrease)
  • not good for pro TJ servers and seevers without active admins - you can really skip jumps easily and eventually end maps in no time


Thank you

Kyoko / Kotoko
im2good4u
Furion
ReyalP
Feengur
All the guys who wrote LUA API description and code examples on http://wolfwiki.anime.net/