Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // FAVOR NÃO REMOVER OS CRÉDITOS! RETIRÁ-LOS NÃO SIGNIFICA QUE FOI VOCÊ QUEM FEZ.
- // FAVOR NÃO REMOVER OS CRÉDITOS! RETIRÁ-LOS NÃO SIGNIFICA QUE FOI VOCÊ QUEM FEZ.
- // FAVOR NÃO REMOVER OS CRÉDITOS! RETIRÁ-LOS NÃO SIGNIFICA QUE FOI VOCÊ QUEM FEZ.
- // Versão do sistema de eventos: 0.1B
- //by Ricop522
- // FAVOR NÃO REMOVER OS CRÉDITOS! RETIRÁ-LOS NÃO SIGNIFICA QUE FOI VOCÊ QUEM FEZ.
- // FAVOR NÃO REMOVER OS CRÉDITOS! RETIRÁ-LOS NÃO SIGNIFICA QUE FOI VOCÊ QUEM FEZ.
- // FAVOR NÃO REMOVER OS CRÉDITOS! RETIRÁ-LOS NÃO SIGNIFICA QUE FOI VOCÊ QUEM FEZ.
- #include <a_samp>
- #pragma semicolon 0
- enum ricop_evento
- {
- eArmas[8],
- bool:eUseSkin,
- eSkin,
- eVagas,
- eQuantidadeVagas,
- Float:eVida,
- Float:eColete,
- Float:ePos[3],
- eInterior,
- eVirWorld,
- eStatus,
- }
- new EventoInfo[ricop_evento];
- new bool:eEntrou[MAX_PLAYERS];
- new eString[0x80];
- #define ricop true
- #define eCor 0x77BBFFAA
- #define DIALOG_CREDITOS 1123
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Sistema de Eventos by [Ricop522] carregado com sucesso !");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("\n--------------------------------------");
- print(" Sistema de Eventos by [Ricop522] descarregado com sucesso !"); // FAVOR NÃO REMOVER OS CRÉDITOS! RETIRÁ-LOS NÃO SIGNIFICA QUE FOI VOCÊ QUEM FEZ.
- print("--------------------------------------\n");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- eEntrou[playerid] = false;
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new rCmd[0x80], idx, tmp[128];
- if(!strcmp(rCmd, "/ecreditos", true)) // FAVOR NÃO REMOVER OS CRÉDITOS! RETIRÁ-LOS NÃO SIGNIFICA QUE FOI VOCÊ QUEM FEZ.
- {
- ShowPlayerDialog(playerid, DIALOG_CREDITOS, DIALOG_STYLE_LIST, "[ Créditos do sistema de Evento ]", "<<< Sistema de eventos feito por Ricop522 ou Justin_Ston|Lemon >>>", "OK", " ");
- return 1;
- }
- if(!strcmp(rCmd, "/evento", true))
- {
- new r_r[0x24], eArma, eOption;
- r_r = strtok(cmdtext, idx);
- if(!strlen(r_r))
- {
- SendClientMessage(playerid, eCor, "Use: /evento [opção]'");
- SendClientMessage(playerid, -1, "entrar, ecreditos");
- if(IsPlayerAdmin(playerid))
- {
- SendClientMessage(playerid, -1, "[Admin]: arma[1-8], usarskin, skinevento, vida, colete");
- SendClientMessage(playerid, -1, "[Admin]: quantidadevagas, abrir, fechar, kick");
- }
- return 0x01;
- }
- if(strcmp(r_r,"kick",true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Evento]: Você não é administrador Rcon.");
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use /evento kick [ID] [Motivo]");
- new id = strval(tmp);
- new length = strlen(cmdtext), offset = idx, result[128]
- while ((idx < length) && (cmdtext[idx] <= ' ')) idx++;
- while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; }
- result[idx - offset] = EOS;
- if(!strlen(result)) return SendClientMessage(playerid, eCor, "<!> Use /evento kick [ID] [Motivo]");
- if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID || eEntrou[id] == false) return SendClientMessage(playerid, -1, "Jogador inválido / offline / Não está no evento.");
- if(strlen(result) == 0) { format(eString, sizeof(eString), "[AD:Evento]: Administrador %s kickou %s do evento, motivo: Não informado", eNome(playerid), eNome(id)); }
- else { format(eString, sizeof(eString), "[AD:Evento]: Administrador %s kickou %s do evento, motivo: %s", eNome(playerid), eNome(id),(result)); }
- SendClientMessageToAll(eCor, eString);
- Kick(id);
- return 0x01;
- }
- if(strcmp(r_r,"fechar",true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Evento]: Você não é administrador Rcon.");
- new length = strlen(cmdtext), offset = idx, result[128]
- while ((idx < length) && (cmdtext[idx] <= ' ')) idx++;
- while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; }
- result[idx - offset] = EOS;
- if(!strlen(result)) return SendClientMessage(playerid, eCor, "<!> /evento fechar [motivo]");
- EventoInfo[eStatus] = false;
- if(strlen(result) == 0) { format(eString, sizeof(eString), "[AD:Evento]: Administrador %s fechou o evento, motivo: Não informado", eNome(playerid)); }
- else { format(eString, sizeof(eString), "[AD:Evento]: Administrador %s fechou o evento, motivo: %s", eNome(playerid), (result)); }
- SendClientMessageToAll(eCor, eString);
- resetarEvento();
- return 0x01;
- }
- if(strcmp(r_r,"abrir",true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Evento]: Você não é administrador Rcon.");
- EventoInfo[eStatus] = true;
- format(eString, sizeof(eString), "[AD:Evento]: Administrador %s abriu o evento! use \"/evento entrar\" para entrar nele! Vagas: %i", eNome(playerid), EventoInfo[eQuantidadeVagas]);
- SendClientMessageToAll(eCor, eString);
- return 0x01;
- }
- if(strcmp(r_r,"quantidadevagas",true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Evento]: Você não é administrador Rcon.");
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /evento quantidadevagas [qtd]");
- eOption = strval(tmp);
- EventoInfo[eColete] = eOption;
- format(eString, sizeof(eString), "[AD:Evento]: Quantidade de pessoas no evento setada para %i", eOption);
- SendClientMessage(playerid, eCor, eString);
- return 0x01;
- }
- if(strcmp(r_r,"colete",true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Evento]: Você não é administrador Rcon.");
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /evento colete [qtd]");
- new Float:eOption2 = floatstr(tmp);
- EventoInfo[eColete] = eOption2;
- format(eString, sizeof(eString), "[AD:Evento]: Colete do evento setada para %f", eOption2);
- SendClientMessage(playerid, eCor, eString);
- return 0x01;
- }
- if(strcmp(r_r,"vida",true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Evento]: Você não é administrador Rcon.");
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /evento vida [qtd]");
- new Float:eOption2 = floatstr(tmp);
- EventoInfo[eVida] = eOption2;
- format(eString, sizeof(eString), "[AD:Evento]: Vida do evento setada para %f", eOption2);
- SendClientMessage(playerid, eCor, eString);
- return 0x01;
- }
- if(strcmp(r_r,"skinevento",true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Evento]: Você não é administrador Rcon.");
- if(EventoInfo[eUseSkin] == false) return SendClientMessage(playerid, eCor, "[AD:Evento]: Ultilize \"/evento usarskin 1\" para ativar a skin no evento.");
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /evento skinevento [skinid]");
- eOption = strval(tmp);
- if(eOption < 0 || eOption > 299) return SendClientMessage(playerid, eCor, "[AD:Evento]: Ultilize skins de 1 a 299.");
- EventoInfo[eSkin] = eOption;
- return 0x01;
- }
- if(strcmp(r_r,"usarskin",true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Evento]: Você não é administrador Rcon.");
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /evento usarskin [opção]");
- eOption = strval(tmp);
- if(eOption < 0 || eOption > 1) return SendClientMessage(playerid, eCor, "[AD:Evento]: Ultilize (1 - ativado) | (0 - desativado).");
- if(eOption == 1) { (EventoInfo[eUseSkin] = true); } else { (EventoInfo[eUseSkin] = false); }
- return 0x01;
- }
- if(strcmp(r_r,"entrar",true) == 0)
- {
- if(EventoInfo[eStatus] == 0) return SendClientMessage(playerid, eCor, "[AD:Evento]: Evento fechado!");
- eEntrou[playerid] = true;
- entrarEvento(playerid);
- }
- if(strcmp(r_r,"arma1",true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Evento]: Você não é administrador Rcon.");
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /evento arma1 [armaID]");
- eArma = strval(tmp);
- if(eArma < 1 || eArma > 49) return SendClientMessage(playerid, eCor, "[AD:Evento]: Arma inválida.");
- EventoInfo[eArmas][0] = eArma;
- return 0x01;
- }
- if(strcmp(r_r,"arma2",true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Evento]: Você não é administrador Rcon.");
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /evento arma2 [armaID]");
- eArma = strval(tmp);
- if(eArma < 1 || eArma > 49) return SendClientMessage(playerid, eCor, "[AD:Evento]: Arma inválida.");
- EventoInfo[eArmas][1] = eArma;
- return 0x01;
- }
- if(strcmp(r_r,"arma3",true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Evento]: Você não é administrador Rcon.");
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /evento arma3 [armaID]");
- eArma = strval(tmp);
- if(eArma < 1 || eArma > 49) return SendClientMessage(playerid, eCor, "[AD:Evento]: Arma inválida.");
- EventoInfo[eArmas][2] = eArma;
- return 0x01;
- }
- if(strcmp(r_r,"arma4",true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Evento]: Você não é administrador Rcon.");
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /evento arma4 [armaID]");
- eArma = strval(tmp);
- if(eArma < 1 || eArma > 49) return SendClientMessage(playerid, eCor, "[AD:Evento]: Arma inválida.");
- EventoInfo[eArmas][3] = eArma;
- return 0x01;
- }
- if(strcmp(r_r,"arma5",true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Evento]: Você não é administrador Rcon.");
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /evento arma5 [armaID]");
- eArma = strval(tmp);
- if(eArma < 1 || eArma > 49) return SendClientMessage(playerid, eCor, "[AD:Evento]: Arma inválida.");
- EventoInfo[eArmas][4] = eArma;
- return 0x01;
- }
- if(strcmp(r_r,"arma6",true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Evento]: Você não é administrador Rcon.");
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /evento arma6 [armaID]");
- eArma = strval(tmp);
- if(eArma < 1 || eArma > 49) return SendClientMessage(playerid, eCor, "[AD:Evento]: Arma inválida.");
- EventoInfo[eArmas][5] = eArma;
- return 0x01;
- }
- if(strcmp(r_r,"arma7",true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Evento]: Você não é administrador Rcon.");
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /evento arma7 [armaID]");
- eArma = strval(tmp);
- if(eArma < 1 || eArma > 49) return SendClientMessage(playerid, eCor, "[AD:Evento]: Arma inválida.");
- EventoInfo[eArmas][6] = eArma;
- return 0x01;
- }
- if(strcmp(r_r,"arma8",true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, eCor, "[AD:Evento]: Você não é administrador Rcon.");
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid, eCor, "<!> Use: /evento arma8 [armaID]");
- eArma = strval(tmp);
- if(eArma < 1 || eArma > 49) return SendClientMessage(playerid, eCor, "[AD:Evento]: Arma inválida.");
- EventoInfo[eArmas][7] = eArma;
- return 0x01;
- }
- return 0x01;
- }
- return 0;
- }
- stock resetarEvento()
- {
- for(new r = 0; r <= 7; ++r) EventoInfo[eArmas][r] = 0;
- EventoInfo[eUseSkin] = false;
- EventoInfo[eSkin] = 1;
- EventoInfo[eVagas] = 10;
- EventoInfo[eQuantidadeVagas] = 0;
- EventoInfo[eVida] = 100.0;
- EventoInfo[eColete] = 0.0;
- EventoInfo[ePos][0] = 0.0;
- EventoInfo[ePos][1] = 0.0;
- EventoInfo[ePos][2] = 0.0;
- EventoInfo[eInterior] = 0;
- EventoInfo[eVirWorld] = 0;
- EventoInfo[eStatus] = 0;
- return ricop;
- }
- stock entrarEvento(playerid)
- {
- if(eEntrou[playerid] == false) return 1;
- if(EventoInfo[eQuantidadeVagas] == EventoInfo[eVagas])
- {
- format(eString, sizeof(eString), "[AD:Evento] o evento já atingiu a quantidade de %i vagas!", EventoInfo[eVagas]);
- SendClientMessageToAll(eCor, eString);
- EventoInfo[eStatus] = false;
- return 1;
- }
- format(eString, sizeof(eString), "[AD:Evento] %s entrou no evento!", eNome(playerid));
- SendClientMessageToAll(eCor, eString);
- entrarEvento(playerid);
- SetPlayerPos(playerid, EventoInfo[ePos][0],EventoInfo[ePos][1],EventoInfo[ePos][2]);
- SetPlayerInterior(playerid, EventoInfo[eInterior]);
- SetPlayerVirtualWorld(playerid, EventoInfo[eVirWorld]);
- SetPlayerHealth(playerid, EventoInfo[eVida]);
- SetPlayerArmour(playerid, EventoInfo[eColete]);
- if(EventoInfo[eUseSkin] == true) SetPlayerSkin(playerid, EventoInfo[eSkin]);
- EventoInfo[eQuantidadeVagas]++;
- return 0x01;
- }
- stock eNome(playerid)
- {
- new nome[MAX_PLAYER_NAME]; GetPlayerName(playerid, nome, sizeof(nome));
- return nome;
- }
- 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