objects.pwn 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //-_-_-_-_-_-_-_-_-_-_-_-_Neon System By [EDT]Quattro-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
  2. //-_-_-_-_-_-_-_-_-_-_-_-_-_-Do Not Remove Credits_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
  3. //-_-_-_-_-_-_-_-_-_-_-_-_-Commands: /neonshop /neon-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  4. //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_Enjoy Using It!-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
  5. //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  6. #include <a_samp>
  7. #define COLOR_WHITE 0xFFFFFFAA
  8. public OnPlayerCommandText(playerid, cmdtext[])
  9. {
  10. new idx;
  11. if (strcmp(cmdtext, "/objects", true)==0)
  12. {
  13. if(IsPlayerAdmin(playerid))
  14. {
  15. SendClientMessage(playerid, COLOR_WHITE, "Objects Near You:");
  16. new string[128];
  17. new Float:X, Float:Y, Float:Z;
  18. for(new i = 0;i < 10000 ;i++)
  19. {
  20. if(IsValidObject(i))
  21. {
  22. GetObjectPos(i, X, Y, Z);
  23. if(IsPlayerInRangeOfPoint(playerid, 10, X, Y, Z))
  24. {
  25. format(string, sizeof(string), "%d is near you", i);
  26. SendClientMessage(playerid, COLOR_WHITE, string);
  27. }
  28. }
  29. }
  30. }
  31. return 1;
  32. }
  33. if (strcmp(cmdtext, "/delobj", true)==0)
  34. {
  35. if(IsPlayerAdmin(playerid))
  36. {
  37. new tmp[128];
  38. tmp = strtok(cmdtext, idx);
  39. if(!strlen(tmp))
  40. {
  41. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /delobj [objectid]");
  42. }
  43. new object = strval(tmp);
  44. if(IsValidObject(object))
  45. {
  46. DestroyObject(object);
  47. }
  48. }
  49. }
  50. return 0;
  51. }
  52. strtok(const string[], &index)
  53. {
  54. new length = strlen(string);
  55. while ((index < length) && (string[index] <= ' '))
  56. {
  57. index++;
  58. }
  59. new offset = index;
  60. new result[20];
  61. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  62. {
  63. result[index - offset] = string[index];
  64. index++;
  65. }
  66. result[index - offset] = EOS;
  67. return result;
  68. }