Advertisement
Guest User

SISTEMA DE EVENTOS

a guest
Jan 21st, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 14.01 KB | None | 0 0
  1. // Filterscript de Eventos
  2. // Criado Por Gabriel_Santos
  3. // Creditos: Jonathan Feitosa
  4.  
  5. #include <a_samp>
  6. #include <sscanf2>
  7. #include <zcmd>
  8.  
  9. #define COR_VERMELHA 0xF66767AA
  10. #define COR_BRANCO   0xFFFFFFAA
  11. #define COR_AZUL     0x447FECAA
  12. enum SystemEvento
  13. {
  14.     Float:Health,
  15.     Float:Colete,
  16.     Float:PosX,
  17.     Float:PosY,
  18.     Float:PosZ,
  19.     grana,
  20.     interior,
  21.     ang,
  22.     Skin,
  23. };
  24. new Eventos[MAX_PLAYERS][SystemEvento];
  25. enum SistemaEventos
  26. {
  27.     bool:Eventoiniciado,
  28.     bool:Eventotrancado,
  29.     bool:Eventodestrancado,
  30.     bool:Entrar,
  31.     bool:Eventocontagem,
  32.     interior,
  33. };
  34. new Gabriel[MAX_PLAYERS][SistemaEventos];
  35. new Float:ex,Float:ey,Float:ez;
  36. new Float:entroux,Float:entrouy,Float:entrouz;
  37. new entraram;
  38. new CountDown = -1;
  39. new Veiculos[MAX_VEHICLES];
  40. new VeiculosCriados = 0;
  41. forward countdown();
  42.  
  43.  
  44. public OnFilterScriptInit()
  45. {
  46.     print("\n--------------------------------------");
  47.     print(" Filterscript Eventos v1.0 Ligado");
  48.     print(" Feito Por Gabriel_Santos");
  49.     print("--------------------------------------\n");
  50.     return 1;
  51. }
  52.  
  53. public OnFilterScriptExit()
  54. {
  55.     return 1;
  56. }
  57.  
  58. public OnGameModeInit()
  59. {
  60.     AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  61.     return 1;
  62. }
  63.  
  64. public OnGameModeExit()
  65. {
  66.     return 1;
  67. }
  68.  
  69. public OnPlayerRequestClass(playerid, classid)
  70. {
  71.     SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  72.     SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  73.     SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  74.     return 1;
  75. }
  76.  
  77. public OnPlayerConnect(playerid)
  78. {
  79.     SendClientMessage(playerid, COR_AZUL,"Esse Servidor Conta com Um Sistema de Eventos Criado Por Gabriel_Santos.");
  80.     Gabriel[playerid][Eventoiniciado] = false;
  81.     Gabriel[playerid][Eventodestrancado] = false;
  82.     Gabriel[playerid][Eventotrancado] = false;
  83.     Gabriel[playerid][Entrar] = false;
  84.     return 1;
  85. }
  86.  
  87. public OnPlayerDisconnect(playerid, reason)
  88. {
  89.     return 1;
  90. }
  91.  
  92. public OnPlayerSpawn(playerid)
  93. {
  94.     return 1;
  95. }
  96. forward OnPlayerCommandReceived(playerid, cmdtext[]);
  97. public OnPlayerCommandReceived(playerid, cmdtext[])
  98. {
  99.     return 1;
  100. }
  101. forward OnPlayerCommandPerformed(playerid, cmdtext[], success);
  102. public OnPlayerCommandPerformed(playerid, cmdtext[], success)
  103. {
  104.     return 1;
  105. }
  106. public OnPlayerDeath(playerid, killerid, reason)
  107. {
  108.     Gabriel[playerid][Entrar] = false;
  109.     SetPlayerVirtualWorld(playerid, 0);
  110.     return 1;
  111. }
  112. //INICIO COMANDOS DO SISTEMA
  113. new streventu[128];
  114. new admnick[20];
  115. new string[256];
  116.  
  117. CMD:ajudaevento(playerid, params[])
  118. {
  119.     SendClientMessage(playerid, COR_AZUL, "[EVENTO SYSTEM]: /criarevento,/trancarevento,/destrancarevento,/skinevento/finalizarevento");
  120.     SendClientMessage(playerid, COR_AZUL, "[EVENTO SYSTEM]: /carroevento,/vidaevento,/armaevento,/coleteevento,/contagemevento,/congelarevento,/descongelarevento.");
  121.     return 1;
  122. }
  123. CMD:criarevento(playerid, params[])
  124. {
  125.     new result[156];
  126.     new string[256];
  127.     if(sscanf(params, "s[124]", result)) return SendClientMessage(playerid, 0xFFFFFFAA, "Use: /criarevento [Tipo]");
  128.     {
  129.         GetPlayerName(playerid,admnick, 24);
  130.         GetPlayerPos(playerid, ex, ey, ez);
  131.         SalvarPlayer(playerid);
  132.         Gabriel[playerid][interior] = GetPlayerInterior(playerid);
  133.         for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(IsPlayerConnected(possiveis))
  134.         {
  135.             format(string,sizeof(string), "O Admin:[%s] ID:[%d] Criou um Evento de [%s] \n Para Participar Use: Sim Para Ficar onde Esta use: Não", admnick, playerid ,result);
  136.             ShowPlayerDialog(possiveis, 2345, DIALOG_STYLE_MSGBOX, "Sistema de Eventos", string, "Sim", "Não");
  137.             Gabriel[possiveis][Eventoiniciado] = true;
  138.             Gabriel[possiveis][Eventotrancado] = false;
  139.             Gabriel[possiveis][Eventodestrancado] = false;
  140.             Gabriel[playerid][Entrar] = false;
  141.         }
  142.     }
  143.     return 1;
  144. }
  145. CMD:finalizarevento(playerid, params[])
  146. {
  147.     GetPlayerName(playerid,admnick, 24);
  148.     format(streventu, 128, "[SISTEMA DE EVENTO] O Administrador [%s] ID:[%d] Finalizou o Evento", admnick, playerid);
  149.     SendClientMessageToAll(COR_AZUL, streventu);
  150.     for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(IsPlayerConnected(possiveis))
  151.     {
  152.         GameTextForPlayer(possiveis,"~w~evento ~r~terminado", 2500, 1);
  153.         Gabriel[possiveis][Eventotrancado] = false;
  154.         Gabriel[possiveis][Eventoiniciado] = false;
  155.         Gabriel[possiveis][Eventodestrancado] = false;
  156.     }
  157.     for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Gabriel[playerid][Entrar] == true)
  158.     {
  159.         Gabriel[possiveis][Entrar] = false;
  160.         SetPlayerInterior(playerid, 0);
  161.         SetPlayerPos(playerid, entroux, entrouy, entrouz);
  162.         SetPlayerVirtualWorld(playerid, 0);
  163.         SetPlayerInterior(playerid, Gabriel[playerid][interior]);
  164.     }
  165.     for(new carros = 0; carros < MAX_VEHICLES; carros++)
  166.     {
  167.         if(Veiculos[carros])
  168.         {
  169.             DestroyVehicle(Veiculos[carros]);
  170.             Veiculos[carros] = 0;
  171.             VeiculosCriados = 0;
  172.         }
  173.     }
  174.     entraram = 0;
  175.     return 1;
  176. }
  177. CMD:sairevento(playerid, params[])
  178. {
  179.     SetPlayerVirtualWorld(playerid, 0);
  180.     Gabriel[playerid][Entrar] = false;
  181.     entraram -- ;
  182.     SetPlayerPos(playerid, entroux, entrouy, entrouz);
  183.     return 1;
  184. }
  185. CMD:desarmarevento(playerid, params[])
  186. {
  187.     for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Gabriel[playerid][Entrar] == true)
  188.     {
  189.         ResetPlayerWeapons(possiveis);
  190.         SetPlayerArmedWeapon(possiveis,0);
  191.     }
  192.     GetPlayerName(playerid,admnick, 24);
  193.     format(streventu, 128, "[SISTEMA DE EVENTOS] O Administrador [%s] ID:[%d] desarmou todos jogadores do evento!", admnick, playerid);
  194.     SendClientMessageToAll(COR_AZUL, streventu);
  195.     return 1;
  196. }
  197. CMD:skinevento(playerid, params[])
  198. {
  199.     new skinide;
  200.     if(sscanf(params, "d", skinide)) return SendClientMessage(playerid, COR_BRANCO, "Uso:/skinevento [ID da Skin]");
  201.     for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Gabriel[playerid][Entrar] == true)
  202.     {
  203.         SetPlayerSkin(possiveis, skinide);
  204.     }
  205.     return 1;
  206. }
  207. CMD:armaevento(playerid, params[])
  208. {
  209.     new gun;
  210.     new ammo;
  211.     if(sscanf(params, "dd", gun, ammo)) return SendClientMessage(playerid, COR_BRANCO, "Uso:/armaevento [ID da Arma][Munição]");
  212.     for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Gabriel[playerid][Entrar] == true)
  213.     {
  214.         GivePlayerWeapon(possiveis, gun, ammo);
  215.     }
  216.     GetPlayerName(playerid,admnick, 24);
  217.     format(streventu, 128, "[SISTEMA DE EVENTO]O Administrador [%s] ID:[%d] deu arma [ID:%d] munição [%d] aos jogadores do evento!", admnick,playerid ,gun,ammo);
  218.     SendClientMessageToAll(COR_AZUL, streventu);
  219.     return 1;
  220. }
  221. CMD:contagemevento(playerid, params[])
  222. {
  223.     if(CountDown == -1)
  224.     {
  225.         CountDown = 6;
  226.         SetTimer("countdown",1000,0);
  227.         GetPlayerName(playerid,admnick, 24);
  228.         format(streventu, 128, "[SISTEMA DE EVENTOS] O Administrador %s [ID:%d] iniciou a contagem do evento!", admnick, playerid);
  229.         SendClientMessageToAll(COR_AZUL, streventu);
  230.     }
  231.     return 1;
  232. }
  233. CMD:congelarevento(playerid, params[])
  234. {
  235.     for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Gabriel[playerid][Entrar] == true)
  236.     {
  237.         TogglePlayerControllable(possiveis, false);
  238.     }
  239.     GetPlayerName(playerid,admnick, 24);
  240.     format(streventu, 128, "[SISTEMA DE EVENTOS] O Administrador %s [ID:%d] congelou os jogadores do evento!", admnick, playerid);
  241.     SendClientMessageToAll(COR_AZUL, streventu);
  242.     return 1;
  243. }
  244. CMD:descongelarevento(playerid, params[])
  245. {
  246.     for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Gabriel[playerid][Entrar] == true)
  247.     {
  248.         TogglePlayerControllable(possiveis, true);
  249.     }
  250.     GetPlayerName(playerid,admnick, 24);
  251.     format(streventu, 128, "[SISTEMA DE EVENTOS] O Administrador %s [ID:%s] descongelou os jogadores do evento!", admnick, playerid);
  252.     SendClientMessageToAll(COR_AZUL, streventu);
  253.     return 1;
  254. }
  255. CMD:coleteevento(playerid, params[])
  256. {
  257.     new colete;
  258.     if(sscanf(params, "d", colete)) return SendClientMessage(playerid, COR_BRANCO, "Uso:/coleteevento[COLETE]");
  259.     for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Gabriel[playerid][Entrar] == true)
  260.     {
  261.         SetPlayerArmour(possiveis, colete);
  262.     }
  263.     GetPlayerName(playerid,admnick, 24);
  264.     format(streventu, 128, "[SISTEMA DE EVENTOS] O Administrador %s [ID:%d] setou Colete [%d] para os jogadores do evento", admnick,playerid,colete);
  265.     SendClientMessageToAll(COR_AZUL, streventu);
  266.     return 1;
  267. }
  268. CMD:vidaevento(playerid, params[])
  269. {
  270.     new vida;
  271.     if(sscanf(params, "d", vida)) return SendClientMessage(playerid, COR_BRANCO, "Uso:/vidaevento [VIDA]");
  272.     for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Gabriel[playerid][Entrar] == true)
  273.     {
  274.         SetPlayerHealth(possiveis,vida);
  275.     }
  276.     GetPlayerName(playerid,admnick, 24);
  277.     format(streventu, 128, "[SISTEMA DE EVENTOS] O Administrador %s [ID:%d] setou Vida [%d] para os jogadores do evento", admnick,playerid,vida);
  278.     SendClientMessageToAll(COR_AZUL, streventu);
  279.     return 1;
  280. }
  281. CMD:carroevento(playerid, params[])
  282. {
  283.     new carro;
  284.     if(sscanf(params, "d", carro)) return SendClientMessage(playerid, COR_BRANCO, "Uso:/carroevento [ID do Carro]");
  285.     if(carro < 400 || carro > 611)
  286.     {
  287.         SendClientMessage(playerid, COR_VERMELHA, "  O ID do veiculo digitado está invalido! veiculos de 400 á 611");
  288.         return 1;
  289.     }
  290.     for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Gabriel[possiveis][Entrar] == true)
  291.     {
  292.         new Float:X = 0,Float:Y = 0,Float:Z = 0,Float:Angulo = 0;
  293.         GetPlayerPos(possiveis, X,Y,Z);
  294.         GetPlayerFacingAngle(playerid, Angulo);
  295.         Veiculos[VeiculosCriados++] = CreateVehicle(carro, X, Y, Z, 0, random(126), random(126), 60000);
  296.         LinkVehicleToInterior(Veiculos[VeiculosCriados-1], GetPlayerInterior(possiveis));
  297.         SetVehicleVirtualWorld(Veiculos[VeiculosCriados-1], GetPlayerVirtualWorld(possiveis));
  298.         PutPlayerInVehicle(possiveis, Veiculos[VeiculosCriados-1], 0);
  299.     }
  300.     GetPlayerName(playerid,admnick, 24);
  301.     format(streventu, 128, "[SISTEMA DE EVENTOS] O Administrador %s [ID:%d] deu carro ID:%d aos jogadores do evento!", admnick,carro);
  302.     SendClientMessageToAll(COR_AZUL, streventu);
  303.     return 1;
  304. }
  305. public countdown()
  306. {
  307.     if(CountDown==6) GameTextForAll("~p~Starting...",1000,6);
  308.  
  309.     CountDown--;
  310.     if(CountDown==0)
  311.     {
  312.         GameTextForAll("~g~GO~ r~!",1000,6);
  313.         CountDown = -1;
  314.         for(new i = 0; i < MAX_PLAYERS; i++) {
  315.             TogglePlayerControllable(i,true);
  316.             PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  317.         }
  318.         return 0;
  319.     }
  320.     else
  321.     {
  322.         new text[7]; format(text,sizeof(text),"~w~%d",CountDown);
  323.         for(new i = 0; i < MAX_PLAYERS; i++) {
  324.             PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  325.             TogglePlayerControllable(i,false);
  326.         }
  327.         GameTextForAll(text,1000,6);
  328.     }
  329.  
  330.     SetTimer("countdown",1000,0);
  331.     return 0;
  332. }
  333. stock SalvarPlayer(playerid)
  334. {
  335.     new Float: health, Float: armour, Float: SX, Float: SY, Float: SZ;
  336.     GetPlayerHealth(playerid, health);
  337.     GetPlayerArmour(playerid, armour);
  338.     GetPlayerPos(playerid, SX, SY, SZ);
  339.     Eventos[playerid][grana] = GetPlayerMoney(playerid);
  340.     Eventos[playerid][Skin] = GetPlayerSkin(playerid);
  341.     if (armour > 0) Eventos[playerid][Colete] = armour;
  342.     Eventos[playerid][PosX] = SX;
  343.     Eventos[playerid][PosY] = SY;
  344.     Eventos[playerid][PosZ] = SZ;
  345.     Eventos[playerid][interior] = GetPlayerInterior(playerid);
  346. }
  347. stock UsarPlayer(playerid)
  348. {
  349.     SetPlayerSkin(playerid,Eventos[playerid][Skin]);
  350.     GivePlayerMoney(playerid, Eventos[playerid][grana]);
  351.     SetPlayerArmour(playerid, Eventos[playerid][Colete]);
  352.     SetPlayerPos(playerid, Eventos[playerid][PosX],
  353.     AirtonData[playerid][PosY], Eventos[playerid][PosZ]);
  354.     SetPlayerFacingAngle(playerid, Eventos[playerid][grana]);
  355.     SetPlayerInterior(playerid, Eventos[playerid][grana]);
  356.     SetPlayerInterior(playerid, Eventos[playerid][interior]);
  357.     return 1;
  358. }
  359. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  360. {
  361.         if(dialogid == 2345)
  362.         {
  363.             if(response == 1)
  364.             {
  365.                 SendClientMessage(playerid, COR_AZUL, "[EVENTOS]: voce foi para o evento");
  366.                 SalvarPlayer(playerid);
  367.                 Gabriel[playerid][Entrar] = true;
  368.                 entraram++;
  369.                 SetPlayerPos(playerid, ex, ey, ez);
  370.                 SetPlayerVirtualWorld(playerid, 5);
  371.                 SetPlayerInterior(playerid, Gabriel[playerid][interior]);
  372.                 return true;
  373.             }
  374.             if(response == 0)
  375.             {
  376.                 SendClientMessage(playerid, COR_AZUL, "[EVENTOS]: voce nao foi para o evento");
  377.                 return true;
  378.             }
  379.         }
  380.         return 1;
  381. }
  382.  
  383. public OnVehicleSpawn(vehicleid)
  384. {
  385.     return 1;
  386. }
  387.  
  388. public OnVehicleDeath(vehicleid, killerid)
  389. {
  390.     return 1;
  391. }
  392.  
  393. public OnPlayerText(playerid, text[])
  394. {
  395.     return 1;
  396. }
  397.  
  398. public OnPlayerCommandText(playerid, cmdtext[])
  399. {
  400.     {
  401.         return 1;
  402.     }
  403. }
  404. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  405. {
  406.     return 1;
  407. }
  408.  
  409. public OnPlayerExitVehicle(playerid, vehicleid)
  410. {
  411.     return 1;
  412. }
  413.  
  414. public OnPlayerStateChange(playerid, newstate, oldstate)
  415. {
  416.     return 1;
  417. }
  418.  
  419. public OnPlayerEnterCheckpoint(playerid)
  420. {
  421.     return 1;
  422. }
  423.  
  424. public OnPlayerLeaveCheckpoint(playerid)
  425. {
  426.     return 1;
  427. }
  428.  
  429. public OnPlayerEnterRaceCheckpoint(playerid)
  430. {
  431.     return 1;
  432. }
  433.  
  434. public OnPlayerLeaveRaceCheckpoint(playerid)
  435. {
  436.     return 1;
  437. }
  438. public OnPlayerRequestSpawn(playerid)
  439. {
  440.     return 1;
  441. }
  442.  
  443. public OnObjectMoved(objectid)
  444. {
  445.     return 1;
  446. }
  447.  
  448. public OnPlayerObjectMoved(playerid, objectid)
  449. {
  450.     return 1;
  451. }
  452.  
  453. public OnPlayerPickUpPickup(playerid, pickupid)
  454. {
  455.     return 1;
  456. }
  457.  
  458. public OnVehicleMod(playerid, vehicleid, componentid)
  459. {
  460.     return 1;
  461. }
  462.  
  463. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  464. {
  465.     return 1;
  466. }
  467.  
  468. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  469. {
  470.     return 1;
  471. }
  472.  
  473. public OnPlayerSelectedMenuRow(playerid, row)
  474. {
  475.     return 1;
  476. }
  477.  
  478. public OnPlayerExitedMenu(playerid)
  479. {
  480.     return 1;
  481. }
  482.  
  483. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  484. {
  485.     return 1;
  486. }
  487.  
  488. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  489. {
  490.     return 1;
  491. }
  492.  
  493. public OnRconLoginAttempt(ip[], password[], success)
  494. {
  495.     return 1;
  496. }
  497.  
  498. public OnPlayerUpdate(playerid)
  499. {
  500.     return 1;
  501. }
  502.  
  503. public OnPlayerStreamIn(playerid, forplayerid)
  504. {
  505.     return 1;
  506. }
  507.  
  508. public OnPlayerStreamOut(playerid, forplayerid)
  509. {
  510.     return 1;
  511. }
  512.  
  513. public OnVehicleStreamIn(vehicleid, forplayerid)
  514. {
  515.     return 1;
  516. }
  517.  
  518. public OnVehicleStreamOut(vehicleid, forplayerid)
  519. {
  520.     return 1;
  521. }
  522. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  523. {
  524.     return 1;
  525. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement