Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ==========================================================================================
- ==========================================================================================
- Include feita por Ricop522 ( sem clã )
- r-brz@hotmail.com
- Bugs, sugestões, postem no tópico
- Retirar Créditos é anti-ético !
- Não pegue uma coisa e fale que é sua.
- ==========================================================================================
- ==========================================================================================
- ==========================================================================================
- */
- #include < a_samp >
- #include < a_npc >
- /* Natives ..
- function advanced_OnPlayerCommandText(playerid, cmdtext);
- function checarHelper(playerid) // ultilizavel na public OnPlayerSpawn;
- function ad_giveHelper(playerd, dias, cargo);
- */
- /*Como usar: colocar advanced_OnPlayerCommandText(playerid, cmdtext); na public OnPlayerCommandText
- colocar _helperConnect(playerid) na public OnPlayerConnect
- Comandos:
- /darhelper ( apenas admins RCON )
- /helpers - mostra os helpers
- */
- enum helper_Info { hDia, hMes, hAno, hCargo, }; new helperInfo[MAX_PLAYERS][helper_Info];
- stock advanced_OnPlayerCommandText(playerid, cmdtext) {
- new cmd[128], tmp[128], idx;
- cmd = strtok(cmdtext, idx);
- if(strcmp(cmd, "/darhelper", true) == 0) {
- if(!IsPlayerConnected(playerid) || !IsPlayerAdmin(playerid)) return SendClientMessageplayerid, -1, "Você não é Admin! ");
- new ID, CARGO, DIAS;
- tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_PINK, "/darhelper [ID] [0-1] [Dias]"); ID = ReturnUser(tmp);
- tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_PINK, "/darhelper [ID] [0-1] [Dias]"); CARGO = strval(tmp);
- tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_PINK, "/darhelper [ID] [0-1] [Dias]"); DIAS = strval(tmp);
- if(CARGO < 0 || CARGO > 1) return SendClientMessageplayerid, -1, "Use cargos de 0 a 1.");
- else if(DIAS < 1 || DIAS > 30) return SendClientMessageplayerid, -1, "Use dias de 1 a 30 dias.");
- if(!IsPlayerConnected(ID) || ID == INVALID_PLAYER_ID) return SendClientMessageplayerid, -1, "Jogador offline / ID inválido / não conectado.");
- format(string, sizeof(string),"%s deu %i dias de Helper level %i para %s.", ad_GetName(playerid), DIAS, CARGO, ad_GetName(ID));
- ABroadCast(-1, string, 5);
- if(CARGO > helperInfo[ID][pHelper])
- format(string, sizeof(string), "PARABÉNS %s ! Você agora é helper, tem %i dias, com cargo %i para demonstrar o seu trabalho.", ad_GetName(ID), DIAS, CARGO);
- SendClientMessage(ID, -1, string);
- else
- SendClientMessageplayerid, COLOR_RED, "<!> Você foi demitido de Helper.");
- ad_GiveHelper(ID, DIAS, CARGO);
- return 0x01;
- }
- if (!strcmp(cmd, "/helpers", true)) {
- SendClientMessage(playerid, 0x0080FFAA, "Helpers Online:");
- for(new i = 0; i < MAX_PLAYERS; ++i) {
- if(IsPlayerConnected(i)) {
- if(helperInfo[i][pHelper] == 1) {
- new string[0x80];
- format(string, sizeof(string), "[ONLINE] Helper: {0093D9}%s (%d){FFFFFF} | Cargo: %i | Até: %i/%i/%i", ad_GetName, i, helperInfo[playerid][hCargo], helperInfo[playerid][hDia],helperInfo[playerid][hMes],helperInfo[playerid][hAno]);
- SendClientMessage(playerid, 0x0080C0AA, string);
- }
- }
- }
- return 0x01;
- }
- }
- stock ad_GiveHelper(playerid, dias, cargo) {
- if(!IsPlayerConnected(playerid)) return SendClientMessageToAll(-1, "< ADMIN > O helper que você tentou dar está offline!");
- if(cargo == 0) return helperInfo[playerid][hCargo] = 0;
- new j_ano, j_dia, j_mes, j_String[128], j_Nome[MAX_PLAYER_NAME]; GetPlayerName(playerid, j_Nome, sizeof(j_Nome);
- getdate(j_ano, j_mes, j_dia);
- j_dia += dias;
- while(j_dia > 31) {
- j_dia -= 31;
- j_mes++;
- }
- while(j_mes > 12) {
- j_mes -= 12;
- j_ano++;
- }
- format(j_String, sizeof(j_String), "Helper%s.ini", j_Nome);
- if(!dini_Exists(j_String)) {
- dini_Create(j_String);
- dini_IntSet(j_String, "Dia", j_dia);
- dini_IntSet(j_String, "Mes", j_mes);
- dini_IntSet(j_String, "Ano", j_ano);
- dini_IntSet(j_String, "Cargo", cargo);
- }
- else {
- dini_IntSet(j_String, "Dia", j_dia);
- dini_IntSet(j_String, "Mes", j_mes);
- dini_IntSet(j_String, "Cargo", cargo);
- }
- helperInfo[playerid][hCargo] = cargo;
- helperInfo[playerid][hDia] = j_dia;
- helperInfo[playerid][hMes] = j_mes;
- helperInfo[playerid][hAno] = j_ano;
- return 0x01;
- }
- stock ad_GetName(playerid) {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- return name;
- }
- strtok(const string[], &index) {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' ')) {
- index++;
- }
- new offset = index, result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
- stock checarHelper(playerid)
- {
- new ano, mes, dia, ricardo[MAX_PLAYER_NAME],j_String[0x80]; GetPlayerName(playerid, ricardo, sizeof(ricardo));
- format(j_String, sizeof(j_String), "Helper%s.ini", ricardo);
- if(dini_Exists(j_String)) {
- helperInfo[playerid][hDia] = dini_Int(j_String, "Dia");
- helperInfo[playerid][hMes] = dini_Int(j_String, "Mes");
- helperInfo[playerid][hAno] = dini_Int(j_String, "Ano");
- }
- if(PlayerInfo[playerid][pHelper] > 1 && helperInfo[playerid][hDia] != 00 && helperInfo[playerid][hMes] != 00 && helperInfo[playerid][hAno] != 0000) {
- getdate(ano,mes,dia);
- format(SkillBase, sizeof(SkillBase), "%i/%i/%i", helperInfo[playerid][hDia], helperInfo[playerid][hMes], helperInfo[playerid][hAno]);
- format(empresastring, sizeof(empresastring), "%i/%i/%i", dia, mes, ano);
- if( strcmp((SkillBase),(empresastring),true) == 0)
- {
- format(j_String, sizeof(j_String), "Helper%s.ini", ricardo);
- SCM(playerid, -1, "Muito obrigado pela sua ajuda como helper! O seu trabalho venceu.");
- helperInfo[playerid][hDia] = 00;
- helperInfo[playerid][hMes] = 00;
- helperInfo[playerid][hAno] = 0000;
- PlayerInfo[playerid][pHelper] = 0;
- if(fexist(j_String)) fremove(j_String);
- return 0x01;
- }
- else return SCM(playerid, -1, "<!> Você ainda tem alguns dias como helper.");
- }
- return 0x01;
- }
- stock _helperConnect(playerid) return helperInfo[playerid][hDia] = 00, helperInfo[playerid][hMes] = 00, helperInfo[playerid][hAno] = 0000, helperInfo[playerid][hCargo] = 0, print("Helper system by Ricop522 Loaded <!>");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement