Forum

> > CS2D > Scripts > "id" for hook: parse
Forums overviewCS2D overview Scripts overviewLog in to reply

English "id" for hook: parse

14 replies
To the start Previous 1 Next To the start

old "id" for hook: parse

Rocik
User Off Offline

Quote
Dear DC,
when you will be have a free time, try to do "id" for hook parse because it's important there(e.g. for return badly written command).
I know, there is some ways to do it.

Now i just want to confirm that: print in parse goes to all people in server?

old Re: "id" for hook: parse

Flacko
User Off Offline

Quote
INFO.TXT has written
rcon(cmds,id,ip,port)                         on remote command execution
-cmds: received remote control command(s)
-id: player who sent the cmds (or 0 if player is not on server)
-ip: IP of cmd sender
-port: Port of cmd sender
>return:     0 - proceed normally (execute RCon commands)
          1 - don't execute RCon commands


Rocik has written
Now i just want to confirm that: print in parse goes to all people in server?

If I'm now wrong, the server and the ones with rcon are the only players that can read console output.

old Re: "id" for hook: parse

Rocik
User Off Offline

Quote
Commands like mp_turretdamage are writing at hook parse.
Hook rcon is only about using these commands.

old Re: "id" for hook: parse

DC
Admin Off Offline

Quote
Flacko already said it: just use the rcon hook for that! parse-processes which are NOT executed via rcon are always executed by the server itself. pretty simple.

print in parse? are you talking about something like
1
parse("print test")
this doesn't work. print is NOT a cs2d command. it's a Lua command. so you have to use it the direct way (in Lua)
1
print("test")
this command is only for LOCAL console output. it will not be sent to anyone (see cs2d lua cmd print).
you have to use cs2d lua cmd msg instead (this is a Lua command, so again: without parse!)

old Re: "id" for hook: parse

EngiN33R
Moderator Off Offline

Quote
But if I want to make a function that will only be executed when a player (any player) writes e.g. 'jump' in console (without RCon), what do I use? Parse is only for server, rcon is only for rcon.

old Re: "id" for hook: parse

DC
Admin Off Offline

Quote
that's technically impossible dude. local console input without rcon is never sent to the server. so how should the server know about it and execute a parse hook? simply doesn't work.

you can't handle events on your server which are performed on the clientside only.

old Re: "id" for hook: parse

Rocik
User Off Offline

Quote
I was thinking about parse hook not parse command.
print is a bit like msg. I can use msg2, but in hook: parse isn't id.
(for i=1,32 do sucks)

old Re: "id" for hook: parse

DC
Admin Off Offline

Quote
print in a parse hook will probably only go to the guy who executed the command (which caused the parse-hook to be executed) using rcon.

there is actually no command to generate CONSOLE output for (all/specific) clients.

you shouldn't do that anyway because most people will not read their console. use other commands instead which generate text in the user interface like msg

old Re: "id" for hook: parse

Rocik
User Off Offline

Quote
It tell you that why i'am asking for that.
In hook parse i can't do for example: if player(id,"usgn")==x then

@EDIT: math.random dont effect if i use dedicated server... wtf?

old Re: "id" for hook: parse

Flacko
User Off Offline

Quote
Rocik has written
It tell you that why i'am asking for that.
In hook parse i can't do for example: if player(id,"usgn")==x then


You are misunderstanding the way the parse hook works.

What a player writes in console isn't sent to the server as a parse-command unless you use rcon.

Therefore, the only way to achieve something like that is through the rcon command. The circuit looks like the following:

Player writes rcon command in console (with the right rcon) -> "rcon" hook gets called with id and ip parameters -> "parse" hook gets called without id nor ip parameters because they are "discarded" by CS2D because of technical reasons that we shouldn't care.

old Re: "id" for hook: parse

Rocik
User Off Offline

Quote
What about "New Game"? There server can't use rcon.
I won't to use rcon hook to make a command.
If i do rcon-hook command, that command will only work with rcon. It's possible, but limited.

And both rcon and parse hook is causes many errors/bugs.

old Re: "id" for hook: parse

DC
Admin Off Offline

Quote
I suggest to use the chat system instead (say-hook). it's so much easier to handle.
check if the text starts with ! and if yes: handle it with your Lua script in the say-hook. add a return 1 in your script so the chat text is not displayed.

old Re: "id" for hook: parse

Rocik
User Off Offline

Quote
Yea, you are right, but it's not profesional :3
I'am using chat commands only for player. Admin must have console commands.

old Re: "id" for hook: parse

DC
Admin Off Offline

Quote
haha.. well.. then: use a global variable and set the initial value to 0.

on rcon hook: set variable = player id

on parse hook: check this variable to see which player executed the stuff. afterwards set variable = 0

on a NON dedicated server [game("dedicated")]: set the variable to 1 instead of 0.

old Re: "id" for hook: parse

Rocik
User Off Offline

Quote
Okey
I really dont need that (id for parse), but it could make easier writing scripts.
@Edit: On dedic, parse-hook cmd's can be use only with rcon... so... same commands is possible to do in rcon-hook?


Btw. I dont thourght about this varable, nice idea.


Then... tell me, why math.random in my script working in non dedic., but if i run dedic it always chooses valute 1
edited 1×, last 22.03.11 08:31:34 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview