Advertisement
Guest User

Untitled

a guest
Oct 17th, 2010
632
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.54 KB | None | 0 0
  1.  
  2. #include <a_samp>
  3.  
  4. #define COR_VERMELHA 0xF66767AA
  5. #define COR_BRANCO 0xFFFFFFAA
  6. #define COR_AZUL 0x447FECAA
  7. enum EventoSystem
  8. {
  9. bool:Eventoiniciado,//bool irá indicar sim ou não (false or true) melhor doque 0 ou 1
  10. bool:Eventotrancado,
  11. bool:Eventodestrancado,
  12. bool:Entrar,
  13. bool:Eventocontagem,
  14. };
  15. new Airton[MAX_PLAYERS][EventoSystem];
  16. new Float:ex,Float:ey,Float:ez;
  17. new Float:entroux,Float:entrouy,Float:entrouz;
  18. new entraram;
  19. new CountDown = -1;
  20. forward countdown();
  21.  
  22. public OnFilterScriptInit()
  23. {
  24. print("--**Evento System Iniciado com sucesso**--");
  25. print("--**Desenvolvido para o SA-MP 0.3b RC2**--");
  26. print("--**Progamado por Airton.Vitor**--");
  27. SendClientMessageToAll(COR_VERMELHA,"Evento System Iniciado com sucesso by Airton");
  28. return 1;
  29. }
  30.  
  31. public OnFilterScriptExit()
  32. {
  33. print("--**Evento System Finalizado com sucesso**--");
  34. SendClientMessageToAll(COR_AZUL,"-**Evento System Finalizado com sucesso by Airton");
  35. return 1;
  36. }
  37.  
  38. main(){}
  39.  
  40. public OnPlayerConnect(playerid)
  41. {
  42. Airton[playerid][Eventoiniciado] = false;
  43. Airton[playerid][Eventodestrancado] = false;
  44. Airton[playerid][Eventotrancado] = false;
  45. Airton[playerid][Entrar] = false;
  46. return 1;
  47. }
  48.  
  49. public OnPlayerSpawn(playerid)
  50. {
  51. if(IsPlayerAdmin(playerid))
  52. {
  53. SendClientMessage(playerid, COR_AZUL, "[EVENTOS]: Uso> /evento para ver os comandos disponiveis");
  54. }
  55. return 1;
  56. }
  57. public OnPlayerDeath(playerid, killerid, reason)
  58. {
  59. Airton[playerid][Entrar] = false;
  60. return 1;
  61. }
  62.  
  63. public OnPlayerCommandText(playerid, cmdtext[])
  64. {
  65. new cmd[128]; new streventu[128]; new idcmd;
  66. new admnick[20];
  67. cmd = strtok(cmdtext, idcmd);
  68. if(strcmp(cmd, "/evento", true) == 0&&IsPlayerAdmin(playerid))
  69. {
  70. SendClientMessage(playerid, COR_BRANCO, "===============================================================================");
  71. SendClientMessage(playerid, COR_VERMELHA, "=========================EVENTO SYSTEM COMANDOS DÍSPONIVEIS====================");
  72. SendClientMessage(playerid, COR_AZUL, "[EVENTOS]: /einiciar,/edestrancar,/etrancar,/edestrancar,/eventoterminar,/ekick");
  73. SendClientMessage(playerid, COR_AZUL, "[EVENTOS]: /ecarro,/evida,/earma,/ecolete,/econtar,/econgelar,/edescongelar ");
  74. SendClientMessage(playerid, COR_BRANCO, "===============================================================================");
  75. return 1;
  76. }
  77. if(strcmp(cmd, "/einiciar", true) == 0&&Airton[playerid][Eventoiniciado] == false &&IsPlayerAdmin(playerid))
  78. {
  79. GetPlayerPos(playerid, ex, ey, ez);
  80. SendClientMessageToAll(COR_AZUL, "-INFO- Um evento acaba de ser iniciado! Digite /entrar para se teleportar até o evento");
  81. for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(IsPlayerConnected(possiveis))
  82. {
  83. GameTextForPlayer(possiveis,"~y~novo evento aberto ~n~digite ~b~/entrar", 2200, 1);
  84. Airton[possiveis][Eventoiniciado] = true;
  85. Airton[possiveis][Eventotrancado] = false;
  86. Airton[possiveis][Eventodestrancado] = false;
  87. Airton[playerid][Entrar] = false;
  88. }
  89. return 1;
  90. }
  91. if(strcmp(cmd, "/etrancar", true) == 0&&Airton[playerid][Eventoiniciado] == true&&Airton[playerid][Eventotrancado] == false &&IsPlayerAdmin(playerid))
  92. {
  93. SendClientMessageToAll(COR_BRANCO, "===============================================================================");
  94. format(streventu, 128, "-INFO- O evento foi trancado - %d jogadores(ras) entrarao", entraram);
  95. SendClientMessageToAll(COR_AZUL, streventu);
  96. SendClientMessageToAll(COR_BRANCO, "===============================================================================");
  97. for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(IsPlayerConnected(possiveis))
  98. {
  99. GameTextForPlayer(possiveis,"~y~evento ~r~fechado", 2500, 1);
  100. Airton[possiveis][Eventotrancado] = true;
  101. Airton[possiveis][Eventodestrancado] = true;
  102. }
  103. return 1;
  104. }
  105. if(strcmp(cmd, "/edestrancar", true) == 0&&Airton[playerid][Eventoiniciado] == true &&Airton[playerid][Eventodestrancado] == true&&IsPlayerAdmin(playerid))
  106. {
  107. SendClientMessageToAll(COR_BRANCO, "===============================================================================");
  108. SendClientMessageToAll(COR_AZUL, "-INFO- O evento foi destrancado! Digite /entrar");
  109. SendClientMessageToAll(COR_BRANCO, "===============================================================================");
  110. for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(IsPlayerConnected(possiveis))
  111. {
  112. GameTextForPlayer(possiveis,"~w~evento ~g~aberto", 2500, 1);
  113. Airton[possiveis][Eventotrancado] = false;
  114. Airton[possiveis][Eventodestrancado] = false;
  115. }
  116. return 1;
  117. }
  118. if(strcmp(cmd, "/efinalizar", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
  119. {
  120. GetPlayerName(playerid,admnick, 24);
  121. SendClientMessageToAll(COR_BRANCO, "===============================================================================");
  122. format(streventu, 128, "-INFO- O Administrador RCON %s evento foi finalizado!", admnick);
  123. SendClientMessageToAll(COR_AZUL, streventu);
  124. SendClientMessageToAll(COR_BRANCO, "===============================================================================");
  125. for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(IsPlayerConnected(possiveis))
  126. {
  127. GameTextForPlayer(possiveis,"~w~evento ~r~finalizado", 2500, 1);
  128. Airton[possiveis][Eventotrancado] = false;
  129. Airton[possiveis][Eventoiniciado] = false;
  130. Airton[possiveis][Eventodestrancado] = false;
  131. }
  132. for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
  133. {
  134. Airton[possiveis][Entrar] = false;
  135. SetPlayerPos(playerid, entroux, entrouy, entrouz);
  136. }
  137. return 1;
  138. }
  139. if(strcmp(cmd, "/entrar", true) == 0&&Airton[playerid][Entrar] == false&&Airton[playerid][Eventoiniciado] == true &&Airton[playerid][Eventotrancado] == false&&IsPlayerAdmin(playerid))
  140. {
  141. Airton[playerid][Entrar] = true;
  142. entraram++;
  143. GetPlayerPos(playerid, entroux, entrouy, entrouz);
  144. SetPlayerPos(playerid, ex, ey, ez);
  145. return 1;
  146. }
  147. if(strcmp(cmd, "/esair", true) == 0&&Airton[playerid][Entrar] == true&&Airton[playerid][Eventoiniciado] == true &&Airton[playerid][Eventotrancado] == false&&IsPlayerAdmin(playerid))
  148. {
  149. Airton[playerid][Entrar] = false;
  150. entraram--;
  151. SetPlayerPos(playerid, entroux, entrouy, entrouz);
  152. return 1;
  153. }
  154. if(strcmp(cmd, "/edesarmar", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
  155. {
  156. for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
  157. {
  158. ResetPlayerWeapons(possiveis);
  159. SetPlayerArmedWeapon(possiveis,0);
  160. }
  161. GetPlayerName(playerid,admnick, 24);
  162. format(streventu, 128, "-INFO- O Administrador RCON %s desarmou todos jogadores do evento!", admnick);
  163. SendClientMessageToAll(COR_AZUL, streventu);
  164. return 1;
  165. }
  166. if(strcmp(cmd, "/ekick", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
  167. {
  168. new tmp[128];
  169. new id = strval(tmp);
  170. tmp = strtok(cmdtext, idcmd);
  171. if(!strlen(tmp))
  172. {
  173. SendClientMessage(playerid, COR_AZUL, "Digite: /ekick [id]");
  174. return 1;
  175. }
  176. if(Airton[id][Entrar] == true)
  177. {
  178. ResetPlayerWeapons(id);
  179. SetPlayerPos(id, entroux, entrouy, entrouz);
  180. Airton[id][Entrar] = false;
  181. new jogadornick[24];
  182. GetPlayerName(playerid,admnick, 24);
  183. GetPlayerName(id,jogadornick, 24);
  184. format(streventu, 128, "-INFO- O Administrador RCON %s kickou jogador %s do evento!", admnick,jogadornick);
  185. SendClientMessageToAll(COR_AZUL, streventu);
  186. }
  187. else if(Airton[id][Entrar] == true)
  188. {
  189. SendClientMessage(playerid, COR_AZUL, "O jogador selecionado não encontra-se no evento!");
  190. }
  191. return 1;
  192. }
  193. if(strcmp(cmd, "/earma", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
  194. {
  195. new gun;
  196. new ammo;
  197. new tmp[128];
  198. tmp = strtok(cmdtext, idcmd);
  199. gun = strval(tmp);
  200. if(!strlen(tmp))
  201. {
  202. SendClientMessage(playerid, COR_BRANCO, "Digite o id da arma e a munição!");
  203. return 1;
  204. }
  205. tmp = strtok(cmdtext, idcmd);
  206. ammo = strval(tmp);
  207. /*if(ammo < 1||ammo > 9999)
  208. {
  209. return 1;
  210. }*/
  211. for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
  212. {
  213. GivePlayerWeapon(possiveis, gun, ammo);
  214. }
  215. GetPlayerName(playerid,admnick, 24);
  216. format(streventu, 128, "-INFO- O Administrador RCON %s deu arma %d munição %d aos jogadores do evento!", admnick,gun,ammo);
  217. SendClientMessageToAll(COR_AZUL, streventu);
  218. return 1;
  219. }
  220. if(strcmp(cmd, "/ecarro", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
  221. {
  222. new tmp[128];
  223. tmp = strtok(cmdtext, idcmd);
  224. new carro;
  225. carro = strval(tmp);
  226. if(!strlen(tmp))
  227. {
  228. SendClientMessage(playerid, COR_BRANCO, "Digite o id do carro!");
  229. return 1;
  230. }
  231. if(carro < 400 || carro > 611)
  232. {
  233. SendClientMessage(playerid, COR_VERMELHA, " O ID do veiculo digitado está invalido! veiculos de 400 á 611");
  234. return 1;
  235. }
  236. for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
  237. {
  238. new Float:X = 0,Float:Y = 0,Float:Z = 0,Float:Angulo = 0;
  239. GetPlayerPos(possiveis, X,Y,Z);
  240. GetPlayerFacingAngle(playerid, Angulo);
  241. //CreateVehicle(car, X, Y, Z, Angulo, 1, 1, 10000);//cria um veiculo bem no player
  242. PutPlayerInVehicle(possiveis, CreateVehicle(carro, X,Y,Z, Angulo, 1, 1,10000), 0);//coloca o player num veiculo
  243. }
  244. GetPlayerName(playerid,admnick, 24);
  245. format(streventu, 128, "-INFO- O Administrador RCON %s deu veiculo %d aos jogadores do evento!", admnick,carro);
  246. SendClientMessageToAll(COR_AZUL, streventu);
  247. return 1;
  248. }
  249. if(strcmp(cmd, "/econtar", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
  250. {
  251. if(CountDown == -1)
  252. {
  253. CountDown = 6;
  254. SetTimer("countdown",1000,0);
  255. GetPlayerName(playerid,admnick, 24);
  256. format(streventu, 128, "-INFO- O Administrador RCON %s iniciou a contagem do evento!", admnick);
  257. SendClientMessageToAll(COR_AZUL, streventu);
  258. }
  259. return 1;
  260. }
  261. if(strcmp(cmd, "/econgelar", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
  262. {
  263. for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
  264. {
  265. TogglePlayerControllable(possiveis, false);
  266. }
  267. GetPlayerName(playerid,admnick, 24);
  268. format(streventu, 128, "-INFO- O Administrador RCON %s congelou os jogadores do evento!", admnick);
  269. SendClientMessageToAll(COR_AZUL, streventu);
  270. return 1;
  271. }
  272. if(strcmp(cmd, "/edescongelar", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
  273. {
  274. for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
  275. {
  276. TogglePlayerControllable(possiveis, true);
  277. }
  278. GetPlayerName(playerid,admnick, 24);
  279. format(streventu, 128, "-INFO- O Administrador RCON %s descongelou os jogadores do evento!", admnick);
  280. SendClientMessageToAll(COR_AZUL, streventu);
  281. return 1;
  282. }
  283. if(strcmp(cmd, "/evida", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
  284. {
  285. new tmp[128];
  286. tmp = strtok(cmdtext, idcmd);
  287. new vida = strval(tmp);
  288. if(!strlen(tmp))
  289. {
  290. SendClientMessage(playerid, COR_BRANCO, "Digite a quantidade do HP!");
  291. return 1;
  292. }
  293. /*if(vida < 1 || vida > 9999)
  294. {
  295. return 1;
  296. }*/
  297. for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
  298. {
  299. SetPlayerHealth(possiveis,vida);
  300. }
  301. GetPlayerName(playerid,admnick, 24);
  302. format(streventu, 128, "-INFO- O Administrador RCON %s setou HP %d para os jogadores do evento", admnick,vida);
  303. SendClientMessageToAll(COR_AZUL, streventu);
  304. return 1;
  305. }
  306. if(strcmp(cmd, "/ecolete", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
  307. {
  308. new tmp[128];
  309. tmp = strtok(cmdtext, idcmd);
  310. new colete = strval(tmp);
  311. if(!strlen(tmp))
  312. {
  313. SendClientMessage(playerid, COR_BRANCO, "Digite a quantidade do Colete!");
  314. return 1;
  315. }
  316. /*if(colete < 1 || colete > 9999)
  317. {
  318. return 1;
  319. }*/
  320. for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
  321. {
  322. SetPlayerArmour(possiveis, colete);
  323. }
  324. GetPlayerName(playerid,admnick, 24);
  325. format(streventu, 128, "-INFO- O Administrador RCON %s setou Colete %d para os jogadores do evento", admnick, colete);
  326. SendClientMessageToAll(COR_AZUL, streventu);
  327. return 1;
  328. }
  329. return 1;
  330. }
  331.  
  332. public countdown()
  333. {
  334. if(CountDown==6) GameTextForAll("~p~Starting...",1000,6);
  335.  
  336. CountDown--;
  337. if(CountDown==0)
  338. {
  339. GameTextForAll("~g~GO~ r~!",1000,6);
  340. CountDown = -1;
  341. for(new i = 0; i < MAX_PLAYERS; i++) {
  342. TogglePlayerControllable(i,true);
  343. PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  344. }
  345. return 0;
  346. }
  347. else
  348. {
  349. new text[7]; format(text,sizeof(text),"~w~%d",CountDown);
  350. for(new i = 0; i < MAX_PLAYERS; i++) {
  351. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  352. TogglePlayerControllable(i,false);
  353. }
  354. GameTextForAll(text,1000,6);
  355. }
  356.  
  357. SetTimer("countdown",1000,0);
  358. return 0;
  359. }
  360. /*
  361.  
  362. Discrição: Sistema de eventos v0.2c
  363. Progamado por: Airton.Vitor
  364. Manual: Para criar,trancar,setar,etc você deve estar logado como Administrador RCON
  365. Dica: /rcon login [suasenha]
  366. Lembrete: Sejá um bom menino e mantenha os créditos :p
  367.  
  368. */
  369. strtok(const string[], &index)
  370. {
  371. new length = strlen(string);
  372. while ((index < length) && (string[index] <= ' '))
  373. {
  374. index++;
  375. }
  376.  
  377. new offset = index;
  378. new result[20];
  379. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  380. {
  381. result[index - offset] = string[index];
  382. index++;
  383. }
  384. result[index - offset] = EOS;
  385. return result;
  386. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement