Saturday, 27.04.2024, 13:46
Приветствую Вас Гость
Register | Login | RSS
Jedi Academy Server Security
[ New messages · Users · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Forum » JASS » English forum » death parsing
death parsing
junkofmiloDate: Tuesday, 05.05.2020, 08:06 | Message # 1
Group: User
Messages: 4
Reputation: 0
Status: Offline
Hello,

I'm trying to figure out how to parse the death event.  I would like to find out whether the player died by suicide or by a weapon
of another player in order to run a command on the killer.

So far I wrote this:

if (cmd == G_UNLINKENTITY) {
        gentity_t* ent = (gentity_t*)arg0;
        
        if (!strncmp(ent->classname, "tempEntity", 10)) {
                if (ent->s.eType = 111) { //111 is an all broadcast kill ent
        
                       int client_killer = ent->s.otherEntityNum2; // client who killed
other player
                        g_syscall(G_SEND_CONSOLE_COMMAND, EXEC_APPEND, QMM_VARARGS("cmd %i", client_killer);
                        JASS_RET_SUPERCEDE(1);
                }
        }
}

I wrote this based off: https://jass.ucoz.net/forum/19-15-1
If I kill someone I successfully have the command run on myself.

My issue is if I type /kill, it will fire the console command too.  I
tried including a check that returns supercede before the g_syscall like
so:

if (!strncmp(ent->s.eventParm, "MOD_SUICIDE", 12)) {
    JASS_RET_SUPERCEDE(1);
}

however it tells me that I can't convert an int to a const char*.  I think
that's because s.eventParm is an integer of the event?  I know this
forum isn't viewed a lot but if anyone can help thanks!

Also I had to post 3 times in order to make a topic so I apologize for the spam!
 
Forum » JASS » English forum » death parsing
  • Page 1 of 1
  • 1
Search: