SHARE
TWEET

Untitled

a guest Aug 13th, 2017 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. JSAPI_FUNC(me_teleWalk)
  2. {  
  3.     if(!WaitForGameReady())
  4.         THROW_WARNING(cx, "Game not ready");
  5.  
  6.     myUnit* lpUnit = (myUnit*)JS_GetPrivate(cx, obj);
  7.  
  8.     *rval = JSVAL_FALSE;
  9.  
  10.     if(!lpUnit || (lpUnit->_dwPrivateType & PRIVATE_UNIT) != PRIVATE_UNIT)
  11.         return JS_TRUE;
  12.        
  13.     DWORD dwX = JSVAL_TO_INT(argv[0]);
  14.     DWORD dwY = JSVAL_TO_INT(argv[1]);
  15.    
  16.     BYTE aPacket[5] = { NULL };
  17.     aPacket[0] = 0x5f;
  18.     *(DWORD*)&aPacket[1] = dwX;
  19.     *(DWORD*)&aPacket[3] = dwY;
  20.  
  21.     D2NET_SendPacket(5, 1, aPacket);
  22.    
  23.     BYTE bPacket[9] = { NULL };
  24.     bPacket[0] = 0x4b;
  25.     *(DWORD*)&bPacket[1] = lpUnit->dwType;
  26.     *(DWORD*)&bPacket[5] = lpUnit->dwUnitId;
  27.    
  28.     D2NET_SendPacket(9, 1, bPacket);
  29.    
  30.     *rval = JSVAL_TRUE;
  31.    
  32.     return JS_TRUE;
  33. }
RAW Paste Data
Top