Guest User

Untitled

a guest
Dec 18th, 2008
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.94 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define COLOR_GREY 0xAFAFAFAA
  4. #define COLOR_GREEN 0x0AFF0AAA
  5. #define COLOR_RED 0xAA3333AA
  6. #define COLOR_YELLOW 0xFFFF00AA
  7. #define COLOR_ORANGE 0xFF9900AA
  8. #define green 0x33FF33AA
  9. #define red 0xFF0000AA
  10.  
  11. #pragma tabsize 0
  12.  
  13. #define JOIN_MESSAGES // Add "//" at the beggining of this line to disable the Join/Leave messages! E.G: //#define JOIN_MESSAGES.
  14.  
  15. forward respawn(playerid);
  16. forward count1(playerid);
  17. forward count2(playerid);
  18. forward count3(playerid);
  19. forward admincheck(playerid);
  20. forward ShowAdminsToPlayer(playerid);
  21.  
  22. new LastReport[MAX_PLAYERS];
  23. new Float:spawns[7][3] = {
  24. {7.7129,-20.1962,3.1172},
  25. {42.0615,-111.3861,0.6169},
  26. {-22.5135,-73.4812,3.1172},
  27. {-129.1683,45.8933,3.1172},
  28. {-200.1335,14.9004,3.1172},
  29. {-200.0157,83.0081,3.1172},
  30. {-176.4138,160.4866,6.6091}
  31. };
  32.  
  33. main()
  34. {
  35. print("\n----------------------------------");
  36. print("RC Attack - by Mike");
  37. print("----------------------------------\n");
  38. }
  39.  
  40. public OnGameModeInit()
  41. {
  42. SetGameModeText("RC Attack");
  43. AddPlayerClass(280,-176.4138,160.4866,6.6091,332.7606,0,0,0,0,0,0); // RC bar
  44. SendRconCommand("weather 0");
  45. return 1;
  46. }
  47.  
  48. public OnPlayerRequestClass(playerid, classid)
  49. {
  50. SetPlayerPos(playerid, -61.5243,-37.3244,20.2729);
  51. SetPlayerCameraPos(playerid, -17.9680,-50.4617,115.4172);
  52. SetPlayerCameraLookAt(playerid, -61.5243,-37.3244,25.2729);
  53. return 1;
  54. }
  55.  
  56. public OnPlayerConnect(playerid)
  57. {
  58. SetPlayerColor(playerid, COLOR_GREY);
  59. SetWorldTime(13);
  60. SetTimerEx("admincheck", 6488, 1, "i", playerid);
  61. #if defined JOIN_MESSAGE
  62. new PlayerName[24];
  63. new string[256];
  64. GetPlayerName(playerid,PlayerName,24);
  65. format(string,256,"*** %s has joined the server.",PlayerName);
  66. for(new i = 0; i < MAX_PLAYERS; i++)
  67. if(IsPlayerConnected(i) && playerid != i) SendClientMessage(i,grey,string);
  68. #endif
  69. return 1;
  70. }
  71. #if defined JOIN_MESSAGE
  72. public OnPlayerDisconnect(playerid,reason)
  73. {
  74. new Reason[256],string[256],name[24]; GetPlayerName(playerid,name,24);
  75. switch(reason) { case 0: Reason = "Timeout"; case 1: Reason = "Quit"; case 2: Reason = "Kick/Ban"; }
  76. format(string,256,"*** %s has left the server. (%s)",name,Reason);
  77. for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && i != playerid) SendClientMessage(i,grey,string);
  78.  
  79. return 1;
  80. }
  81. #endif
  82.  
  83. public OnPlayerSpawn(playerid)
  84. {
  85. new rand = random(sizeof(spawns));
  86. SetPlayerPos(playerid, spawns[rand][0], spawns[rand][1], spawns[rand][2]);
  87. SetPlayerInterior(playerid, 0);
  88. SetPlayerColor(playerid, COLOR_YELLOW);
  89. ResetPlayerMoney(playerid);
  90. if(!IsPlayerAdmin(playerid))
  91. {
  92. TogglePlayerControllable(playerid,0);
  93. SetTimerEx("count1", 1000, 0, "i", playerid);
  94. SetTimerEx("count2", 2000, 0, "i", playerid);
  95. SetTimerEx("count3", 3000, 0, "i", playerid);
  96. }
  97. SetWorldTime(13);
  98. PlayerPlaySound(playerid,1056 ,0.0,0.0,0.0);
  99. SetPlayerWorldBounds(playerid, 140.1345, -233.5575, 280.269, -221.8796);
  100. if(IsPlayerAdmin(playerid))
  101. {
  102. SetPlayerColor(playerid, COLOR_RED);
  103. SetTimerEx("respawn", 1000, 0, "i", playerid);
  104. }
  105. return 1;
  106. }
  107.  
  108. public OnPlayerDeath(playerid, killerid, reason)
  109. {
  110. ResetPlayerMoney(playerid);
  111. new veh = GetPlayerVehicleID(playerid);
  112. DestroyVehicle(veh);
  113. SetWorldTime(13);
  114. new namey[16];
  115. new stringy[128];
  116. GetPlayerName(playerid,namey,16);
  117. SetPlayerColor(playerid, COLOR_GREY);
  118. ForceClassSelection(playerid);
  119. SetPlayerScore(playerid, GetPlayerScore(playerid) - 1 );
  120. SendClientMessage(playerid,COLOR_RED, "You have died, 1 point taken!");
  121. for(new i=0; i < MAX_PLAYERS; i++)
  122. {
  123. if(i != playerid){
  124. format(stringy, sizeof(stringy), "%s has died so everyone gets 1 point!",namey);
  125. SendClientMessage(i,COLOR_YELLOW,stringy);
  126. SetPlayerScore(i, GetPlayerScore(i) + 1 );
  127. }
  128. }
  129. return 1;
  130. }
  131.  
  132. public OnPlayerCommandText(playerid, cmdtext[])
  133. {
  134. if(strcmp(cmdtext, "/admins", true) == 0)
  135. {
  136. ShowAdminsToPlayer(playerid);
  137. return 1;
  138. }
  139.  
  140. if (strcmp("/gmx", cmdtext, true) == 0)
  141. {
  142. if(IsPlayerAdmin(playerid))
  143. {
  144. SendRconCommand("gmx");
  145. }
  146. else
  147. {
  148. return SendClientMessage(playerid,red,"You are not an admin.");
  149. }
  150. return 1;
  151. }
  152.  
  153. if(strcmp(cmdtext, "/report", true,7)==0)
  154. {
  155. if(!strlen(cmdtext[8])) return SendClientMessage(playerid, 0xFF0000AA, "Use /report [message]");
  156. new str[128];
  157. if((gettime()-LastReport[playerid]) < 30)
  158. {
  159. format(str, 128, "You have to wait %d seconds before you can send a new report!", (30-(gettime()-LastReport[playerid])));
  160. SendClientMessage(playerid, red, str); return 1;
  161. }
  162. new pname[16];
  163. GetPlayerName(playerid, pname, 16);
  164. format(str, 128, "[REPORT] Sender: %s(%d). Message: %s", pname,playerid, cmdtext[8]);
  165. for(new i; i<MAX_PLAYERS; i++){
  166. if(IsPlayerConnected(i) && IsPlayerAdmin(i)){
  167. SendClientMessage(i, 0xFFFFFFAA, str);
  168. }}
  169. SendClientMessage(playerid, green, "Report send to online admins!");
  170. LastReport[playerid] = gettime();
  171. return 1;
  172. }
  173.  
  174. if (strcmp("/giveup", cmdtext, true) == 0)
  175. {
  176. SetPlayerColor(playerid, COLOR_GREY);
  177. ForceClassSelection(playerid);
  178. SetPlayerHealth(playerid,0);
  179. return 1;
  180. }
  181.  
  182. if(strcmp(cmdtext, "/help", true) == 0) {
  183. SendClientMessage(playerid, COLOR_GREY,"RC Attack - by Mike");
  184. SendClientMessage(playerid, COLOR_ORANGE,"For some basic commands, type \"/commands\".");
  185. SendClientMessage(playerid, COLOR_ORANGE,"Type \"/Rules\" to see the rules");
  186. SendClientMessage(playerid, COLOR_ORANGE,"Type \"/Goal\" Or \"/Objevtive\" To Find Out What You Need To Do!");
  187. SendClientMessage(playerid, COLOR_ORANGE,"To Report A Hacker/Cheater, Please Use \"/Report\"!");
  188. return 1;
  189. }
  190. if(strcmp(cmdtext, "/commands", true) == 0) {
  191. SendClientMessage(playerid, COLOR_GREY,"Commands");
  192. SendClientMessage(playerid, COLOR_ORANGE,"/Giveup - Kill yourself");
  193. SendClientMessage(playerid, COLOR_ORANGE,"/Rules - View the rules");
  194. SendClientMessage(playerid, COLOR_ORANGE,"/Goal or /Objective - See the point of this Gamemode");
  195. SendClientMessage(playerid, COLOR_ORANGE,"Type /admins to see the online admins!");
  196. SendClientMessage(playerid, COLOR_ORANGE,"To Report A Cheater, Please Use /Report!");
  197. return 1;
  198. }
  199. if(strcmp(cmdtext, "/goal", true) == 0 || strcmp(cmdtext, "/objective", true) == 0) {
  200. SendClientMessage(playerid,COLOR_GREY, "Objective");
  201. SendClientMessage(playerid,COLOR_ORANGE, "Shoot other players to blow them up.");
  202. SendClientMessage(playerid,COLOR_ORANGE, "You loose 1 point if you die.");
  203. SendClientMessage(playerid,COLOR_ORANGE, "If someone dies all other players get 1 point.");
  204. SendClientMessage(playerid,COLOR_ORANGE, "Have fun!");
  205. return 1;
  206. }
  207. if(strcmp(cmdtext, "/rules", true) == 0) {
  208. SendClientMessage(playerid,COLOR_GREY, "Rules");
  209. SendClientMessage(playerid,COLOR_ORANGE, "Do not get out of your vehicle (You should be able to).");
  210. SendClientMessage(playerid,COLOR_ORANGE, "Do not use hacks.");
  211. SendClientMessage(playerid,COLOR_ORANGE, "Do not spam chat or commands.");
  212. SendClientMessage(playerid,COLOR_ORANGE, "Have fun!");
  213. return 1;
  214. }
  215.  
  216. return 0;
  217. }
  218.  
  219. public OnPlayerExitVehicle(playerid, vehicleid)
  220. {
  221. SendClientMessage(playerid,COLOR_RED, "You have been kicked from the server!");
  222. SendClientMessage(playerid, COLOR_RED, "REASON: Stay in your vehicle!");
  223. Kick(playerid);
  224. return 1;
  225. }
  226.  
  227. public OnPlayerStateChange(playerid, newstate, oldstate)
  228. {
  229. if(oldstate == PLAYER_STATE_DRIVER)
  230. {
  231. if(newstate == PLAYER_STATE_ONFOOT)
  232. {
  233. SendClientMessage(playerid,COLOR_RED, "You have been kicked from the server!");
  234. SendClientMessage(playerid, COLOR_RED, "REASON: Stay in your vehicle!");
  235. Kick(playerid);
  236. }
  237. }
  238. }
  239.  
  240. public respawn(playerid)
  241. {
  242. TogglePlayerControllable(playerid,1);
  243. PlayerPlaySound(playerid,1057 ,0.0,0.0,0.0);
  244. SendClientMessage(playerid,COLOR_GREEN, "GO!");
  245. new Float:X,Float:Y,Float:Z,Float:Angle;
  246. new carid, world;
  247. GetPlayerPos(playerid,X,Y,Z);
  248. GetPlayerFacingAngle(playerid,Angle);
  249. world = GetPlayerVirtualWorld(playerid);
  250. carid = CreateVehicle(464,X,Y,Z + 50,Angle,-1,-1,50000);
  251. PutPlayerInVehicle(playerid,carid,0);
  252. if(GetPlayerInterior(playerid)) LinkVehicleToInterior(carid,GetPlayerInterior(playerid));
  253. SetVehicleVirtualWorld(carid, world);
  254. return 1;
  255. }
  256. public count1(playerid)
  257. {
  258. TogglePlayerControllable(playerid,0);
  259. PlayerPlaySound(playerid,1057 ,0.0,0.0,0.0);
  260. SendClientMessage(playerid,COLOR_GREEN, "3");
  261. return 1;
  262. }
  263. public count2(playerid)
  264. {
  265. TogglePlayerControllable(playerid,0);
  266. PlayerPlaySound(playerid,1057 ,0.0,0.0,0.0);
  267. SendClientMessage(playerid,COLOR_GREEN, "2");
  268. return 1;
  269. }
  270. public count3(playerid)
  271. {
  272. TogglePlayerControllable(playerid,0);
  273. PlayerPlaySound(playerid,1057 ,0.0,0.0,0.0);
  274. SendClientMessage(playerid,COLOR_GREEN, "1");
  275. SetTimerEx("respawn", 1000, 0, "i", playerid);
  276. return 1;
  277. }
  278.  
  279. public admincheck(playerid)
  280. {
  281. if(IsPlayerAdmin(playerid))
  282. {
  283. SetPlayerColor(playerid, COLOR_RED);
  284. }
  285. return 1;
  286. }
  287.  
  288. stock ShowAdminsToPlayer(playerid)
  289. {
  290. new Count,i,name[24],string[256];
  291. for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i)) Count++;
  292. if(!Count) return SendClientMessage(playerid,green,"No RCON admins online at this time!");
  293. if(Count == 1) {
  294. for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i)) break;
  295. GetPlayerName(i,name,24); format(string,256,"RCON Admins Online: %s (%d)",name,i);
  296. return SendClientMessage(playerid,green,string);
  297. }
  298. if(Count >= 1) {
  299. new bool:First = false;
  300. for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i)) {
  301. GetPlayerName(i,name,24);
  302. if(!First) { format(string,256,"RCON Admins Online: %s (%d),",name,i); First = true; }
  303. else format(string,256,"%s %s (%d)",string,name,i);
  304. }
  305. return SendClientMessage(playerid,green,string);
  306. }
  307. return 1;
  308. }
  309.  
Advertisement
Add Comment
Please, Sign In to add comment