Advertisement
comniemeer

SAMP Relog

Apr 14th, 2016
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. restartGameEx() {
  2.     if(!checkHandles())
  3.         return -1
  4.    
  5.     dwAddress := readDWORD(hGTA, dwSAMP + SAMP_INFO_OFFSET)         ;g_SAMP
  6.     if(ErrorLevel || dwAddress==0) {
  7.         ErrorLevel := ERROR_READ_MEMORY
  8.         return -1
  9.     }
  10.    
  11.     dwFunc := dwSAMP + 0xA060
  12.    
  13.     VarSetCapacity(injectData, 11, 0) ;mov, call, retn
  14.    
  15.     NumPut(0xB9, injectData, 0, "UChar")    ;mov ecx    0+1
  16.     NumPut(dwAddress, injectData, 1, "UInt")            ;1+4
  17.     NumPut(0xE8, injectData, 5, "UChar")    ;call       5+1
  18.     offset := dwFunc - (pInjectFunc + 10)
  19.     NumPut(offset, injectData, 6, "Int")    ;           6+4
  20.     NumPut(0xC3, injectData, 10, "UChar")   ;       10+1
  21.    
  22.     writeRaw(hGTA, pInjectFunc, &injectData, 11)
  23.     if(ErrorLevel)
  24.         return false
  25.    
  26.     hThread := createRemoteThread(hGTA, 0, 0, pInjectFunc, 0, 0, 0)
  27.     if(ErrorLevel)
  28.         return false
  29.    
  30.     waitForSingleObject(hThread, 0xFFFFFFFF)
  31.    
  32.     return true
  33. }
  34.  
  35. disconnectEx() {
  36.     if(!checkHandles())
  37.         return 0
  38.    
  39.     dwAddress := readDWORD(hGTA, dwSAMP + SAMP_INFO_OFFSET)         ;g_SAMP
  40.     if(ErrorLevel || dwAddress==0) {
  41.         ErrorLevel := ERROR_READ_MEMORY
  42.         return 0
  43.     }
  44.    
  45.     dwAddress := readDWORD(hGTA, dwAddress + 0x3c9)         ;pRakClientInterface
  46.     if(ErrorLevel || dwAddress==0) {
  47.         ErrorLevel := ERROR_READ_MEMORY
  48.         return 0
  49.     }
  50.    
  51.     ecx := dwAddress        ;this
  52.    
  53.     dwAddress := readDWORD(hGTA, dwAddress)      ;vtable
  54.     if(ErrorLevel || dwAddress==0) {
  55.         ErrorLevel := ERROR_READ_MEMORY
  56.         return 0
  57.     }
  58.    
  59.     VarSetCapacity(injectData, 24, 0) ;mov, call, retn
  60.    
  61.     NumPut(0xB9, injectData, 0, "UChar")    ;mov ecx    0+1
  62.     NumPut(ecx, injectData, 1, "UInt")          ;1+4
  63.    
  64.     NumPut(0xB8, injectData, 5, "UChar")    ;mov eax    5+1
  65.     NumPut(dwAddress, injectData, 6, "UInt")            ;6+4
  66.    
  67.     ;NumPut(0x006A006A, injectData, 10, "UInt")  ; 2x push          10+4
  68.    
  69.     NumPut(0x68, injectData, 10, "UChar")       ;10 + 1     ;push style
  70.     NumPut(0, injectData, 11, "UInt")       ;11 + 4
  71.    
  72.     NumPut(0x68, injectData, 15, "UChar")       ;15 + 1     ;push style
  73.     NumPut(500, injectData, 16, "UInt")     ;16 + 4
  74.    
  75.     ;---
  76.    
  77.     NumPut(0x50FF, injectData, 20, "UShort")            ;20 + 2
  78.     NumPut(0x08, injectData, 22, "UChar")           ;22 + 1
  79.    
  80.     NumPut(0xC3, injectData, 23, "UChar")   ;retn       23+1
  81.    
  82.     writeRaw(hGTA, pInjectFunc, &injectData, 24)
  83.     if(ErrorLevel)
  84.         return false
  85.    
  86.     hThread := createRemoteThread(hGTA, 0, 0, pInjectFunc, 0, 0, 0)
  87.     if(ErrorLevel)
  88.         return false
  89.    
  90.     waitForSingleObject(hThread, 0xFFFFFFFF)
  91.    
  92.     return true
  93. }
  94.  
  95. setrestart() {
  96.     VarSetCapacity(old, 4, 0)
  97.    
  98.     dwAddress := readDWORD(hGTA, dwSAMP + SAMP_INFO_OFFSET)         ;g_SAMP
  99.         if(ErrorLevel || dwAddress==0) {
  100.             ErrorLevel := ERROR_READ_MEMORY
  101.             return 0
  102.     }
  103.  
  104.     NumPut(9,old,0,"Int")
  105.     writeRaw(hGTA, dwAddress + 957, &old, 4)
  106. }
  107.  
  108. restart() {
  109.     restartGameEx()
  110.     disconnectEx()
  111.     Sleep 1000
  112.     setrestart()
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement