Advertisement
Guest User

Untitled

a guest
May 7th, 2013
2,681
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.86 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <sscanf2>
  4. #define culoare 0xFFFFFFAA
  5. new objects;
  6. new objectmodel[500];
  7. forward WriteLog(string[]);
  8. public OnFilterScriptInit()
  9. {
  10. printf("|------OBJECTS EDITOR--------|");
  11. printf("| |");
  12. printf("| |");
  13. printf("| |");
  14. printf("| |");
  15. printf("|----------------------------|");
  16. return 1;
  17. }
  18. COMMAND:addobject(playerid, params[])
  19. {
  20. new oid,myobject;
  21. if (!sscanf(params, "i",oid ))
  22. {
  23. new string[128];
  24. new Float:x, Float:y, Float:z;
  25. GetPlayerPos(playerid, x, y, z);
  26. myobject = CreateObject(oid, x+2, y+2, z+2, 0.0, 0.0, 90.0);
  27. format(string, sizeof(string), "CREATED:%d||CreateObject(%d,%f,%f,%f,0.0,0.0,90.0)",myobject,oid,x,y,z);
  28. SendClientMessage(playerid,culoare,string);
  29. objectmodel[myobject]=oid;
  30. objects++;
  31. return 1;
  32. }
  33. else
  34. {
  35. SendClientMessage(playerid,culoare,"USE : /addobject [objectid]");
  36. SendClientMessage(playerid,culoare,"WARNING : Using an wrong id may crash your server");
  37. return 1;
  38. }
  39. }
  40. COMMAND:editobject(playerid, params[])
  41. {
  42. new oid;
  43. if (!sscanf(params, "i",oid ))
  44. {
  45. EditObject(playerid, oid);
  46. return 1;
  47. }else{SendClientMessage(playerid,culoare,"USE : /editobject [objectid]");SendClientMessage(playerid,culoare,"INFO :Type /objects for a list of created objects"); return 1;}
  48.  
  49. }
  50. COMMAND:gotoobject(playerid, params[])
  51. {
  52. new oid;
  53. if (!sscanf(params, "i",oid ))
  54. {
  55. new Float:xo, Float:yo, Float:zo;
  56. GetObjectPos(oid, xo, yo, zo);
  57. SetPlayerPos(playerid,xo+1,yo+1,zo+1);
  58. return 1;
  59. }else{SendClientMessage(playerid,culoare,"Use :/gotoobject[objectid]"); return 1;}
  60. }
  61. COMMAND:ohelp(playerid,params[])
  62. {
  63. SendClientMessage(playerid,culoare,"/addobject || /editobject ||/gotoobject || /objects || /savemap");
  64. SendClientMessage(playerid,culoare,"/oprew");
  65. return 1;
  66. }
  67. COMMAND:savemap(playerid, params[])
  68. {
  69. for(new i = 0; i <=500; i++)
  70. {
  71. new stringg[128];
  72. new Float:RotX,Float:RotY,Float:RotZ;
  73. GetObjectRot(i, RotX, RotY, RotZ);
  74. new Float:xo, Float:yo, Float:zo;
  75. GetObjectPos(i, xo, yo, zo);
  76. if(xo!=0 && yo!=0 && zo!=0)
  77. {
  78. format(stringg, sizeof(stringg), "CreateObject(%d,%f,%f,%f,%f,%f,%f);",objectmodel[i],xo,yo,zo,RotX,RotY,RotZ,90);
  79. WriteLog(stringg);
  80. }
  81.  
  82. }
  83. new stringg[128];
  84. format(stringg, sizeof(stringg), "________________//\\_______________");
  85. WriteLog(stringg);
  86. SendClientMessage(playerid,culoare,"All Objects have been saved to mapa.txt");
  87. return 1;
  88. }
  89. COMMAND:objects(playerid, params[])
  90. {
  91. SendClientMessage(playerid,culoare,"___________L I S T______________");
  92. for(new i = 1; i <=500; i++)
  93. {
  94. new stringg[128];
  95. new Float:RotX,Float:RotY,Float:RotZ;
  96. GetObjectRot(i, RotX, RotY, RotZ);
  97. new Float:xo, Float:yo, Float:zo;
  98. GetObjectPos(i, xo, yo, zo);
  99. if(xo!=0 && yo!=0 && zo!=0)
  100. {
  101. format(stringg, sizeof(stringg), "ID:%dCreateObject(%d,%f,%f,%f,%f,%f,%f);",i,objectmodel[i],xo,yo,zo,RotX,RotY,RotZ);
  102. SendClientMessage(playerid,culoare,stringg);
  103. }
  104.  
  105. }
  106. SendClientMessage(playerid,culoare,"________________________________");
  107. return 1;
  108. }
  109. public WriteLog(string[])
  110. {
  111. new entry[192];
  112. format(entry, sizeof(entry), "%s\n",string);
  113. new File:hFile;
  114. hFile = fopen("mapa.txt", io_append);
  115. fwrite(hFile, entry);
  116. fclose(hFile);
  117. return 1;
  118. }
  119. public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
  120. {
  121. if(response == EDIT_RESPONSE_FINAL)
  122. {
  123. SetObjectPos(objectid,fX,fY,fZ);
  124. SetObjectRot(objectid,fRotX,fRotY,fRotZ);
  125. SendClientMessage(playerid,culoare,"Object Saved");
  126. return 1;
  127. }
  128. return 1;
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement