BigETI

CreateVarObjectEx and GetObjectModelID

Mar 7th, 2011
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.09 KB | None | 0 0
  1. //CreateVarObjectEx and GetObjectModelID made by BigETIĀ©
  2.  
  3. //Defines
  4. #define UseBrackets if(negative != positive)
  5.  
  6. #define CreateVarObjectEx(%0,%1,%2);    UseBrackets\
  7.     {\
  8.     %0 = CreateObject(%1,%2);\
  9.     gObjectModelID[%0] = %1;\
  10.     }
  11.  
  12. //News
  13. new bool:negative = false, bool:positive = true; //some variables to make the define UseBrackets useable without annoying warning messages.
  14.  
  15. new gObjectModelID[MAX_OBJECTS]; //This stores the model ID of the listed objects
  16.  
  17. new obj; //This should store the ID of your object below.
  18.  
  19. //Stocks
  20. stock GetObjectModelID(objectid) return gObjectModelID[objectid];
  21.  
  22. //Publics (also in this case some examples)
  23. public OnGameModeInit()
  24. {
  25.     CreateVarObjectEx(obj, 16094, 191.190430, 1870.044922, 29.056709, 0.0000, 0.0000, 0.0000, 300.0); //Your Object
  26.     MoveObject(obj, 117.453537, 1960.304199, 19.011192); //Object move example
  27.     return 1;
  28. }
  29.  
  30. public OnObjectMoved(objectid)
  31. {
  32.     new str[128];
  33.     format(str, sizeof(str), "Object ID: %d; Model: %d, has been moved.", objectid, GetObjectModelID(objectid));
  34.     SendClientMessageToAll(0xFF0000FF, str);
  35.     return 1;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment