Advertisement
Samp-Pawn

Activity System - Samp

May 23rd, 2012
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.05 KB | None | 0 0
  1.  
  2. /a help
  3.  
  4. /a j
  5.  
  6. /a remove
  7.  
  8.  
  9. //==============================================================================
  10. #include <a_samp>
  11. #include <dini>
  12. //==============================================================================
  13. public OnFilterScriptInit()
  14. {
  15. print("\n--------------------------------------");
  16. print(" Activity System ");
  17. print("--------------------------------------\n");
  18. return 1;
  19. }
  20. //==============================================================================
  21. new RGM[MAX_PLAYERS];
  22. new GM[MAX_PLAYERS];
  23. new ActivityTeleports;
  24. new JoinTime2[MAX_PLAYERS];
  25. new JoinTime[MAX_PLAYERS];
  26. new ActQ[MAX_PLAYERS];
  27. new PlayerName[256];
  28. new ActiveName[128];
  29. new activity;
  30. //==============================================================================
  31. #define ActivityJoin 0x8e0c9ff
  32. #define Brown1 0xd11111ff
  33. #define ActivityManager 0xb2b3b2ff
  34. #define Green1 0x48c14ff
  35. #define RED 0xff0000ff
  36. #define White 0xFFFFFFAA
  37. #define yellow 0xFFFF00AA
  38. //==============================================================================
  39. #pragma tabsize 0
  40. //==============================================================================
  41. forward JoinTime1(playerid);
  42. //==============================================================================
  43. public OnPlayerCommandText(playerid, cmdtext[])
  44. {
  45. new cmd[256];
  46. new idx;
  47. new tmp[256];
  48. new tmp1[256];
  49. new string[256];
  50. new id;
  51. new any;
  52. cmd = strtok(cmdtext,idx);
  53. //==============================================================================
  54. if(strcmp(cmd, "/Activity", true) == 0 || strcmp(cmd, "/a", true) == 0)
  55. {
  56. new string1[128];
  57. tmp = strtok(cmdtext,idx);
  58. if(!strlen(tmp))
  59. {
  60. SendClientMessage(playerid, yellow, "/Activity [Start] [End] [Change] [GiveMoney] [CloseTeleports] [OpenTeleports]:ìàãîéðéí");
  61. SendClientMessage(playerid, yellow, "[Quit] [CHeck] [Join] [Help] :ìùç÷ðéí");
  62. return 1;
  63. }
  64.  
  65. if(strcmp(tmp, "Help", true) == 0 || strcmp(tmp, "H", true) == 0)
  66. {
  67. tmp = strtok(cmdtext,idx);
  68. if(!strlen(tmp)) return SendClientMessage(playerid, yellow, "/Activity Help [1-2] :öåøú ùéîåù");
  69. if(strcmp(tmp, "1", true) == 0)
  70. {
  71. SendClientMessage(playerid,0xff0000ff,"=================1================");
  72. SendClientMessage(playerid,yellow,"/Activity Start ActiveName [/A S] - ìàãîéï , äëøæä òì äôòìú ôòéìåú");
  73. SendClientMessage(playerid,yellow,"/Activity Change NewActiveName [/A C] - ìàãîéï , ùéðåé ôòéìåú");
  74. SendClientMessage(playerid,yellow,"/Activity Join [/A J] - ìùç÷ï/àãîéï , äöèøôåú ìôòéìåú");
  75. SendClientMessage(playerid,yellow,"/Activity End [/A E] - ìàãîéï , ñéåí äôòéìåú");
  76. SendClientMessage(playerid,yellow,"/Activity CAncle [/A CA] - ìàãîéï , áéèåì äôòéìåú");
  77. SendClientMessage(playerid,0xff0000ff,"=================1================");
  78. }
  79. if(strcmp(tmp, "2", true) == 0)
  80. {
  81. SendClientMessage(playerid,0xff0000ff,"=================2================");
  82. SendClientMessage(playerid,yellow,"/Activity GiveMoney [/A GM] - ðúéðú ôøñ ìîðöç");
  83. SendClientMessage(playerid,yellow,"/Activity OpenTeleports [/A CT] - ìàãîéï , ñâéøú äùéâåøéí ìôòéìåú");
  84. SendClientMessage(playerid,yellow,"/Activity OpenTeleports [/A OT] - ìàãîéï , ôúéçú äùéâåøéí ìôòéìåú");
  85. SendClientMessage(playerid,yellow,"/Activity CHeck [/A CH] - ìùç÷ï/ìàãîéï , áãé÷ú îöá äôòéìåú");
  86. SendClientMessage(playerid,yellow,"/Activity Quit [/A Q] - ìùç÷ï/àãîéï , éöéàä îäôòéìåú");
  87. SendClientMessage(playerid,0xff0000ff,"=================2================");
  88. }
  89. return 1;
  90. }
  91.  
  92.  
  93. if(strcmp(tmp, "CloseTeleports", true) == 0 || strcmp(tmp, "Ct", true) == 0)
  94. {
  95. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, White, "àúä ìà àãîéï ø÷åï");
  96. if(activity == 0) return SendClientMessage(playerid,White,"àéï ôòéìåú îåôòìú");
  97. if(ActivityTeleports == 0) return SendClientMessage(playerid,White,"äùéâåøéí ìôòéìåú ëáø ñâåøéí");
  98. format(string, sizeof(string),"äùéâåøéí ìôòéìåú %s äñúééîå òì éãé äîðäì",ActiveName);
  99. SendClientMessageToAll(0x48c14ff,string);
  100. GameTextForAll("~r~Activity ~b~Close Teleports~<~",20,1);
  101. ActivityTeleports = 0;
  102. return 1;
  103. }
  104.  
  105. if(strcmp(tmp, "OpenTeleports", true) == 0 || strcmp(tmp, "Ot", true) == 0)
  106. {
  107. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, White, "àúä ìà àãîéï ø÷åï");
  108. if(activity == 0) return SendClientMessage(playerid,White,"àéï ôòéìåú îåôòìú");
  109. if(ActivityTeleports == 1) return SendClientMessage(playerid,White,"äùéâåøéí ìôòéìåú ëáø ôúåçéí");
  110. format(string, sizeof(string),"äùéâåøéí ìôòéìåú %s ðôúçå òì éãé äîðäì",ActiveName);
  111. SendClientMessageToAll(0x48c14ff,string);
  112. GameTextForAll("~r~Activity ~b~Open Teleports~<~",20,1);
  113. ActivityTeleports = 1;
  114. return 1;
  115. }
  116.  
  117. if(strcmp(tmp, "Join", true) == 0 || strcmp(tmp, "j", true) == 0)
  118. {
  119. if(activity == 0) return SendClientMessage(playerid,White,"àéï ôòéìåú îåôòìú");
  120. if(ActivityTeleports == 0) return SendClientMessage(playerid,White,"äàçøàé ñâø àú äùéâåøéí ìôòéìåú åìëï àúä ìà éëåì ìäöèøó");
  121. if(JoinTime2[playerid] == 1) return SendClientMessage(playerid,White,"ëáø áé÷ùú ìäöèøó ìôòéìåú , çëä ã÷ä åá÷ù ùåá");
  122. for(new i=0; i<MAX_PLAYERS; i++)
  123. {
  124. if(IsPlayerConnected(i))
  125. {
  126. if(IsPlayerAdmin(i))
  127. {
  128. format(string1, sizeof(string1),"îá÷ù ìäöèøó ìôòéìåú %s[%d] äùç÷ï",GetName(playerid),playerid);
  129. SendClientMessage(i,0x8e0c9ff,string1);
  130. }
  131. }
  132. }
  133. SendClientMessage(playerid,0x8e0c9ff,"áé÷ùú ìäöèøó ìôòéìåú , çëä ùäàçøàé éöøó àåúê");
  134. GameTextForPlayer(playerid,"~r~Activity ~b~ Join !~<~",20,1);
  135. JoinTime[playerid] = SetTimerEx("JoinTime1", 60000, 0, "i", playerid);
  136.  
  137. for(new i = 0; i<MAX_PLAYERS; i++) if(IsPlayerConnected(i)) JoinTime2[playerid] = 1;
  138. return 1;
  139. }
  140.  
  141.  
  142. if(strcmp(tmp, "cancle", true) == 0 || strcmp(tmp, "ca", true) == 0)
  143. {
  144. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, White, "àúä ìà àãîéï ø÷åï");
  145. if(activity == 0) return SendClientMessage(playerid, White, "àéï ôòéìåú îåôòìú");
  146. format(string1, sizeof(string1),"äôòéìåú %s äúáèìä òì éãé äàçøàé ôòéìåéåú/äîðäì",ActiveName);
  147. SendClientMessageToAll(0xff0000ff,string1);
  148. GameTextForAll("~r~Activity ~b~Cancle~<~",20,1);
  149. activity = 0;
  150. GM[id] = 0;
  151. RGM[id] = 0;
  152. KillTimer(JoinTime[id]);
  153. JoinTime2[playerid] = 0;
  154. return 1;
  155. }
  156.  
  157. if(strcmp(tmp, "q", true) == 0 || strcmp(tmp, "quit", true) == 0)
  158. {
  159. if(activity == 0) return SendClientMessage(playerid, White, "àéï ôòéìåú îåôòìú");
  160. if(ActQ[playerid] == 0) return SendClientMessage(playerid, White, "ëáø éöàú îäôòéìåú");
  161. SpawnPlayer(playerid);
  162. SendClientMessage(playerid,0xd11111ff,"éöàú îäôòéìåú åìëï ùåâøú");
  163. ActQ[playerid] = 0;
  164. return 1;
  165. }
  166.  
  167. if(strcmp(tmp, "Remove", true) == 0 || strcmp(tmp, "R", true) == 0)
  168. {
  169. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, White, "àúä ìà àãîéï ø÷åï");
  170. if(activity == 0) return SendClientMessage(playerid,White,"àéï ôòéìåú îåôòìú");
  171. tmp = strtok(cmdtext, idx);
  172. if(!strlen(tmp)) return SendClientMessage(playerid, yellow, "/Activity Remove [ID] :öåøú äùéîåù");
  173. id = strval(tmp);
  174. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, White, "ùç÷ï æä ìà îçåáø");
  175. if(RGM[id] == 1) return SendClientMessage(playerid,White,"ëáø äñøú ùç÷ï æä îîðöç áôòéìåú");
  176. new Money = GetPVarInt(id, "GivenMoney");
  177. GivePlayerMoney(id, -Money);
  178. format(string,sizeof(string),"îîðöç áôòéìåú åìëï äëñó ùìå äåñø %s äñøú àú äùç÷ï",GetName(id));
  179. SendClientMessage(playerid,0x48c14ff, string);
  180. format(string,sizeof(string),"äñéø àåúê îîðöç áôòéìåú åìëï ëñôê äåñø %s äàãîéï",GetName(playerid));
  181. SendClientMessage(id,0x48c14ff, string);
  182. RGM[id] = 1;
  183. return 1;
  184. }
  185.  
  186. if(strcmp(tmp, "GiveMoney", true) == 0 || strcmp(tmp, "GM", true) == 0)
  187. {
  188. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, White, "àúä ìà àãîéï ø÷åï");
  189. if(activity == 0) return SendClientMessage(playerid, White, "ëãé ìúú ìùç÷ï ôøñ öøéëä ìäéåú ôòéìåú îåôòìú");
  190. tmp = strtok(cmdtext, idx);
  191. if(!strlen(tmp)) return SendClientMessage(playerid, yellow, "/Activity GiveMoney(Gm) [id] [Money] :öåøú äùéîåù");
  192. id = strval(tmp);
  193. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, White, "ùç÷ï æä ìà îçåáø");
  194. if(GM[id] == 1) return SendClientMessage(playerid,White,"ùç÷ï æä ëáø ÷éáì ôøñ äôòéìåú");
  195. tmp1 = strtok(cmdtext, idx);
  196. if(!strlen(tmp1)) return SendClientMessage(playerid, yellow, "/Activity GiveMoney ID [Money] :öåøú äùéîåù");
  197. any = strval(tmp1);
  198. if(any < 1 || any > 150000) return SendClientMessage(playerid, White, "ñëåí äôøñ çééá ìäéåú áéï 150000 - 1");
  199. any = strval(tmp1);
  200. GivePlayerMoney(id, any);
  201. SetPVarInt(playerid, "GivenMoney", any);
  202. format(string, sizeof(string),"%d ðéöç áôòéìåú å÷éáì àú äñëåí %s äùç÷ï", any, GetName(id));
  203. SendClientMessageToAll(0x48c14ff, string);
  204. format(string, sizeof(string),"~r~Activity Win ~b~ %s", GetName(id));
  205. GameTextForAll(string,50,1);
  206. GM[id] = 1;
  207. return 1;
  208. }
  209.  
  210. if(strcmp(tmp, "Check", true) == 0 || strcmp(tmp, "ch", true) == 0)
  211. {
  212. if(activity == 0) return SendClientMessage(playerid, White, "àéï ôòéìåú îåôòìú");
  213. format(string1, sizeof(string1),"îðäì àú äôòéìåú %s %s äàçøàé",ActiveName,PlayerName);
  214. SendClientMessage(playerid,0xd11111ff,string1);
  215. return 1;
  216. }
  217.  
  218. if(strcmp(tmp, "Change", true) == 0 || strcmp(tmp, "c", true) == 0)
  219. {
  220. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, White, "àúä ìà àãîéï ø÷åï");
  221. if(activity == 0) return SendClientMessage(playerid, yellow, "àéï ôòéìåú îåôòìú ùáàôùøåúê ìùðåú");
  222. new length = strlen(cmdtext);
  223. while ((idx < length) && (cmdtext[idx] <= ' '))
  224. {
  225. idx++;
  226. }
  227. new offset = idx;
  228. new result[256];
  229. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  230. {
  231. result[idx - offset] = cmdtext[idx];
  232. idx++;
  233. }
  234. result[idx - offset] = EOS;
  235. if(!strlen(result)) return SendClientMessage(playerid, yellow, "/Activity Change [ActivityNewName]");
  236. format(string1, sizeof(string1),"äôòéìåú ùåðúä ì%s òì éãé äàçøàé ôòéìåéåú/äîðäì",(result));
  237. SendClientMessageToAll(0xff0000ff,string1);
  238. GameTextForAll("~r~Activity ~b~ Change~<~",20,1);
  239. format(string1, sizeof(string1),"%s", (result));
  240. ActiveName = string1;
  241. return 1;
  242. }
  243.  
  244. if(strcmp(tmp, "end", true) == 0 || strcmp(tmp, "e", true) == 0)
  245. {
  246. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, White, "àúä ìà àãîéï ø÷åï");
  247. if(activity == 0) return SendClientMessage(playerid, White, "àéï ôòéìåú îåôòìú");
  248. format(string1, sizeof(string1),"äôòéìåú %s äñúééîä òì éãé äàçøàé ôòéìåéåú/äîðäì",ActiveName);
  249. SendClientMessageToAll(0xff0000ff,string1);
  250. GameTextForAll("~r~Activity ~b~End~<~",20,1);
  251. activity = 0;
  252. GM[id] = 0;
  253. RGM[id] = 0;
  254. KillTimer(JoinTime[id]);
  255. JoinTime2[playerid] = 0;
  256. return 1;
  257. }
  258.  
  259. if(strcmp(tmp, "start", true) == 0 || strcmp(tmp, "s", true) == 0)
  260. {
  261. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, White, "àúä ìà àãîéï ø÷åï");
  262. if(activity == 1) return SendClientMessage(playerid, White, "éù ôòéìåú îåôòìú , çëä ùúñúééí");
  263. new length = strlen(cmdtext);
  264. while ((idx < length) && (cmdtext[idx] <= ' '))
  265. {
  266. idx++;
  267. }
  268. new offset = idx;
  269. new result[256];
  270. while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
  271. {
  272. result[idx - offset] = cmdtext[idx];
  273. idx++;
  274. }
  275. result[idx - offset] = EOS;
  276. if(!strlen(result)) return SendClientMessage(playerid, yellow, "/Activity Start [ActivityName]");
  277. format(string1, sizeof(string1),"äôòéìåú %s äåôòìä òì éãé äàçøàé ôòéìåéåú/äîðäì",(result),GetName(playerid));
  278. SendClientMessageToAll(0xff0000ff,string1);
  279. SendClientMessageToAll(0xff0000ff,"/Activity Help äùéâåøéí ìôòéìåú ðôúçå àåèåîèéú - ëãé ìøàåú ô÷åãåú ðåñôåú ìôòéìåú");
  280. GameTextForAll("~r~Activity ~b~Start~<~",20,1);
  281. activity = 1;
  282. format(string1, sizeof(string1),"%s", (result));
  283. ActiveName = string1;
  284. format(string1, sizeof(string1),"%s", GetName(playerid));
  285. PlayerName = string1;
  286. ActivityTeleports = 1;
  287. for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) ActQ[i] = 1;
  288. return 1;
  289. }
  290. }
  291. return 0;
  292. }
  293. //==============================================================================
  294. stock SendAdminsMessage(color, const string[])
  295. {
  296. for(new i=0; i<MAX_PLAYERS; i++)
  297. {
  298. if(IsPlayerConnected(i))
  299. {
  300. if(!IsPlayerAdmin(i))
  301. {
  302. SendClientMessage(i, color, string);
  303. }
  304. }
  305. }
  306. return 1;
  307. }
  308. //==============================================================================
  309. stock GetName(playerid)
  310. {
  311. new Name[MAX_PLAYER_NAME];
  312. GetPlayerName(playerid, Name, sizeof(Name));
  313. return Name;
  314. }
  315. //==============================================================================
  316. public JoinTime1(playerid)
  317. {
  318. SendClientMessage(playerid,0x48c14ff,"àúä éëåì ìá÷ù ìäöèøó ìôòéìåú ùåá");
  319. JoinTime2[playerid] = 0;
  320. return 1;
  321. }
  322. //==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement