Guest User

Correção

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