fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <Windows.h>
  4. std::string string_format(const std::string fmt, ...)
  5. {
  6. int size = 512;
  7. std::string str;
  8. va_list ap;
  9. while (1) {
  10. str.resize(size);
  11. va_start(ap, fmt);
  12. int n = vsnprintf((char *)str.c_str(), size, fmt.c_str(), ap);
  13. va_end(ap);
  14. if (n > -1 && n < size) {
  15. str.resize(n);
  16. return str;
  17. }
  18. if (n > -1)
  19. size = n + 1;
  20. else
  21. size *= 2;
  22. }
  23. return str;
  24. }
  25.  
  26. #include <sampgdk/core.h>
  27. #include <sampgdk/plugin.h>
  28. #include <sampgdk/a_samp.h>
  29. #include <C:\Users\Rafal\Desktop\zcmd.hpp>
  30. //end-user code
  31.  
  32. bool OnPlayerCommandReceived(int playerid,std::string command, std::string params)
  33. {
  34. return true;
  35. }
  36.  
  37. void OnPlayerCommandExecuted(int playerid, std::string command, std::string params, bool success)
  38. {
  39. return;
  40. }
  41.  
  42. bool OnUnknownCommand(int playerid, std::string command, std::string params)
  43. {
  44. SendClientMessage(playerid,0xFFFFFF,string_format("Unknown command issued by you: %s",command).c_str());
  45. return true;//disable message by server
  46. }
  47.  
  48. ZERO_COMMAND(start)
  49. {
  50. printf("start issued, params: '%s'\n",params.c_str());
  51. return true;
  52. }
  53.  
  54. ZERO_COMMAND(end)
  55. {
  56. printf("end issued, params: '%s'\n",params.c_str());
  57. return false;
  58. }
  59.  
  60. int main()
  61. {
  62. return 0;
  63. }
  64.  
  65.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty