Guest User

Untitled

a guest
Dec 12th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.02 KB | None | 0 0
  1. /*
  2. Procedure to create an object at a specific players database position
  3. requires two parameters
  4. otype and fuel
  5. set fuel to 0 if it is a building
  6. example:
  7.  
  8. exec createobj 'TentStorage', 0
  9.  
  10. Change UID and Instance before creating
  11.  
  12. */
  13. CREATE DEFINER=`dayz`@`localhost` PROCEDURE `createobj`(IN `otype` VARCHAR(50), IN `fuel` DOUBLE)
  14.     LANGUAGE SQL
  15.     NOT DETERMINISTIC
  16.     CONTAINS SQL
  17.     SQL SECURITY DEFINER
  18.     COMMENT ''
  19. BEGIN
  20. set @NewID = (select (max(id)+1) as id1 from dayz.objects) ;
  21. set @uid1 = (select (max(uid)+1) as id1 from dayz.objects) ;
  22. set @pos1 = (select pos from dayz.main where death = 0 and uid = '32850310');
  23. update dayz.objects
  24. set instance  = 1
  25. where Id = @NewID;
  26. insert into dayz.objects
  27. set Id = @NewID;
  28. update dayz.objects
  29. set uid = @uid1
  30. where Id = @NewID;
  31. update dayz.objects
  32. set pos = @pos1
  33. where Id = @NewID;
  34. update dayz.objects
  35. set Inventory = '[]'
  36. where Id = @NewID;
  37. update dayz.objects
  38. set otype = otype
  39. where Id = @NewID;
  40. update dayz.objects
  41. set fuel = fuel
  42. where Id = @NewID;
  43. END
Add Comment
Please, Sign In to add comment