script_name'id_kill' script_author'imring' ffi = require 'ffi' ffi.cdef[[ struct stKillEntry { char szKiller[25]; char szVictim[25]; uint32_t clKillerColor; // D3DCOLOR uint32_t clVictimColor; // D3DCOLOR uint8_t byteType; } __attribute__ ((packed)); struct stKillInfo { int iEnabled; struct stKillEntry killEntry[5]; int iLongestNickLength; int iOffsetX; int iOffsetY; void *pD3DFont; // ID3DXFont void *pWeaponFont1; // ID3DXFont void *pWeaponFont2; // ID3DXFont void *pSprite; void *pD3DDevice; int iAuxFontInited; void *pAuxFont1; // ID3DXFont void *pAuxFont2; // ID3DXFont } __attribute__ ((packed)); ]] function main() while not isSampAvailable() do wait(0) end local kill = ffi.cast('struct stKillInfo*', sampGetKillInfoPtr()) while true do wait(0) if sampGetGamestate() == 3 then _, myid = sampGetPlayerIdByCharHandle(playerPed) end for i = 0, 4 do local n_killer = ffi.string(kill.killEntry[i].szKiller) local n_killed = ffi.string(kill.killEntry[i].szVictim) if n_killer:sub(#n_killer) ~= ' ' then local id_killer = sampGetPlayerIdByNickname(n_killer) if id_killer then kill.killEntry[i].szKiller = ffi.new('char[25]', ( n_killer .. '[' .. id_killer .. ']' ):sub(1, 23) .. ' ' ) end end if n_killed:sub(#n_killed) ~= ' ' then local id_killed = sampGetPlayerIdByNickname(n_killed) if id_killed then kill.killEntry[i].szVictim = ffi.new('char[25]', ( n_killed .. '[' .. id_killed .. ']' ):sub(1, 23) .. ' ' ) end end end end end function sampGetPlayerIdByNickname(nick) if sampGetPlayerNickname(myid) == nick then return myid end for id = 0, 1000 do if sampIsPlayerConnected(id) and nick == sampGetPlayerNickname(id) then return id end end end