More questions. Arrays, overlays

  1. i do this Vec = {}.
    then i fill it Vec[1] = { X = 2, Y = 3, Z = 5}
    How can i retrive X for instance?

  2. How can i give a client overlays? Like stunstick effects etc.

thanks guys.

Lol thank you Maker in advance :smiley:

[lua]local Vec = {}
Vec[1] = {X=2, Y=3, Z=5}
print(Vec[1][“X”]) – Same thing[/lua]

Just to let you know, there is a Vector object in Garrysmod Lua.

Vector was just an example im gonna use it to do more complex things, but thanks this makes thing ALOT simpler lol

By overlays i mean this

ClientCommand(Client, “r_screenoverlay debug/yuv.vmt”);

^ Sourcemod up there lol , yes im trying to learn lua now and ur a great helper :D.

[lua]function PlayaOn(ply)
ply:ConCommand(“r_screenoverlay debug/yuv.vmt”)
concommand.Add("+overlay", PlayaOn)
function PlayaOff(ply)
ply:ConCommand(“r_screenoverlay debug/yuv.vmt”)
concommand.Add("-overlay", PlayaOff)

but that is flagged as a cheat command i think :D, so i think we need to deflag it, heres a sourcemod exapmle if u’d like

SetCommandFlags("r_screenoverlay", (GetCommandFlags("r_screenoverlay") - FCVAR_CHEAT));

You could just use pp_screenoverlay or whatever it is, the one inside the post processing menu in the Q menu.

You would need, Cvar2.
cvar2.SetFlags(“r_screenoverlay”, cvar2.GetFlags(“r_screenoverlay”) - FCVAR_CLIENTCMD_CAN_EXECUTE)[/lua]