Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //============================================================
- // PM-BR Script By SuB_ZeRo0_ [0.3] [S.A.S]
- // Versao: 0.1.8 || PREMIUM: SIM || SA-MP.com
- // Comandos PREMIUM: /bpm & /kpm
- // Não apague os créditos!
- // Contato: Vá ao forum SA-MP.com Area: Portuguese/Portugues
- //============================================================
- #include <a_samp>
- /*cores*/
- #define amarelo 0xFFFF00AA
- #define verde 0x33FF33AA
- #define vermelho 0xFF0000AA
- #define vermelhoescuro 0xAA3333AA
- #define branco 0xFFFFFFAA
- #define rosa 0xCCFF00FFAA
- #define azul 0x057ABDAA
- #define cinza 0xC0C0C0AA
- #define yellow 0xFFFF00AA
- #define laranja 0xFFA500AA
- //Dcmd
- #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
- //PlayerData
- enum PlayerData {
- Bpm,
- Bmpm
- };
- //Extras
- new PlayerInfo[MAX_PLAYERS][PlayerData];
- new stringpm[128];
- new kpm;
- new Verpms[MAX_PLAYERS];
- new Logpms;
- new ide[MAX_PLAYERS],idee[MAX_PLAYERS];
- #define idn ShowPlayerDialog(playerid,1604,DIALOG_STYLE_INPUT,"Mensagem Privada","Digite o ID do jogador abaixo e depois clique continuar","Continuar","Cancelar");
- #define pm ShowPlayerDialog(playerid,1601,DIALOG_STYLE_INPUT,"Mensagem Privada","Digite o texto abaixo e depois clique enviar","Enviar","Cancelar");
- #define receb1 ShowPlayerDialog(ide[playerid],1602,DIALOG_STYLE_MSGBOX,"Mensagem Privada",stringpm,"Responder","Ok");
- #define receb2 ShowPlayerDialog(idee[playerid],1602,DIALOG_STYLE_MSGBOX,"Mensagem Privada",stringpm,"Responder","Ok");
- #define resp ShowPlayerDialog(playerid,1603,DIALOG_STYLE_INPUT,"Mensagem Privada","Digite o texto abaixo e depois clique enviar","Enviar","Cancelar");
- // PM-BR Script By SuB_ZeRo0_ [0.3] [S.A.S]
- // começo do sscanf -------------------------------------------------
- stock sscanf(string[], format[], {Float,_}:...)
- {
- #if defined isnull
- if (isnull(string))
- #else
- if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
- #endif
- {
- return format[0];
- }
- #pragma tabsize 4
- new
- formatPos = 0,
- stringPos = 0,
- paramPos = 2,
- paramCount = numargs(),
- delim = ' ';
- while (string[stringPos] && string[stringPos] <= ' ')
- {
- stringPos++;
- }
- while (paramPos < paramCount && string[stringPos])
- {
- switch (format[formatPos++])
- {
- case '\0':
- {
- return 0;
- }
- case 'i', 'd':
- {
- new
- neg = 1,
- num = 0,
- ch = string[stringPos];
- if (ch == '-')
- {
- neg = -1;
- ch = string[++stringPos];
- }
- do
- {
- stringPos++;
- if ('0' <= ch <= '9')
- {
- num = (num * 10) + (ch - '0');
- }
- else
- {
- return -1;
- }
- }
- while ((ch = string[stringPos]) > ' ' && ch != delim);
- setarg(paramPos, 0, num * neg);
- }
- case 'h', 'x':
- {
- new
- num = 0,
- ch = string[stringPos];
- do
- {
- stringPos++;
- switch (ch)
- {
- case 'x', 'X':
- {
- num = 0;
- continue;
- }
- case '0' .. '9':
- {
- num = (num << 4) | (ch - '0');
- }
- case 'a' .. 'f':
- {
- num = (num << 4) | (ch - ('a' - 10));
- }
- case 'A' .. 'F':
- {
- num = (num << 4) | (ch - ('A' - 10));
- }
- default:
- {
- return -1;
- }
- }
- }
- while ((ch = string[stringPos]) > ' ' && ch != delim);
- setarg(paramPos, 0, num);
- }
- case 'c':
- {
- setarg(paramPos, 0, string[stringPos++]);
- }
- case 'f':
- {
- setarg(paramPos, 0, _:floatstr(string[stringPos]));
- }
- case 'p':
- {
- delim = format[formatPos++];
- continue;
- }
- case '\'':
- {
- new
- end = formatPos - 1,
- ch;
- while ((ch = format[++end]) && ch != '\'') {}
- if (!ch)
- {
- return -1;
- }
- format[end] = '\0';
- if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
- {
- if (format[end + 1])
- {
- return -1;
- }
- return 0;
- }
- format[end] = '\'';
- stringPos = ch + (end - formatPos);
- formatPos = end + 1;
- }
- case 'u':
- {
- new
- end = stringPos - 1,
- id = 0,
- bool:num = true,
- ch;
- while ((ch = string[++end]) && ch != delim)
- {
- if (num)
- {
- if ('0' <= ch <= '9')
- {
- id = (id * 10) + (ch - '0');
- }
- else
- {
- num = false;
- }
- }
- }
- if (num && IsPlayerConnected(id))
- {
- setarg(paramPos, 0, id);
- }
- else
- {
- #if !defined foreach
- #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
- #define __SSCANF_FOREACH__
- #endif
- string[end] = '\0';
- num = false;
- new
- name[MAX_PLAYER_NAME];
- id = end - stringPos;
- foreach (Player, playerid)
- {
- GetPlayerName(playerid, name, sizeof (name));
- if (!strcmp(name, string[stringPos], true, id))
- {
- setarg(paramPos, 0, playerid);
- num = true;
- break;
- }
- }
- if (!num)
- {
- setarg(paramPos, 0, INVALID_PLAYER_ID);
- }
- string[end] = ch;
- #if defined __SSCANF_FOREACH__
- #undef foreach
- #undef __SSCANF_FOREACH__
- #endif
- }
- stringPos = end;
- }
- case 's', 'z':
- {
- new
- i = 0,
- ch;
- if (format[formatPos])
- {
- while ((ch = string[stringPos++]) && ch != delim)
- {
- setarg(paramPos, i++, ch);
- }
- if (!i)
- {
- return -1;
- }
- }
- else
- {
- while ((ch = string[stringPos++]))
- {
- setarg(paramPos, i++, ch);
- }
- }
- stringPos--;
- setarg(paramPos, i, '\0');
- }
- default:
- {
- continue;
- }
- }
- while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
- {
- stringPos++;
- }
- while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
- {
- stringPos++;
- }
- paramPos++;
- }
- do
- {
- if ((delim = format[formatPos++]) > ' ')
- {
- if (delim == '\'')
- {
- while ((delim = format[formatPos++]) && delim != '\'') {}
- }
- else if (delim != 'z')
- {
- return delim;
- }
- }
- }
- while (delim > ' ');
- return 0;
- } // termino do sscanf ----------------------------------------------------------
- // PM-BR Script By SuB_ZeRo0_ [0.3] [S.A.S]
- #if defined FILTERSCRIPT
- #define FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n==============================================");
- print(" PM-BR Script By SuB_ZeRo0_ [0.3] [S.A.S]");
- print(" Versao: 0.1.8 || PREMIUM: SIM || SA-MP.com");
- print(" Comandos PREMIUM: /bpm & /kpm");
- print("==============================================\n");
- SetTimer("SVP",600000,true);
- if(!fexist("logpm.txt")) {new File:file=fopen("logpm.txt",io_write);fclose(file);}
- return 1;
- }
- forward SVP();
- public SVP() {
- SendClientMessageToAll(verde,"Este servidor possui Sistema de Mensagens Privadas por SuB_ZeRo0 ([SA]Smith[FG])!");
- // Global Evolution Playboy 0.3a - Ip: 200.155.33.86:7777
- // PM-BR Script By SuB_ZeRo0_ [0.3] [S.A.S]
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #else
- main()
- {
- }
- #endif
- public OnPlayerDisconnect(playerid, reason)
- {
- PlayerInfo[playerid][Bpm]=0;
- PlayerInfo[playerid][Bmpm]=0;
- if(Verpms[playerid]==1) {Verpms[playerid]=0;}
- return 1;
- }
- // PM-BR Script By SuB_ZeRo0_ [0.3] [S.A.S]
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(strcmp("/pm", cmdtext, true, 10) == 0)
- {
- if(PlayerInfo[playerid][Bpm]==1) return SendClientMessage(playerid,vermelhoescuro, "[PM] Você está bloqueado do uso do /pm!");
- else {
- idn
- }
- return 1;
- }
- if(strcmp("/blockpm", cmdtext, true, 10) == 0)
- {
- if(PlayerInfo[playerid][Bmpm]==0) {PlayerInfo[playerid][Bmpm]=1;SendClientMessage(playerid,amarelo,"[PM] Você habilitou seu sistema de PMs!");return 1;}
- if(PlayerInfo[playerid][Bmpm]==1) {PlayerInfo[playerid][Bmpm]=0;SendClientMessage(playerid,amarelo,"[PM] Você desabilitou seu sistema de PMs!");return 1;}
- return 1;
- }
- if(strcmp("/verpms", cmdtext, true, 10) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,vermelhoescuro, "[PM] Você não é Admin RCON!");
- if(Verpms[playerid]==0) {Verpms[playerid]=1;SendClientMessage(playerid,amarelo,"[PM] Você habilitou o sistema para ler PMs.");return 1;}
- if(Verpms[playerid]==1) {Verpms[playerid]=0;SendClientMessage(playerid,amarelo,"[PM] Você desabilitou o sistema para ler PMs.");return 1;}
- return 1;
- }
- if(strcmp("/logpm", cmdtext, true, 10) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,vermelhoescuro, "[PM] Você não é Admin RCON!");
- if(!fexist("logpm.txt")) return SendClientMessage(playerid,vermelhoescuro, "[PM] Arquivo 'logpm.txt' não encontrado!");
- if(Logpms==0) {Logpms=1;SendClientMessage(playerid,amarelo,"[PM] Você habilitou o sistema para guardar o log das PMs.");return 1;}
- if(Logpms==1) {Logpms=0;SendClientMessage(playerid,amarelo,"[PM] Você desabilitou o sistema para guardar o log das PMs.");return 1;}
- return 1;
- }
- dcmd(bpm,3,cmdtext);
- dcmd(kpm,3,cmdtext);
- return 0;
- }
- dcmd_bpm(playerid,params[])
- {
- new id,sn;
- if(sscanf(params,"ii",id,sn)) SendClientMessage(playerid,vermelhoescuro, "USO: /bpm [ID] [1(SIM)/0(NAO)]");
- else if(!IsPlayerAdmin(playerid)) SendClientMessage(playerid,vermelhoescuro, "[PM] Você não é Admin RCON!");
- else if(id==playerid) SendClientMessage(playerid,vermelhoescuro, "[PM] Este é o seu ID!");
- else if(!IsPlayerConnected(id)) SendClientMessage(playerid,vermelhoescuro, "[PM] Este player não se encontra online!");
- else {
- if(sn==1) {
- if(PlayerInfo[id][Bpm]==1) return SendClientMessage(id,vermelhoescuro, "[PM] Este ID já está bloqueado do uso da /pm.");
- PlayerInfo[id][Bpm]=1;
- SendClientMessage(id,vermelhoescuro, "[PM] Você foi bloqueado do uso da /pm.");
- return 1;
- }
- if(sn==0) {
- if(PlayerInfo[id][Bpm]==0) return SendClientMessage(id,vermelhoescuro, "[PM] Este ID já está desbloqueado do uso da /pm.");
- PlayerInfo[id][Bpm]=0;
- SendClientMessage(id,vermelhoescuro, "[PM] Você foi desbloqueado do uso da /pm.");
- return 1;
- }
- }
- return 1;
- }
- // PM-BR Script By SuB_ZeRo0_ [0.3] [S.A.S]
- dcmd_kpm(playerid,params[])
- {
- new sn[128];
- if(sscanf(params,"s",sn)) SendClientMessage(playerid,vermelhoescuro, "USO: /kpm [SIM/NAO]");
- else if(!IsPlayerAdmin(playerid)) SendClientMessage(playerid,vermelhoescuro, "[PM] Você não é Admin RCON!");
- else {
- if(!strcmp(params,"sim",true)) {
- if(kpm==1) {SendClientMessage(playerid,vermelhoescuro,"[PM] O /pm já está desabilitado!");return 1;}
- kpm=1;
- SendClientMessageToAll(vermelhoescuro, "[PM] O /pm foi desabilitado.");
- return 1;
- }
- if(!strcmp(params,"nao",true)) {
- if(kpm==0) {SendClientMessage(playerid,vermelhoescuro,"[PM] O /pm já está habilitado!");return 1;}
- kpm=0;
- SendClientMessageToAll(vermelhoescuro, "[PM] O /pm foi habilitado.");
- return 1;
- }
- }
- return 1;
- }
- // PM-BR Script By SuB_ZeRo0_ [0.3] [S.A.S]
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == 1601)
- {
- if(response) { if(!inputtext[0]) {SendClientMessage(playerid,vermelhoescuro, "Coloque uma mensagem no campo indicado!"); pm return 1;}}
- if(response) {
- new nome2[25],nome3[25],strt[128],strtt[128];
- GetPlayerName(playerid,nome2,25);
- GetPlayerName(ide[playerid],nome3,25);
- format(stringpm,sizeof(stringpm),"Mensagem de: %s \nTexto: %s",nome2,inputtext);
- format(strtt,sizeof(strtt),"[PM] %s (ID:%i) para %s (ID:%i): %s\r\n",nome2,playerid,nome3,ide[playerid],inputtext);
- format(strt,sizeof(strt),"[PM] %s (ID:%i) para %s (ID:%i): %s\r\n",nome2,playerid,nome3,ide[playerid],inputtext);
- if(Logpms==1) {new File:log=fopen("logpm.txt",io_append);fwrite(log,strt);fclose(log);}
- for(new i=0;i<MAX_PLAYERS;i++)
- if(Verpms[i]==1) {SendClientMessage(i,amarelo,strtt);}
- receb1 }
- return 1;
- }
- if(dialogid == 1602)
- {
- if(response) { resp }
- return 1;
- }
- if(dialogid == 1603)
- {
- if(response) { if(!inputtext[0]) {SendClientMessage(playerid,vermelhoescuro, "Coloque uma mensagem no campo indicado!"); pm return 1;}}
- if(response) {
- new nome[25],nome2[25],strt[128],strtt[128];
- GetPlayerName(playerid,nome,25);
- GetPlayerName(idee[playerid],nome2,sizeof(nome2));
- format(stringpm,sizeof(stringpm),"Resposta de: %s \nTexto: %s",nome,inputtext);
- format(strtt,sizeof(strtt),"[PM] %s (ID:%i) para %s (ID:%i): %s\r\n",nome,playerid,nome2,idee[playerid],inputtext);
- format(strt,sizeof(strt),"[PM] %s (ID:%i) para %s (ID:%i): %s\r\n",nome,playerid,nome2,idee[playerid],inputtext);
- if(Logpms==1) {new File:log=fopen("logpm.txt",io_append);fwrite(log,strt);fclose(log);}
- for(new i=0;i<MAX_PLAYERS;i++)
- if(Verpms[i]==1) {SendClientMessage(i,amarelo,strtt);}
- if(playerid==ide[playerid]) {receb2 return 1;}
- if(playerid!=ide[playerid]) {receb1 return 1;}
- }
- return 1;
- }
- if(dialogid == 1604)
- {
- if(response) { if(!inputtext[0]) {SendClientMessage(playerid,vermelhoescuro, "Coloque o ID do player no campo indicado!"); pm return 1;}}
- if(response) {
- ide[playerid] = strval(inputtext);
- idee[ide[playerid]]=playerid;
- if(PlayerInfo[playerid][Bmpm]==1) {SendClientMessage(playerid,vermelhoescuro, "[PM] Seu sistema de PM está desligado. Use '/blockpm' para desbloquear!");return 1;}
- if(PlayerInfo[ide[playerid]][Bmpm]==1) {SendClientMessage(playerid,vermelhoescuro, "[PM] Este ID está com o sistema de PM desligado!");return 1;}
- if(PlayerInfo[idee[playerid]][Bmpm]==1) {SendClientMessage(playerid,vermelhoescuro, "[PM] Este ID está com o sistema de PM desligado!");return 1;}
- if(ide[playerid]==playerid) {SendClientMessage(playerid,vermelhoescuro, "[PM] Este é o seu ID!");return 1;}
- if(!IsPlayerConnected(ide[playerid])) {SendClientMessage(playerid,vermelhoescuro, "[PM] Este player não se encontra online!");return 1;}
- if(!IsPlayerConnected(idee[playerid])) {SendClientMessage(playerid,vermelhoescuro, "[PM] Este player não se encontra online!");return 1;}
- if(PlayerInfo[ide[playerid]][Bpm]==1) {SendClientMessage(playerid,vermelhoescuro, "[PM] Este player está bloqueado do uso da /pm!");return 1;}
- if(PlayerInfo[playerid][Bpm]==1) {SendClientMessage(playerid,vermelhoescuro, "[PM] Você está bloqueado do uso da /pm!");return 1;}
- if(PlayerInfo[idee[playerid]][Bpm]==1) {SendClientMessage(playerid,vermelhoescuro, "[PM] Este player está bloqueado do uso da /pm!");return 1;}
- if(kpm==1) {SendClientMessage(playerid,vermelhoescuro, "[PM] O comando /pm está desabilitado atualmente.");return 1;}
- else { pm }
- }
- return 1;
- }
- return 0;
- }
- //============================================================
- // PM-BR Script By SuB_ZeRo0_ [0.3] [S.A.S]
- // Versao: 0.1.8 || PREMIUM: SIM || SA-MP.com
- // Comandos PREMIUM: /bpm & /kpm
- // Não apague os créditos!
- // Contato: Vá ao forum SA-MP.com Area: Portuguese/Portugues
- //============================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement