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.

161 lines
4.9 KiB

  1. //-------------------------------------------------
  2. //
  3. // NPC initialisation for Grand Larceny
  4. //
  5. //-------------------------------------------------
  6. #pragma tabsize 0
  7. #include <a_samp>
  8. //-------------------------------------------------
  9. public OnFilterScriptInit()
  10. {
  11. ConnectNPC("TrainDriverLV","train_lv");
  12. ConnectNPC("TrainDriverLS","train_ls");
  13. ConnectNPC("TrainDriverSF","train_sf");
  14. ConnectNPC("PilotLV","at400_lv");
  15. ConnectNPC("PilotSF","at400_sf");
  16. ConnectNPC("PilotLS","at400_ls");
  17. // Testing
  18. //ConnectNPC("OnfootTest","onfoot_test");
  19. //ConnectNPC("DriverTest","mat_test2");
  20. //ConnectNPC("DriverTest2","driver_test2");
  21. return 1;
  22. }
  23. //-------------------------------------------------
  24. // IMPORTANT: This restricts NPCs connecting from
  25. // an IP address outside this server. If you need
  26. // to connect NPCs externally you will need to modify
  27. // the code in this callback.
  28. public OnPlayerConnect(playerid)
  29. {
  30. if(IsPlayerNPC(playerid)) {
  31. new ip_addr_npc[64+1];
  32. new ip_addr_server[64+1];
  33. GetServerVarAsString("bind",ip_addr_server,64);
  34. GetPlayerIp(playerid,ip_addr_npc,64);
  35. if(!strlen(ip_addr_server)) {
  36. ip_addr_server = "127.0.0.1";
  37. }
  38. if(strcmp(ip_addr_npc,ip_addr_server,true) != 0) {
  39. // this bot is remote connecting
  40. printf("NPC: Got a remote NPC connecting from %s and I'm kicking it.",ip_addr_npc);
  41. Kick(playerid);
  42. return 0;
  43. }
  44. printf("NPC: Connection from %s is allowed.",ip_addr_npc);
  45. }
  46. return 1;
  47. }
  48. //-------------------------------------------------
  49. public OnPlayerRequestClass(playerid, classid)
  50. {
  51. if(!IsPlayerNPC(playerid)) return 0; // We only deal with NPC players in this script
  52. new playername[64];
  53. GetPlayerName(playerid,playername,64);
  54. if(!strcmp(playername,"TrainDriverLV",true)) {
  55. SetSpawnInfo(playerid,69,255,1462.0745,2630.8787,10.8203,0.0,-1,-1,-1,-1,-1,-1);
  56. }
  57. else if(!strcmp(playername,"TrainDriverSF",true)) {
  58. SetSpawnInfo(playerid,69,255,-1942.7950,168.4164,27.0006,0.0,-1,-1,-1,-1,-1,-1);
  59. }
  60. else if(!strcmp(playername,"TrainDriverLS",true)) {
  61. SetSpawnInfo(playerid,69,255,1700.7551,-1953.6531,14.8756,0.0,-1,-1,-1,-1,-1,-1);
  62. }
  63. else if(!strcmp(playername,"PilotLV",true)) {
  64. SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
  65. }
  66. else if(!strcmp(playername,"PilotSF",true)) {
  67. SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
  68. }
  69. else if(!strcmp(playername,"PilotLS",true)) {
  70. SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
  71. }
  72. else if(!strcmp(playername,"OnfootTest",true)) {
  73. SetSpawnInfo(playerid,69,61,2388.1003,-1279.8933,25.1291,94.3321,-1,-1,-1,-1,-1,-1);
  74. }
  75. else if(!strcmp(playername,"DriverTest",true)) {
  76. SetSpawnInfo(playerid,69,61,2388.1003,-1279.8933,25.1291,94.3321,-1,-1,-1,-1,-1,-1);
  77. }
  78. else if(!strcmp(playername,"DriverTest2",true)) {
  79. SetSpawnInfo(playerid,69,61,2388.1003,-1279.8933,25.1291,94.3321,-1,-1,-1,-1,-1,-1);
  80. }
  81. return 0;
  82. }
  83. //-------------------------------------------------
  84. stock SetVehicleTireStatus(vehicleid, tirestatus)
  85. {
  86. new panels, doors, lights, tires;
  87. GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
  88. UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, tirestatus);
  89. }
  90. //-------------------------------------------------
  91. public OnPlayerSpawn(playerid)
  92. {
  93. if(!IsPlayerNPC(playerid)) return 1; // We only deal with NPC players in this script
  94. new playername[64];
  95. GetPlayerName(playerid,playername,64);
  96. if(!strcmp(playername,"TrainDriverLV",true)) {
  97. PutPlayerInVehicle(playerid,1,0);
  98. SetPlayerColor(playerid,0xFFFFFFFF);
  99. }
  100. else if(!strcmp(playername,"TrainDriverSF",true)) {
  101. PutPlayerInVehicle(playerid,5,0);
  102. SetPlayerColor(playerid,0xFFFFFFFF);
  103. }
  104. else if(!strcmp(playername,"TrainDriverLS",true)) {
  105. PutPlayerInVehicle(playerid,9,0);
  106. SetPlayerColor(playerid,0xFFFFFFFF);
  107. }
  108. else if(!strcmp(playername,"PilotLV",true)) {
  109. PutPlayerInVehicle(playerid,13,0);
  110. SetPlayerColor(playerid,0xFFFFFFFF);
  111. }
  112. else if(!strcmp(playername,"PilotSF",true)) {
  113. PutPlayerInVehicle(playerid,14,0);
  114. SetPlayerColor(playerid,0xFFFFFFFF);
  115. }
  116. else if(!strcmp(playername,"PilotLS",true)) {
  117. PutPlayerInVehicle(playerid,15,0);
  118. SetPlayerColor(playerid,0xFFFFFFFF);
  119. }
  120. else if(!strcmp(playername,"OnfootTest",true)) {
  121. //PutPlayerInVehicle(playerid,876,0);
  122. SetPlayerColor(playerid,0xFFFFFFFF);
  123. }
  124. else if(!strcmp(playername,"DriverTest",true)) {
  125. PutPlayerInVehicle(playerid,376,0);
  126. SetPlayerColor(playerid,0xFFFFFFFF);
  127. }
  128. else if(!strcmp(playername,"DriverTest2",true)) {
  129. //SetVehicleTireStatus(876,0xFF);
  130. PutPlayerInVehicle(playerid,875,0);
  131. SetPlayerColor(playerid,0xFFFFFFFF);
  132. }
  133. return 1;
  134. }
  135. //-------------------------------------------------
  136. // EOF