File size: 1,911 Bytes
7e9dc27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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