Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- OnNameRequest script for Sapp
- -- By: Devieth
- api_version = "1.9.0.0"
- function OnScriptLoad()
- register_callback(cb['EVENT_PREJOIN'], "OnPlayerPrejoin")
- if halo_type == "PC" then ce = 0x0 else ce = 0x40 end
- end
- function OnPlayerPrejoin(PlayerIndex)
- local network_struct = read_dword(sig_scan("F3ABA1????????BA????????C740??????????E8????????668B0D") + 3)
- local client_network_struct = network_struct + 0x1AA + ce + to_real_index(PlayerIndex) * 0x20
- local name = read_widestring(client_network_struct, 12)
- local new_name = OnNameRequest(PlayerIndex, name)
- if name ~= new_name then -- Check if the new name is different from the players orignal name.
- write_widestring(client_network_struct, string.sub(new_name,1,11), 12) -- Set the new name if its different from the orignal.
- end
- end
- function OnNameRequest(PlayerIndex, Name)
- return Name -- Send back the decidred name.
- end
- -- Don't touch these...
- function write_widestring(address, str, len)
- local Count = 0
- for i = 1,len do -- Nuls out the old sting.
- write_byte(address + Count, 0)
- Count = Count + 2
- end
- local length = string.len(str)
- local count = 0
- for i = 1,length do -- Sets the new string.
- local newbyte = string.byte(string.sub(str,i,i))
- write_byte(address + count, newbyte)
- count = count + 2
- end
- end
- function read_widestring(Address, Size)
- local str = ""
- for i=0,Size-1 do
- if read_byte(Address + i*2) ~= 00 then
- str = str .. string.char(read_byte(Address + i*2))
- end
- end
- if str ~= "" then return str end
- return nil
- end
- function OnScriptUnload() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement