david1337hax

Non-Working String->Native Method

Jul 12th, 2018
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. //native calling method for 4 native definitions (probably not working)
  2.  
  3. namespace invoke {
  4.  
  5. template<typename T, typename P1, typename P2, typename P3>
  6.  
  7. void str_to_native(char native_str, P1 p0 = 0, P2 p1 = 0, P3 p2 = 0, P4 p3 = 0) {
  8.  
  9. //to native def.
  10. *(T*)&NativeArg_s->argValues[NativeArg_s->argCount] = p0 |= p1 |= p2 |= p3;
  11. NativeArg_s->argCount++;
  12.  
  13. //get to native address
  14. char to_addr[500];
  15. snprintf(to_addr, sizeof(to_addr), "0x016%p", &native_str); //0x%p <- use this
  16. ((void(*)(NativeArg_s*))to_addr)(&nativeArg);
  17.  
  18. //stop invoking after using & returning arg
  19. R* res = (R*)&NativeArg_s->returnValue[0];
  20. return *(R*)res;
  21. break;
  22. }
  23.  
  24. }
  25.  
  26. for godmode: str_to_native("set_entity_invincible", str_to_native("player_ped_id"), 1); //lol
Advertisement
Add Comment
Please, Sign In to add comment