Thursday, 28.03.2024, 16:45
Приветствую Вас Гость
Register | Login | RSS
Jedi Academy Server Security
[ New messages · Users · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Forum » JASS » English forum » How to simulate a server command for a client? (i need help for plugin)
How to simulate a server command for a client?
WEAPON_XDate: Wednesday, 22.02.2012, 01:52 | Message # 1
Group: User
Messages: 12
Reputation: 0
Status: Offline
Hello,

I have been trying to make a plugin that will simulate a command for a client.

For example, when the client says "!meditate", then the game will think the client did /meditate in console.

PS - it was kind of hard to register, the application kept saying i had the wrong security code. Finally, I registered from the ucoz main site.
 
BufferOverflowDate: Wednesday, 22.02.2012, 15:05 | Message # 2
Group: Developer
Messages: 47
Reputation: 0
Status: Offline
Quote (WEAPON_X)
the application kept saying i had the wrong security code
Sometimes happens. Ucoz bug, can't do anything with that.
In JASS_vmMain, you can catch GAME_CLIENT_COMMAND and detect, when player says "!meditate". There you must set intercept flag to true and use JASS_RET_IGNORED.
Then, you must catch G_ARGV and G_ARGC. Mod will call them. But, your intercepted G_ARGV and G_ARGC must simulate "meditate" instead of "say !meditate":
Code

C_DLLEXPORT int JASS_syscall( ... ){
      if(intercept_flag){
       if (cmd == G_ARGC){
        JASS_RET_SUPERCEDE (1);// just one parameter;
       }
       if (cmd == G_ARGV){
        if (arg0 == 0){
         strcpy_s((char*)arg1, arg2,"meditate");
         JASS_RET_SUPERCEDE ( 1 );
        }else{//normally this not happens
         (char*)arg1=0;
         JASS_RET_SUPERCEDE ( 1 );
        }

...somehow alike. Then, you should in JASS_vmMain_Post set intercept_flag back to false. This is usual way of simulating cmds.
But, not all the commands are sends to mod, so they couldn't be simulated that way. If I'm right, the "meditate" is one of them. But, you can try to set meditation taunt event directly instead of using cmd (EV_TAUNT in currentState->event and TAUNT_MEDITATE in currentState->eventParm)
 
HepoDate: Wednesday, 22.02.2012, 15:06 | Message # 3
Group: User
Messages: 12
Reputation: 0
Status: Offline
i'm afraid thats not possible due that jass is SERVER-SIDE ONLY, and u're trying to make CLIENT do something.
upd: u can do it only if u're using standart anims, such as EV_TAUNT, but still u can not add new animation


Message edited by Hepo - Wednesday, 22.02.2012, 15:18
 
WEAPON_XDate: Thursday, 23.02.2012, 08:21 | Message # 4
Group: User
Messages: 12
Reputation: 0
Status: Offline
thank you for the example, it gives me some good ideas. However, my request was not a good example of what I wanted to do.

I play lugormod. In lugormod there is a command /blowup <number>, that a client can do. So the client can blow himself up.
I thought this would be fun if the client did /blowup <myself> when he received the message "@blowup".

I am catching the message and getting the client that receives it. So now, having the number, is it possible to call vmmain(GAME_CLIENT_COMMAD, idnum, arg1, ....) to trick the game into thinking someone is doing a command.

I tried calling JASS_vmMain(GAME_CLIENT_COMMAND, idnum, arg1,....) and then in JASS_vmMain, i just replace the stuff in arg1 with "blowup", but then it said "unknown client command: blowup"

When I do it with g_vmMain(GAME_CLIENT_COMMAND,idnum, arg1,....) it doesn't seem to go through JASS_vmMain, and in game it says, "uknown cmd +use".

I tried with a friend in game. Using lugormod we placed a button that targets a private print to person who presses the button. And something funny happened. When I did /drinkme (the command that makes you smaller) and then my friend pressed the button, then he would become smaller as if he did the command.
 
junkofmiloDate: Tuesday, 05.05.2020, 08:05 | Message # 5
Group: User
Messages: 4
Reputation: 0
Status: Offline
This is great
 
Forum » JASS » English forum » How to simulate a server command for a client? (i need help for plugin)
  • Page 1 of 1
  • 1
Search: