13.07.2012, 02:35
(
Последний раз редактировалось [XPG]MarlonCS; 14.07.2012 в 21:50.
Причина: Strings desnecessбrios retirados
)
Rб. Meu primeiro tutorial
Meu GM novo virб com 2 idiomas, Portuguкs e Inglкs, entгo vim mostra-lhes como eu fiz.
Necessбrio:
* Include DOF2 ou qualquer outro de salvamento;
* Criaзгo da pasta lang em Scriptfiles.
1 - Primeiramente, definimos isso no topo do GM:
__________________________________________________ _____________________
2 - Usaremos "idioma[MAX_PLAYERS]" para definir as mensagens e comandos em Portuguкs em inglкs. Partimos para a seguinte ideologia:
__________________________________________________ _____________________
3 - Em OnPlayerConnect, criamos um dialogo para a escolha de idioma
Verificamos que logo acima exibe um dialogo caso o player nгo tenha definido o seu idioma.
__________________________________________________ _____________________
4 - Coloque o cуdigo abaixo em OnDialogResponde
__________________________________________________ _____________________
5 - Agora estб tudo pronto. Basta agora usarmos as variбveis...
* Em um comando (zcmd):
-> Ao player digitar /comandos, serб exibida uma mensagem para todos os players, e cada um verб no seu idioma escolhido.
Ps.: Funciona tambйm com strcmd, dcmd e etc, basta adaptar.
* Mensagem de entrada e saнda do servidor:
-> Exibe a mensagem de entrada para todos, e cada um verб no seu idioma escolhido.
* Mensagem para o player:
-> Manda a mensagem para o player no idioma escolhido por ele.
* Chat do samp:
-> Por exemplo:
Player: Robin (escolheu inglкs) e MarlonCS (escolheu portuguкs);
Para o 'MarlonCS' se exibirб assim:
Robin [0] diz: Hello Marlon
MarlonCS [1] diz: Hello Robin
Para o 'Robin' se exibirб assim:
Robin [0] says: Hello Marlon
MarlonCS [1] says: Hello Robin
__________________________________________________ _____________________
6 - GM de exemplo
7 - Finalizaзгo
Para adicionar um novo idioma, basta definir o "idioma[playerid]" para mais variбveis, exemplo:
Vocк pode definir quantos vocк quiser.
Perdoem-me se fui muito rбpido no tuto, mas, creio que esteja claro.
Dъvidas? Idйias? marloncs_22 < Skype
Meu GM novo virб com 2 idiomas, Portuguкs e Inglкs, entгo vim mostra-lhes como eu fiz.
Necessбrio:
* Include DOF2 ou qualquer outro de salvamento;
* Criaзгo da pasta lang em Scriptfiles.
1 - Primeiramente, definimos isso no topo do GM:
pawn Код:
new idioma[MAX_PLAYERS]; // variбvel do idioma
new arquivo[32]; // arquivo
new string[256]; // string
const EN = 2; // Definir que 2 й o inglкs
const PT = 1; // Definir que o 1 й o portuguкs
2 - Usaremos "idioma[MAX_PLAYERS]" para definir as mensagens e comandos em Portuguкs em inglкs. Partimos para a seguinte ideologia:
pawn Код:
idioma[playerid]=0; // Sem idioma
idioma[playerid]=PT; // Portuguкs BR
idioma[playerid]=EN; // Inglкs EUA
3 - Em OnPlayerConnect, criamos um dialogo para a escolha de idioma
pawn Код:
//OnPlayerConnect
new nome[32];
new strdialog[512];
GetPlayerName(playerid,nome,sizeof nome);
format(arquivo, sizeof arquivo, "lang/%s.ini",nome);
idioma[playerid] = DOF2_GetInt(arquivo,"Idioma"); // Puxa o idioma do arquivo
if(idioma[playerid]==0) { // aqui verifica se o player nгo escolheu o idioma ainda (=0)
format(strdialog, sizeof(strdialog),"%s%s",strdialog, "Selecione seu idioma/Select your langague");
return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Idioma/Langague", strdialog, "Portuguкs", "English");
}
__________________________________________________ _____________________
4 - Coloque o cуdigo abaixo em OnDialogResponde
pawn Код:
//OnDialogResponde
if(dialogid == 1)
{
format(arquivo, sizeof arquivo, "lang/%s.ini",nome);
if(response == 0) { // Inglкs
idioma[playerid]=EN; // seta o idioma do player para Inglкs (=2/EN)
DOF2_SetInt(arquivo,"Idioma",idioma[playerid]); // salva idioma escolhido no arquivo
DOF2_SaveFile();
SetupPlayerForClassSelection(playerid); // envia o player para colocar seu skin e nascer
}
if(response == 1) { // Portuguкs
idioma[playerid]=PT; // seta o idioma do player para Portuguкs (=1/PT)
DOF2_SetInt(arquivo,"Idioma",idioma[playerid]); // salva idioma escolhido no arquivo
DOF2_SaveFile();
SetupPlayerForClassSelection(playerid); // envia o player para colocar seu skin e nascer
}
}
5 - Agora estб tudo pronto. Basta agora usarmos as variбveis...
* Em um comando (zcmd):
pawn Код:
CMD:comandos(playerid, params[]) {
for(new i; i < MAX_PLAYERS; i++) {
if(idioma[i]==PT)format(string, sizeof string,"Comando de teste"); // String em portuguкs
if(idioma[i]==EN)format(string, sizeof string,"Test command"); // String em inglкs
}
SendClientMessageToAll(COR,string);
return 1;
}
Ps.: Funciona tambйm com strcmd, dcmd e etc, basta adaptar.
* Mensagem de entrada e saнda do servidor:
pawn Код:
for(new i; i < MAX_PLAYERS; i++) {
if(idioma[i]==PT)format(string, sizeof string,"Comando de teste"); // String em portuguкs
if(idioma[i]==EN)format(string, sizeof string,"Test command"); // String em inglкs
}
SendClientMessageToAll(COR,string);
}
* Mensagem para o player:
pawn Код:
if(idioma[playerid]==PT)SendClientMessage(playerid,COR,"Olб player"); // envia a mensagem para o player em portuguкs, caso esse seja seu idioma
if(idioma[playerid]==EN)SendClientMessage(playerid,COR,"Hello player"); // envia a mensagem para o player em inglкs, caso esse seja seu idioma
* Chat do samp:
pawn Код:
public OnPlayerText(playerid)
{
new nome[32];
new color[MAX_PLAYERS];
color[playerid]=GetPlayerColor(playerid);
GetPlayerName(playerid,nome,sizeof nome);
for(new i; i < MAX_PLAYERS; i++) {
if(idioma[i]==PT)format(string, sizeof string,"%s {FFFF00}[%i] diz: {FFFFFF}%s",nome,playerid,text); // portuguкs
if(idioma[i]==EN)format(string, sizeof string,"%s {FFFF00}[%i] says: {FFFFFF}%s",nome,playerid,text); // inglкs
}
SendClientMessageToAll(color[playerid],string);
}
return 1;
}
Player: Robin (escolheu inglкs) e MarlonCS (escolheu portuguкs);
Para o 'MarlonCS' se exibirб assim:
Robin [0] diz: Hello Marlon
MarlonCS [1] diz: Hello Robin
Para o 'Robin' se exibirб assim:
Robin [0] says: Hello Marlon
MarlonCS [1] says: Hello Robin
__________________________________________________ _____________________
6 - GM de exemplo
pawn Код:
#include <a_samp>
#include <DOF2>
#define cinza 0xCFCFCFFF
#define vermelho 0xFF0000FF
#define verde_claro 0x00FF00FF
forward SetupPlayerForClassSelection(playerid);
new arquivo[32];
new idioma[MAX_PLAYERS];
const PT = 1;
const EN = 2;
public OnGameModeInit()
{
SetGameModeText("Gamemode dois idiomas");
ShowPlayerMarkers(1);
SetNameTagDrawDistance(10.0);
UsePlayerPedAnims();
AddPlayerClass(0,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1);
AddPlayerClass(266,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1);
AddPlayerClass(267,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1);
AddPlayerClass(268,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(269,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(270,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(271,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(272,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(280,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1);
AddPlayerClass(281,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1);
AddPlayerClass(282,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1);
AddPlayerClass(283,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(284,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(285,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(286,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(287,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(254,1958.3783,1343.1572,15.3746,0.0,0,0,24,300,-1,-1);
AddPlayerClass(255,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(256,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(257,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(258,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(259,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(260,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(261,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(262,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(263,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(264,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(274,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(275,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(276,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(1,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(2,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(290,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(291,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(292,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(293,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(294,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(295,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(296,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(297,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(298,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(299,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(277,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(278,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(279,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(288,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(47,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(48,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(49,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(50,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(51,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(52,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(53,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(54,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(55,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(56,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(57,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(58,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(59,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(60,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(61,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(62,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(63,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(64,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(66,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(67,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(68,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(69,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(70,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(71,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(72,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(73,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(75,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(76,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(78,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(79,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(80,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(81,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(82,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(83,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(84,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(85,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(87,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(88,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(89,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(91,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(92,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(93,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(95,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(96,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(97,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(98,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(99,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(100,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(101,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(102,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(103,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(104,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(105,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(106,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(107,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(108,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(109,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(110,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(111,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(112,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(113,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(114,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(115,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(116,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(117,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(118,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(120,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(121,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(122,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(123,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(124,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(125,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(126,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(127,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(128,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(129,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(131,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(133,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(134,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(135,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(136,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(137,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(138,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(139,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(140,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(141,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(142,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(143,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(144,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(145,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(146,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(147,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(148,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(150,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(151,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(152,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(153,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(154,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(155,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(156,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(157,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(158,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(159,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(160,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(161,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(162,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(163,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(164,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(165,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(166,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(167,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(168,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(169,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(170,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(171,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(172,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(173,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(174,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(175,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(176,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(177,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(178,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(179,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(180,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(181,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(182,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(183,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(184,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(185,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(186,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(187,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(188,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(189,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(190,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(191,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(192,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(193,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(194,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(195,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(196,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(197,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(198,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(199,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(200,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(201,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(202,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(203,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(204,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(205,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(206,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(207,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(209,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(210,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(211,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(212,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(213,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(214,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(215,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(216,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(217,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(218,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(219,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(220,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(221,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(222,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(223,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(224,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(225,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(226,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(227,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(228,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(229,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(230,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(231,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(232,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(233,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(234,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(235,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(236,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(237,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(238,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(239,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(240,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(241,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(242,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(243,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(244,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(245,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(246,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(247,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(248,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(249,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(250,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(251,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
AddPlayerClass(253,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
return 1;
}
main( ) { }
public OnGameModeExit()
{
DOF2_Exit();
return 1;
}
public OnPlayerRequestClass(playerid)
{
SetupPlayerForClassSelection(playerid);
return 1;
}
public SetupPlayerForClassSelection(playerid)
{
SetPlayerInterior(playerid,14);
SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
SetPlayerFacingAngle(playerid, 270.0);
SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
return 1;
}
public OnPlayerConnect(playerid)
{
new nome[32];
GetPlayerName(playerid, nome, sizeof(nome));
new strdialog[1000];
for(new i; i < MAX_PLAYERS; i++) {
if(idioma[i]==PT)format(string, sizeof(string), "[SERVER] %s entrou no servidor.", nome);
if(idioma[i]==EN)format(string, sizeof(string), "[SERVER] %s entered in server.", nome);
}
SendClientMessageToAll(cinza, string);
format(arquivo, sizeof arquivo, "lang/%s.ini", nome);
idioma[playerid] = DOF2_GetInt(arquivo,"Idioma");
GivePlayerMoney(playerid, 30000);
if(idioma[playerid]==0) {
format(strdialog, sizeof(strdialog),"%s%s",strdialog, "{FFFFFF}Selecione seu idioma/Select your langague");
return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Idioma/Langague", strdialog, "Portuguкs", "English");
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
SetPlayerInterior(playerid,0);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
new nome[32];
new color[MAX_PLAYERS];
GetPlayerName(playerid, nome, sizeof(nome));
color[playerid]=GetPlayerColor(playerid);
for(new i; i < MAX_PLAYERS; i++) {
if(idioma[i]==PT)format(string,sizeof string,"%s {FFFF00}[%i] diz: {FFFFFF}%s", nome, playerid, text);
if(idioma[i]==EN)format(string,sizeof string,"%s {FFFF00}[%i] says: {FFFFFF}%s", nome, playerid, text);
}
SendClientMessageToAll(color[playerid], string);
return 0;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new nome[32];
GetPlayerName(playerid, nome, sizeof(nome));
format(arquivo, sizeof arquivo, "lang/%s.lang", nome);
if (strcmp("/kill", cmdtext, true, 10) == 0)
{
SetPlayerHealth(playerid, 0);
for(new i; i < MAX_PLAYERS; i++) {
if(idioma[i]==PT)format(string, sizeof string, "[SERVER] %s resolveu se matar", nome);
if(idioma[i]==EN)format(string, sizeof string, "[SERVER] %s decide kill yourself", nome);
}
SendClientMessageToAll(vermelho, string);
}
return 1;
}
if (strcmp("/idioma", cmdtext, true, 10) == 0)
{
if(idioma[playerid]==PT){
idioma[playerid]=EN;
DOF2_SetInt(arquivo,"Idioma",sizeof arquivo);
DOF2_SaveFile();
return SendClientMessage(playerid, verde_claro, "[SERVER] Langague successful change");
}
if(idioma[playerid]==EN){
idioma[playerid]=PT;
DOF2_SetInt(arquivo,"Idioma",sizeof arquivo);
DOF2_SaveFile();
return SendClientMessage(playerid, verde_claro, "[SERVER] Idioma mudado com sucesso");
}
return 1;
}
if(idioma[playerid]==PT)return SendClientMessage(playerid, cinza, "[SERVER] Comando invбlido");
if(idioma[playerid]==EN)return SendClientMessage(playerid, cinza, "[SERVER] Invalid command");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new nome[32];
GetPlayerName(playerid, nome, sizeof(nome));
if(dialogid == 1)
{
format(arquivo, sizeof arquivo, "lang/%s.lang", nome);
DOF2_CreateFile(arquivo);
if(response == 0) { // Inglкs
idioma[playerid]=EN;
DOF2_SetInt(arquivo,"Idioma",idioma[playerid]);
DOF2_SaveFile();
SetupPlayerForClassSelection(playerid);
}
if(response == 1) { // Portuguкs
idioma[playerid]=PT;
DOF2_SetInt(arquivo,"Idioma",idioma[playerid]);
DOF2_SaveFile();
SetupPlayerForClassSelection(playerid);
}
}
return 1;
}
Para adicionar um novo idioma, basta definir o "idioma[playerid]" para mais variбveis, exemplo:
pawn Код:
const ES = 3;
const FR = 4;
const HL = 5;
idioma[playerid]=ES; // espanhol
idioma[playerid]=FR; // francкs
idioma[playerid]=HL; // holandкs
Perdoem-me se fui muito rбpido no tuto, mas, creio que esteja claro.
Dъvidas? Idйias? marloncs_22 < Skype