Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define COR_VERMELHA 0xF66767AA
- #define COR_BRANCO 0xFFFFFFAA
- #define COR_AZUL 0x447FECAA
- enum EventoSystem
- {
- bool:Eventoiniciado,//bool irá indicar sim ou não (false or true) melhor doque 0 ou 1
- bool:Eventotrancado,
- bool:Eventodestrancado,
- bool:Entrar,
- bool:Eventocontagem,
- };
- new Airton[MAX_PLAYERS][EventoSystem];
- new Float:ex,Float:ey,Float:ez;
- new Float:entroux,Float:entrouy,Float:entrouz;
- new entraram;
- new CountDown = -1;
- forward countdown();
- public OnFilterScriptInit()
- {
- print("--**Evento System Iniciado com sucesso**--");
- print("--**Desenvolvido para o SA-MP 0.3b RC2**--");
- print("--**Progamado por Airton.Vitor**--");
- SendClientMessageToAll(COR_VERMELHA,"Evento System Iniciado com sucesso by Airton");
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("--**Evento System Finalizado com sucesso**--");
- SendClientMessageToAll(COR_AZUL,"-**Evento System Finalizado com sucesso by Airton");
- return 1;
- }
- main(){}
- public OnPlayerConnect(playerid)
- {
- Airton[playerid][Eventoiniciado] = false;
- Airton[playerid][Eventodestrancado] = false;
- Airton[playerid][Eventotrancado] = false;
- Airton[playerid][Entrar] = false;
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- if(IsPlayerAdmin(playerid))
- {
- SendClientMessage(playerid, COR_AZUL, "[EVENTOS]: Uso> /evento para ver os comandos disponiveis");
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- Airton[playerid][Entrar] = false;
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[128]; new streventu[128]; new idcmd;
- new admnick[20];
- cmd = strtok(cmdtext, idcmd);
- if(strcmp(cmd, "/evento", true) == 0&&IsPlayerAdmin(playerid))
- {
- SendClientMessage(playerid, COR_BRANCO, "===============================================================================");
- SendClientMessage(playerid, COR_VERMELHA, "=========================EVENTO SYSTEM COMANDOS DÍSPONIVEIS====================");
- SendClientMessage(playerid, COR_AZUL, "[EVENTOS]: /einiciar,/edestrancar,/etrancar,/edestrancar,/eventoterminar,/ekick");
- SendClientMessage(playerid, COR_AZUL, "[EVENTOS]: /ecarro,/evida,/earma,/ecolete,/econtar,/econgelar,/edescongelar ");
- SendClientMessage(playerid, COR_BRANCO, "===============================================================================");
- return 1;
- }
- if(strcmp(cmd, "/einiciar", true) == 0&&Airton[playerid][Eventoiniciado] == false &&IsPlayerAdmin(playerid))
- {
- GetPlayerPos(playerid, ex, ey, ez);
- SendClientMessageToAll(COR_AZUL, "-INFO- Um evento acaba de ser iniciado! Digite /entrar para se teleportar até o evento");
- for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(IsPlayerConnected(possiveis))
- {
- GameTextForPlayer(possiveis,"~y~novo evento aberto ~n~digite ~b~/entrar", 2200, 1);
- Airton[possiveis][Eventoiniciado] = true;
- Airton[possiveis][Eventotrancado] = false;
- Airton[possiveis][Eventodestrancado] = false;
- Airton[playerid][Entrar] = false;
- }
- return 1;
- }
- if(strcmp(cmd, "/etrancar", true) == 0&&Airton[playerid][Eventoiniciado] == true&&Airton[playerid][Eventotrancado] == false &&IsPlayerAdmin(playerid))
- {
- SendClientMessageToAll(COR_BRANCO, "===============================================================================");
- format(streventu, 128, "-INFO- O evento foi trancado - %d jogadores(ras) entrarao", entraram);
- SendClientMessageToAll(COR_AZUL, streventu);
- SendClientMessageToAll(COR_BRANCO, "===============================================================================");
- for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(IsPlayerConnected(possiveis))
- {
- GameTextForPlayer(possiveis,"~y~evento ~r~fechado", 2500, 1);
- Airton[possiveis][Eventotrancado] = true;
- Airton[possiveis][Eventodestrancado] = true;
- }
- return 1;
- }
- if(strcmp(cmd, "/edestrancar", true) == 0&&Airton[playerid][Eventoiniciado] == true &&Airton[playerid][Eventodestrancado] == true&&IsPlayerAdmin(playerid))
- {
- SendClientMessageToAll(COR_BRANCO, "===============================================================================");
- SendClientMessageToAll(COR_AZUL, "-INFO- O evento foi destrancado! Digite /entrar");
- SendClientMessageToAll(COR_BRANCO, "===============================================================================");
- for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(IsPlayerConnected(possiveis))
- {
- GameTextForPlayer(possiveis,"~w~evento ~g~aberto", 2500, 1);
- Airton[possiveis][Eventotrancado] = false;
- Airton[possiveis][Eventodestrancado] = false;
- }
- return 1;
- }
- if(strcmp(cmd, "/efinalizar", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
- {
- GetPlayerName(playerid,admnick, 24);
- SendClientMessageToAll(COR_BRANCO, "===============================================================================");
- format(streventu, 128, "-INFO- O Administrador RCON %s evento foi finalizado!", admnick);
- SendClientMessageToAll(COR_AZUL, streventu);
- SendClientMessageToAll(COR_BRANCO, "===============================================================================");
- for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(IsPlayerConnected(possiveis))
- {
- GameTextForPlayer(possiveis,"~w~evento ~r~finalizado", 2500, 1);
- Airton[possiveis][Eventotrancado] = false;
- Airton[possiveis][Eventoiniciado] = false;
- Airton[possiveis][Eventodestrancado] = false;
- }
- for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
- {
- Airton[possiveis][Entrar] = false;
- SetPlayerPos(playerid, entroux, entrouy, entrouz);
- }
- return 1;
- }
- if(strcmp(cmd, "/entrar", true) == 0&&Airton[playerid][Entrar] == false&&Airton[playerid][Eventoiniciado] == true &&Airton[playerid][Eventotrancado] == false&&IsPlayerAdmin(playerid))
- {
- Airton[playerid][Entrar] = true;
- entraram++;
- GetPlayerPos(playerid, entroux, entrouy, entrouz);
- SetPlayerPos(playerid, ex, ey, ez);
- return 1;
- }
- if(strcmp(cmd, "/esair", true) == 0&&Airton[playerid][Entrar] == true&&Airton[playerid][Eventoiniciado] == true &&Airton[playerid][Eventotrancado] == false&&IsPlayerAdmin(playerid))
- {
- Airton[playerid][Entrar] = false;
- entraram--;
- SetPlayerPos(playerid, entroux, entrouy, entrouz);
- return 1;
- }
- if(strcmp(cmd, "/edesarmar", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
- {
- for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
- {
- ResetPlayerWeapons(possiveis);
- SetPlayerArmedWeapon(possiveis,0);
- }
- GetPlayerName(playerid,admnick, 24);
- format(streventu, 128, "-INFO- O Administrador RCON %s desarmou todos jogadores do evento!", admnick);
- SendClientMessageToAll(COR_AZUL, streventu);
- return 1;
- }
- if(strcmp(cmd, "/ekick", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
- {
- new tmp[128];
- new id = strval(tmp);
- tmp = strtok(cmdtext, idcmd);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, COR_AZUL, "Digite: /ekick [id]");
- return 1;
- }
- if(Airton[id][Entrar] == true)
- {
- ResetPlayerWeapons(id);
- SetPlayerPos(id, entroux, entrouy, entrouz);
- Airton[id][Entrar] = false;
- new jogadornick[24];
- GetPlayerName(playerid,admnick, 24);
- GetPlayerName(id,jogadornick, 24);
- format(streventu, 128, "-INFO- O Administrador RCON %s kickou jogador %s do evento!", admnick,jogadornick);
- SendClientMessageToAll(COR_AZUL, streventu);
- }
- else if(Airton[id][Entrar] == true)
- {
- SendClientMessage(playerid, COR_AZUL, "O jogador selecionado não encontra-se no evento!");
- }
- return 1;
- }
- if(strcmp(cmd, "/earma", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
- {
- new gun;
- new ammo;
- new tmp[128];
- tmp = strtok(cmdtext, idcmd);
- gun = strval(tmp);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, COR_BRANCO, "Digite o id da arma e a munição!");
- return 1;
- }
- tmp = strtok(cmdtext, idcmd);
- ammo = strval(tmp);
- /*if(ammo < 1||ammo > 9999)
- {
- return 1;
- }*/
- for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
- {
- GivePlayerWeapon(possiveis, gun, ammo);
- }
- GetPlayerName(playerid,admnick, 24);
- format(streventu, 128, "-INFO- O Administrador RCON %s deu arma %d munição %d aos jogadores do evento!", admnick,gun,ammo);
- SendClientMessageToAll(COR_AZUL, streventu);
- return 1;
- }
- if(strcmp(cmd, "/ecarro", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
- {
- new tmp[128];
- tmp = strtok(cmdtext, idcmd);
- new carro;
- carro = strval(tmp);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, COR_BRANCO, "Digite o id do carro!");
- return 1;
- }
- if(carro < 400 || carro > 611)
- {
- SendClientMessage(playerid, COR_VERMELHA, " O ID do veiculo digitado está invalido! veiculos de 400 á 611");
- return 1;
- }
- for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
- {
- new Float:X = 0,Float:Y = 0,Float:Z = 0,Float:Angulo = 0;
- GetPlayerPos(possiveis, X,Y,Z);
- GetPlayerFacingAngle(playerid, Angulo);
- //CreateVehicle(car, X, Y, Z, Angulo, 1, 1, 10000);//cria um veiculo bem no player
- PutPlayerInVehicle(possiveis, CreateVehicle(carro, X,Y,Z, Angulo, 1, 1,10000), 0);//coloca o player num veiculo
- }
- GetPlayerName(playerid,admnick, 24);
- format(streventu, 128, "-INFO- O Administrador RCON %s deu veiculo %d aos jogadores do evento!", admnick,carro);
- SendClientMessageToAll(COR_AZUL, streventu);
- return 1;
- }
- if(strcmp(cmd, "/econtar", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
- {
- if(CountDown == -1)
- {
- CountDown = 6;
- SetTimer("countdown",1000,0);
- GetPlayerName(playerid,admnick, 24);
- format(streventu, 128, "-INFO- O Administrador RCON %s iniciou a contagem do evento!", admnick);
- SendClientMessageToAll(COR_AZUL, streventu);
- }
- return 1;
- }
- if(strcmp(cmd, "/econgelar", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
- {
- for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
- {
- TogglePlayerControllable(possiveis, false);
- }
- GetPlayerName(playerid,admnick, 24);
- format(streventu, 128, "-INFO- O Administrador RCON %s congelou os jogadores do evento!", admnick);
- SendClientMessageToAll(COR_AZUL, streventu);
- return 1;
- }
- if(strcmp(cmd, "/edescongelar", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
- {
- for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
- {
- TogglePlayerControllable(possiveis, true);
- }
- GetPlayerName(playerid,admnick, 24);
- format(streventu, 128, "-INFO- O Administrador RCON %s descongelou os jogadores do evento!", admnick);
- SendClientMessageToAll(COR_AZUL, streventu);
- return 1;
- }
- if(strcmp(cmd, "/evida", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
- {
- new tmp[128];
- tmp = strtok(cmdtext, idcmd);
- new vida = strval(tmp);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, COR_BRANCO, "Digite a quantidade do HP!");
- return 1;
- }
- /*if(vida < 1 || vida > 9999)
- {
- return 1;
- }*/
- for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
- {
- SetPlayerHealth(possiveis,vida);
- }
- GetPlayerName(playerid,admnick, 24);
- format(streventu, 128, "-INFO- O Administrador RCON %s setou HP %d para os jogadores do evento", admnick,vida);
- SendClientMessageToAll(COR_AZUL, streventu);
- return 1;
- }
- if(strcmp(cmd, "/ecolete", true) == 0&&Airton[playerid][Eventoiniciado] == true &&IsPlayerAdmin(playerid))
- {
- new tmp[128];
- tmp = strtok(cmdtext, idcmd);
- new colete = strval(tmp);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, COR_BRANCO, "Digite a quantidade do Colete!");
- return 1;
- }
- /*if(colete < 1 || colete > 9999)
- {
- return 1;
- }*/
- for(new possiveis = 0; possiveis < MAX_PLAYERS; possiveis++) if(Airton[playerid][Entrar] == true)
- {
- SetPlayerArmour(possiveis, colete);
- }
- GetPlayerName(playerid,admnick, 24);
- format(streventu, 128, "-INFO- O Administrador RCON %s setou Colete %d para os jogadores do evento", admnick, colete);
- SendClientMessageToAll(COR_AZUL, streventu);
- return 1;
- }
- return 1;
- }
- public countdown()
- {
- if(CountDown==6) GameTextForAll("~p~Starting...",1000,6);
- CountDown--;
- if(CountDown==0)
- {
- GameTextForAll("~g~GO~ r~!",1000,6);
- CountDown = -1;
- for(new i = 0; i < MAX_PLAYERS; i++) {
- TogglePlayerControllable(i,true);
- PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
- }
- return 0;
- }
- else
- {
- new text[7]; format(text,sizeof(text),"~w~%d",CountDown);
- for(new i = 0; i < MAX_PLAYERS; i++) {
- PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
- TogglePlayerControllable(i,false);
- }
- GameTextForAll(text,1000,6);
- }
- SetTimer("countdown",1000,0);
- return 0;
- }
- /*
- Discrição: Sistema de eventos v0.2c
- Progamado por: Airton.Vitor
- Manual: Para criar,trancar,setar,etc você deve estar logado como Administrador RCON
- Dica: /rcon login [suasenha]
- Lembrete: Sejá um bom menino e mantenha os créditos :p
- */
- strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement