AryanV

fdg

Jul 18th, 2015
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.57 KB | None | 0 0
  1. CMD:createobject(playerid,params[]){
  2. new modelid;
  3. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED,"Sorry but you are not authorised to use this command");
  4. if(sscanf(params, "i" ,modelid)) return SendClientMessage(playerid, COLOR_YELLOW,"Usage: /createobject <Model ID>");
  5. new Float:x,Float:y,Float:z;
  6. GetPlayerPos(playerid,x,y,z);
  7. for(new i=0; i<MAX_OBJ;i++){
  8. if(!ObjCreated[i]){
  9. objectz[i]=CreateDynamicObject(modelid,x+2,y,z,0,0,0);
  10. new str[128];
  11. format(str,sizeof(str),"You have created a object(ID:%d) with Model ID:%d",i,modelid);
  12. SendClientMessage(playerid, COLOR_BLUE,str);
  13. new Float:x1,Float:y1,Float:z1;
  14. GetObjectPos(objectz[i],x1,y1,z1);
  15. new Float:x2,Float:y2,Float:z2;
  16. GetObjectRot(objectz[i],x2,y2,z2);
  17. ObjCreated[i]=true;
  18. gobject[i][model]=modelid;
  19. gobject[i][posx]=x1;
  20. gobject[i][posy]=y1;
  21. gobject[i][posz]=z1;
  22. gobject[i][rotx]=x2;
  23. gobject[i][roty]=y2;
  24. gobject[i][rotz]=z2;
  25. SaveFile(i);
  26.     break;
  27. }
  28. }
  29. return 1;
  30. }
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. SavePath(objectid){
  40.  new str[10];
  41.  format(str, sizeof(str),Path,objectid);
  42.  return str;
  43. }
  44.  
  45. forward SaveFile(objectid);
  46. public SaveFile(objectid){
  47.  new INI:file = INI_Open(SavePath(objectid));
  48.  INI_WriteInt(file,"model",gobject[objectid][model]);
  49. INI_WriteFloat(file,"posx",gobject[objectid][posx]);
  50. INI_WriteFloat(file,"posy",gobject[objectid][posy]);
  51. INI_WriteFloat(file,"posz",gobject[objectid][posz]);
  52. INI_WriteFloat(file,"rotx",gobject[objectid][rotx]);
  53. INI_WriteFloat(file,"roty",gobject[objectid][roty]);
  54. INI_WriteFloat(file,"rotz",gobject[objectid][rotz]);
  55. INI_Close(file);
  56. return 1;
  57. }
Add Comment
Please, Sign In to add comment