SAMP Gitlab CI Test
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

166 lines
3.5 KiB

  1. //
  2. // NPC Test Script
  3. // Kye 2009
  4. //
  5. #include <a_npc>
  6. forward TimerTest();
  7. //------------------------------------------
  8. main()
  9. {
  10. printf("npctest: main()");
  11. }
  12. //------------------------------------------
  13. public OnNPCModeInit()
  14. {
  15. printf("npctest: OnNPCModeInit");
  16. SetTimer("TimerTest",10000,1);
  17. }
  18. //------------------------------------------
  19. public OnNPCModeExit()
  20. {
  21. printf("npctest: OnNPCModeExit");
  22. }
  23. //------------------------------------------
  24. public TimerTest()
  25. {
  26. //new ticker = GetTickCount() - g_LastTick;
  27. //printf("npctest: timer (%d)ms", ticker);
  28. //g_LastTick = GetTickCount();
  29. new msg[256];
  30. new name[64];
  31. new Float:X,Float:Y,Float:Z;
  32. new Float:Distance;
  33. new x;
  34. new num_streamed_in = 0;
  35. new num_connected = 0;
  36. x=0;
  37. while(x!=MAX_PLAYERS) {
  38. if(IsPlayerConnected(x)) {
  39. num_connected++;
  40. if(IsPlayerStreamedIn(x)) {
  41. num_streamed_in++;
  42. GetPlayerName(x,name,64);
  43. GetPlayerPos(x,X,Y,Z);
  44. GetDistanceFromMeToPoint(X,Y,Z,Distance);
  45. format(msg,256,"I see %s @ %f units with state:%d health:%d armour:%d weapon:%d",
  46. name,Distance,GetPlayerState(x),GetPlayerHealth(x),GetPlayerArmour(x),GetPlayerArmedWeapon(x));
  47. SendChat(msg);
  48. if(GetPlayerState(x) == PLAYER_STATE_DRIVER) {
  49. format(msg,256,"I see %s driving vehicle: %d",name,GetPlayerVehicleID(x));
  50. SendChat(msg);
  51. }
  52. }
  53. }
  54. x++;
  55. }
  56. format(msg,256,"I have %d connected players with %d streamed in",num_connected,num_streamed_in);
  57. SendChat(msg);
  58. SendCommand("/me waits around patiently");
  59. SendCommand("/groundsit");
  60. }
  61. //------------------------------------------
  62. public OnNPCConnect(myplayerid)
  63. {
  64. printf("npctest: OnNPCConnect(My playerid=%d)", myplayerid);
  65. }
  66. //------------------------------------------
  67. public OnNPCDisconnect(reason[])
  68. {
  69. printf("npctest: OnNPCDisconnect(reason=%s)", reason);
  70. }
  71. //------------------------------------------
  72. public OnNPCSpawn()
  73. {
  74. printf("npctest: OnNPCSpawn");
  75. }
  76. //------------------------------------------
  77. public OnNPCEnterVehicle(vehicleid, seatid)
  78. {
  79. printf("npctest: OnNPCEnterVehicle(vehicleid=%d,seatid=%d)", vehicleid, seatid);
  80. }
  81. //------------------------------------------
  82. public OnNPCExitVehicle()
  83. {
  84. printf("npctest: OnNPCExitVehicle");
  85. }
  86. //------------------------------------------
  87. public OnClientMessage(color, text[])
  88. {
  89. printf("npctest: OnClientMessage(color=%d, text=%s)", color, text);
  90. }
  91. //------------------------------------------
  92. public OnPlayerDeath(playerid)
  93. {
  94. printf("npctest: OnPlayerDeath(playerid=%d)", playerid);
  95. }
  96. //------------------------------------------
  97. public OnPlayerText(playerid, text[])
  98. {
  99. printf("npctest: (CHAT)(from=%d, text=%s)", playerid, text);
  100. }
  101. //------------------------------------------
  102. public OnPlayerStreamIn(playerid)
  103. {
  104. printf("npctest: OnPlayerStreamIn(playerid=%d)", playerid);
  105. }
  106. //------------------------------------------
  107. public OnPlayerStreamOut(playerid)
  108. {
  109. printf("npctest: OnPlayerStreamOut(playerid=%d)", playerid);
  110. }
  111. //------------------------------------------
  112. public OnVehicleStreamIn(vehicleid)
  113. {
  114. printf("npctest: OnVehicleStreamIn(vehicleid=%d)", vehicleid);
  115. }
  116. //------------------------------------------
  117. public OnVehicleStreamOut(vehicleid)
  118. {
  119. printf("npctest: OnVehicleStreamOut(vehicleid=%d)", vehicleid);
  120. }
  121. //------------------------------------------