Jump to content
Moopler Closing Read more... ×
Moopler
  • 0
Sign in to follow this  
Xtsukuyomi

Question Help with updating Change Channel Random

Question

Hey mooplers,

I found an old script for 177.3 to change channels to a random channel when someone is on the map with you.

I have been trying for a couple days but I can't seem to get it working.

If anyone can help me with this, that would be most welcome.

Also, please let me know what was done to get it working as I tried to update it myself using the guide for updating scripts :/

 

 

//Change channel v177.3

define(CUP,023B1B14)//8B 0D ? ? ? ? 89 45 ? 85 C0 0F 84 ? ? ? ? [MOV CALL giua]
define(CCPLZ,00886FC0)//6A FF 68 ? ? ? ? 64 A1 00 00 00 00 50 83 EC ? 53 55 56 57 A1 ? ? ? ? 33 C4 50 8D 44 24 ? 64 A3 00 00 00 00 8B F1 E8 ? ? ? ? 8B 0D ? ? ? ? E8 ? ? ? ?
define(PUSH,01C1CC38)//Push below CCPLZ
define(PP,008565B0)//6A FF 68 ? ? ? ? 64 A1 00 00 00 00 50 83 EC ? 53 56 57 A1 ? ? ? ? 33 C4 50 8D 44 24 ? 64 A3 00 00 00 00 8B D9 8B 0D ? ? ? ? 85 C9 [First Result]
define(GF,004C5420)//56 8B 35 ? ? ? ? 85 F6 74 ? 8B 46 ? 8B 90 ? ? ? ? 8D 4E ? 68 ? ? ? ? FF D2 85 C0 74 ? 8B C6 5E C3 [First Result]


[Enable]
Alloc(Hook, 128)
Alloc(People, 4)
Alloc(Channel, 4)

Label(Return)
Label(ChangeChannel)
Label(End)

Channel:
dd #5 // 0 Indexed

People:
dd #1

CCPLZ: // CField::Update()
jmp Hook
db 90 90
Return:

Hook:
push ecx
mov ecx, [CUP] // CUserPool : 8B 0D ? ? ? ? 89 45 ? 85 C0 0F 84 ? ? ? ? [in MOV]
mov ecx, [ecx+18] // People Count
cmp ecx, [People]
jae ChangeChannel
jmp End

ChangeChannel:
push [Channel] // channel
call GF // get_field()() : 56 8B 35 ? ? ? ? 85 F6 74 ? 8B 46 ? 8B 90 ? ? ? ? 8D 4E ? 68 ? ? ? ? FF D2 85 C0 74 ? 8B C6 5E C3
mov ecx,eax
call PP // CField::SendTransferChannelRequest : 6A FF 68 ? ? ? ? 64 A1 00 00 00 00 50 83 EC ? 53 56 57 A1 ? ? ? ? 33 C4 50 8D 44 24 ? 64 A3 00 00 00 00 8B D9 8B 0D ? ? ? ? 85 C9 [First Result]

End:
pop ecx
push -01
push PUSH
jmp Return

[Disable]
DeAlloc(Hook)
DeAlloc(People)

CCPLZ: //6A FF 68 ? ? ? ? 64 A1 00 00 00 00 50 83 EC ? 53 55 56 57 A1 ? ? ? ? 33 C4 50 8D 44 24 ? 64 A3 00 00 00 00 8B F1 E8 ? ? ? ? 8B 0D ? ? ? ? E8 ? ? ? ?
push -01
push PUSH

Share this post


Link to post

6 answers to this question

Recommended Posts

  • 0
Guest yuri
; Not a pro at this. 
;  
; Adding this should support random channel switches
; (1) Create random range using the default of Channel: dd XX as a seed.   
mov  eax,[Channel]
mov  edx,#19 ; Max Channel Count
mul  edx
add  eax,#1
mov  [Channel],eax
ror   eax,10 ; New Range is eax 
; (2) Apply it
mov  ebx,#19 ; Max Channel Count
xor  edx,ebx
div  ebx
mov [Channel],edx ; Where edx is the remainder of the Range / Max Channel Count
; (3) Pushing Result
Push [Channel]
;; Feel free to correct this.
  

You could try to add this to it so it would be random or use ce lua and make a function that returns a random int then adds to the original script.

 

Edited by yuri

Share this post


Link to post
  • 0
Guest yuri

Here is a fix of what my idea after looking up more info:

;; random min
rmin:
dd  0

;; random seed
rseed:
dd  100711433

;; random max
rmax: 
dd 20

;; should random number from 0-19 in eax on call
;; x(n+1) = (a * x(n) + c) mod m
;; http://dept.stat.lsa.umich.edu/~kshedden/Courses/Stat606/Notes/random.pdf
random:
rdtsc
adc eax, edx
adc eax, rmin
mul rseed
adc eax, edx
mov rmin, eax  
mul rmax
mov eax, edx
ret

Hopefully it will work after calling to random then setting Channel with the info

mov [Channel],eax


Also, that is my mistake for rushing and you are right.

On 12/15/2016 at 08:13, DAVHEED said:

@yuri won't that CC into channel 1 repeatedly? you xor edx to 0, then mov that into [Channel]

 

 

Edited by yuri

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×