Travalle

Basic

Aug 8th, 2016
1,033
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*Gamemode build by Travalle
  2. Script Version:- BUILD 1
  3. New version will be released soon*/
  4.  
  5. //all samp includes
  6. #include <a_samp>
  7.  
  8. //all other includes
  9. #include <zcmd>
  10. #include <sscanf2>
  11. #include <foreach>
  12.  
  13. //all defines
  14. #define CURRENT_MESSAGES 4
  15. #define MESSAGE_INTERVAL 300
  16.  
  17. //all colors
  18. #define COLOR_WHITE "{FFFFFF}"
  19. #define COLOR_RED "{F81414}"
  20. #define COLOR_DARKGREEN "{00FF22}"
  21. #define COLOR_BLUE "{00CED1}"
  22. #define COLOR_PURPLE 0xC2A2DAAA
  23. #define COLOR_WHITE2 0xFFFFFFAA
  24. #define MESSAGE_COLOR 0x4169E1FF
  25.  
  26. //enum login/register
  27. new totalstring[1024];
  28. new RM[CURRENT_MESSAGES][128];
  29. forward SendRandomMessage();
  30.  
  31. //all stock
  32. stock NAMEGET(playerid)
  33. {
  34. new name[MAX_PLAYER_NAME];
  35. GetPlayerName(playerid,name,sizeof(name));
  36. for(new i = 0; i < MAX_PLAYER_NAME; i++)
  37. {
  38. if(name[i] == '_') name[i] = ' ';
  39. }
  40. return name;
  41. }
  42. stock ProxDetectorNew(playerid,Float:Radi=10.0,color,text[])
  43. {
  44. new Float:pos[3];
  45. GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
  46. for(new i;i<MAX_PLAYERS;i++)
  47. {
  48. if(!IsPlayerConnected(i)) continue; //
  49. if(IsPlayerInRangeOfPoint(i,Radi,pos[0],pos[1],pos[2]))
  50. {
  51. if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid) && GetPlayerInterior(playerid) == GetPlayerInterior(i))SendClientMessage(i,color,text);
  52. }
  53. }
  54. }
  55. stock AddRandomMessage(text[])
  56. {
  57. for(new m; m < CURRENT_MESSAGES; m++)
  58. {
  59. if(!strlen(RM[m]))
  60. {
  61. strmid(RM[m], text, 0, 127);
  62. return 1;
  63. }
  64. }
  65. return 0;
  66. }
  67. //stock ended
  68.  
  69. main()
  70. {
  71. print("\n----------------------------------");
  72. print(" Gamemode by Mr-Travalle");
  73. print("----------------------------------\n");
  74. }
  75.  
  76. public OnGameModeInit()
  77. {
  78. SetGameModeText("Build 1");
  79. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  80. AddRandomMessage("Add any news here");
  81. AddRandomMessage("Add any news here");
  82. AddRandomMessage("Add any news here");
  83. AddRandomMessage("Add any news here");
  84. SetTimer("SendRandomMessage", MESSAGE_INTERVAL * 1000, 1);
  85. return 1;
  86. }
  87.  
  88. public SendRandomMessage()
  89. {
  90. static lastmessage = 0;
  91. new rand = random(CURRENT_MESSAGES);
  92. while(rand == lastmessage && CURRENT_MESSAGES != 1) { rand = random(CURRENT_MESSAGES); }
  93. lastmessage = rand;
  94. SendClientMessageToAll(MESSAGE_COLOR, RM[lastmessage]);
  95. }
  96.  
  97. public OnGameModeExit()
  98. {
  99. return 1;
  100. }
  101.  
  102. public OnPlayerRequestClass(playerid, classid)
  103. {
  104. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  105. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  106. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  107. return 1;
  108. }
  109.  
  110. public OnPlayerConnect(playerid)
  111. {
  112. SendClientMessage(playerid, -1, "Welcome to server name");
  113. SendClientMessage(playerid, -1, "Server URL:- your server site");
  114. return 1;
  115. }
  116.  
  117. public OnPlayerDisconnect(playerid, reason)
  118. {
  119. new str[128];
  120. new PlayerName[MAX_PLAYER_NAME];
  121. GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
  122. format(str,sizeof(str),"%s has left/quit the server",PlayerName);
  123. SendClientMessageToAll(-1,str);
  124. return 1;
  125. }
  126.  
  127. public OnPlayerSpawn(playerid)
  128. {
  129. new str[128];
  130. new PlayerName[MAX_PLAYER_NAME];
  131. GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
  132. format(str,sizeof(str),"%s has joined the server",PlayerName);
  133. SendClientMessageToAll(-1,str);
  134. return 1;
  135. }
  136.  
  137. public OnPlayerDeath(playerid, killerid, reason)
  138. {
  139. return 1;
  140. }
  141.  
  142. public OnVehicleSpawn(vehicleid)
  143. {
  144. return 1;
  145. }
  146.  
  147. public OnVehicleDeath(vehicleid, killerid)
  148. {
  149. return 1;
  150. }
  151.  
  152. public OnPlayerText(playerid, text[])
  153. {
  154. return 1;
  155. }
  156.  
  157. public OnPlayerCommandText(playerid, cmdtext[])
  158. {
  159. return 1;
  160. }
  161.  
  162. //========[COMMANDS]=========//
  163. CMD:kill(playerid,params[])
  164. {
  165. SetPlayerHealth(playerid, 0.0);
  166. SendClientMessage(playerid, -1, "You have killed yourself so you lost 1000$.");
  167. GivePlayerMoney(playerid, -1000);
  168. return 1;
  169. }
  170.  
  171. CMD:heal(playerid,params[])
  172. {
  173. new Float:health;
  174. GetPlayerHealth(playerid,health);
  175. if(health == 100.0) return SendClientMessage(playerid, -1, "Error: Your health is already full.");
  176. if(GetPlayerMoney(playerid) < 1500) return SendClientMessage(playerid, -1, "Error: You do not enough cash.");
  177. SetPlayerHealth(playerid, 100.0);
  178. SendClientMessage(playerid, -1, "You have healed yourself for 1500$.");
  179. GivePlayerMoney(playerid, -1500);
  180. return 1;
  181. }
  182.  
  183. CMD:help(playerid,params[])
  184. {
  185. new str[55+1];
  186. format(str, sizeof(str), "%sRP Cmds:- /do, /me \nGeneral Cmds:- /time, /kill, /heal", str);
  187. ShowPlayerDialog(playerid, 6961, DIALOG_STYLE_MSGBOX, "Home Menu", str, "Okay", "");
  188. return 1;
  189. }
  190.  
  191. CMD:do(playerid, params[])
  192. {
  193. if(sscanf(params, "s[64]", params[0])) return SendClientMessage(playerid, COLOR_WHITE2, "Usage: /do [Text]");
  194. format(totalstring, 90, "%s (( %s ))",params[0], NAMEGET(playerid));
  195. ProxDetectorNew(playerid,30.0,COLOR_PURPLE,totalstring);
  196. return true;
  197. }
  198.  
  199. CMD:me(playerid, params[])
  200. {
  201. if(sscanf(params, "s[64]", params[0])) return SendClientMessage(playerid, COLOR_WHITE2, "Usage: /me [Text]");
  202. format(totalstring, 90, "%s %s", NAMEGET(playerid),params[0]);
  203. ProxDetectorNew(playerid,30.0,COLOR_PURPLE,totalstring);
  204. SetPlayerChatBubble(playerid, params[0], COLOR_PURPLE, 30.0, 7000);
  205. return true;
  206. }
  207.  
  208. CMD:time(playerid, params[])
  209. {
  210. static
  211. string[128],
  212. month[12],
  213. date[6];
  214.  
  215. getdate(date[2], date[1], date[0]);
  216. gettime(date[3], date[4], date[5]);
  217.  
  218. switch (date[1]) {
  219. case 1: month = "January";
  220. case 2: month = "February";
  221. case 3: month = "March";
  222. case 4: month = "April";
  223. case 5: month = "May";
  224. case 6: month = "June";
  225. case 7: month = "July";
  226. case 8: month = "August";
  227. case 9: month = "September";
  228. case 10: month = "October";
  229. case 11: month = "November";
  230. case 12: month = "December";
  231. }
  232. format(string, sizeof(string), "~g~%s %02d %d~n~~b~%02d:%02d:%02d", month, date[0], date[2], date[3], date[4], date[5]);
  233. GameTextForPlayer(playerid, string, 6000, 1);
  234. return 1;
  235. }
  236. //========[END OF COMMANDS]=========//
  237. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  238. {
  239. return 1;
  240. }
  241.  
  242. public OnPlayerExitVehicle(playerid, vehicleid)
  243. {
  244. return 1;
  245. }
  246.  
  247. public OnPlayerStateChange(playerid, newstate, oldstate)
  248. {
  249. return 1;
  250. }
  251.  
  252. public OnPlayerEnterCheckpoint(playerid)
  253. {
  254. return 1;
  255. }
  256.  
  257. public OnPlayerLeaveCheckpoint(playerid)
  258. {
  259. return 1;
  260. }
  261.  
  262. public OnPlayerEnterRaceCheckpoint(playerid)
  263. {
  264. return 1;
  265. }
  266.  
  267. public OnPlayerLeaveRaceCheckpoint(playerid)
  268. {
  269. return 1;
  270. }
  271.  
  272. public OnRconCommand(cmd[])
  273. {
  274. return 1;
  275. }
  276.  
  277. public OnPlayerRequestSpawn(playerid)
  278. {
  279. return 1;
  280. }
  281.  
  282. public OnObjectMoved(objectid)
  283. {
  284. return 1;
  285. }
  286.  
  287. public OnPlayerObjectMoved(playerid, objectid)
  288. {
  289. return 1;
  290. }
  291.  
  292. public OnPlayerPickUpPickup(playerid, pickupid)
  293. {
  294. return 1;
  295. }
  296.  
  297. public OnVehicleMod(playerid, vehicleid, componentid)
  298. {
  299. return 1;
  300. }
  301.  
  302. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  303. {
  304. return 1;
  305. }
  306.  
  307. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  308. {
  309. return 1;
  310. }
  311.  
  312. public OnPlayerSelectedMenuRow(playerid, row)
  313. {
  314. return 1;
  315. }
  316.  
  317. public OnPlayerExitedMenu(playerid)
  318. {
  319. return 1;
  320. }
  321.  
  322. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  323. {
  324. return 1;
  325. }
  326.  
  327. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  328. {
  329. return 1;
  330. }
  331.  
  332. public OnRconLoginAttempt(ip[], password[], success)
  333. {
  334. return 1;
  335. }
  336.  
  337. public OnPlayerUpdate(playerid)
  338. {
  339. return 1;
  340. }
  341.  
  342. public OnPlayerStreamIn(playerid, forplayerid)
  343. {
  344. return 1;
  345. }
  346.  
  347. public OnPlayerStreamOut(playerid, forplayerid)
  348. {
  349. return 1;
  350. }
  351.  
  352. public OnVehicleStreamIn(vehicleid, forplayerid)
  353. {
  354. return 1;
  355. }
  356.  
  357. public OnVehicleStreamOut(vehicleid, forplayerid)
  358. {
  359. return 1;
  360. }
  361.  
  362. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  363. {
  364. return 1;
  365. }
  366.  
  367. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  368. {
  369. return 1;
  370. }
  371.  
  372. public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
  373. {
  374. if( success == 0 )
  375. return SendClientMessage(playerid, -1, "Unknown command, please check /help for the list of commands." );
  376. return 1;
  377. }
RAW Paste Data