Debriefing > Questions, Help, & How To's
LUA coding question
Doc.NO:
I have a map sending a server command on some events, using point_server_command. Wondering if there's a way to use that server command in a LUA coded gameplay? After checking the CB list, my hopes are low, but still wanted to ask.
Mark [lodle]:
hmmm, the ony way i think you can hax it is make a cvar and check its value in the onthink function
Doc.NO:
thanks. I think the cvar trick will do it.
Doc.NO:
Well I did it, and works great. If someone is interested, I used a trigger with a point_servercommand entity on the map
(bb_command is the point_servercommand)
And then, in the think() LUA CB:
--- Code: ---
if(GetCVar("bb_mi6_score") == "1" and (GetTime() >= g_mi6_timer)) then
g_mi6_timer = GetTime() + 2;
-- any command you'd like goes here:
AddToTeamScore(TEAM_MI6,1);
elseif(GetCVar("bb_mi6_score") == "0") then
g_mi6_timer = 0;
end
--- End code ---
I'm sure there is a better way to code that, but actually it works, and its all I want :P The only downside of this is the chat area spam on CVAR change.
Mark [lodle]:
Ill add a flag to create cvar which will remove the spam on change but its good to see you got it working.
Navigation
[0] Message Index
[#] Next page
Go to full version