CMD:abrirportao(playerid, params[])
{
new ta,dono;
for(new i; i<1000; i++)
{
if(IsPlayerInRangeOfPoint(playerid,5, SistemaPortao[i][PortaoX],SistemaPortao[i][PortaoY],SistemaPortao[i][PortaoZ]))
{
ta = 1;
if(!strcmp(NomePlayer(playerid), SistemaPortao[i][PortaoDono]))
{
if(PortaoOcupado[i] == 1) return SendClientMessage(playerid, -1,"Portгo em movimento ! Aguarde atй ele parar.");
dono = 1;
SistemaAbrirPortao(playerid, i);
return 1;
}
else
{
ShowPlayerDialog(playerid,10102, DIALOG_STYLE_INPUT, "Senha Portao", "{ffffff}Digite a Senha deste portao:", "Ok", "Cancelar");
SetPVarInt(playerid, "portaofrente", i);
}
}
}
if(ta == 0) return SendClientMessage(playerid,-1,"Vocк nгo esta Proximo a nenhum portao !");
if(dono == 0) return SendClientMessage(playerid,-1,"Vocк nao й dono deste portao !");
return 1;
// Variavel que vai precisar amarzena o ID do portгo do player;
CMD:abrirportao(playerid, params[])
{
for(new i = 0; i < MAX_PORTAO; i++){
if(!IsPlayerInRangeOfPoint(playerid, 5, SistemaPortao[i][PortaoX], SistemaPortao[i][PortaoY], SistemaPortao[i][PortaoZ])) return SendClientMessage(playerid,-1,"Vocк nгo esta Proximo a nenhum portao !");
if(strcmp(NomePlayer(playerid), SistemaPortao[i][PortaoDono]), true) == 0){
{
if(PortaoOcupado[i] == 1) return SendClientMessage(playerid, -1,"Portгo em movimento ! Aguarde atй ele parar.");
ShowPlayerDialog(playerid, 10102, DIALOG_STYLE_INPUT, "Senha Portao", "{ffffff}Digite a Senha deste portao:", "Ok", "Cancelar");
SetPVarInt(playerid, "portaofrente", i);
}else{
SendClientMessage(playerid,-1,"Vocк nao й dono deste portao !");
}
}
return 1
}
switch(dialogid){
case 10102:{
if(response){
if(strcmp(inputtext, "VARIAVEL QUE CONTENHA SENHA DO PORTГO AQUI -"), true) == 0){
SistemaAbrirPortao(playerid, "VARIAVEL QUE CONTENHA O ID DO PORTГO DO PLAYER");
}else{
SendClientMessage(playerid,-1,"Senha invalida");
}
}
}
}
PHP код:
|
new enterGrade[] =
{
/* Vamos inserir uma variбvel alocada. */
/* Coloque sua senha, digamos que a minha й '2001' */
2001
};
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 201)
{
if(response)
{
for(new i = 0, e = sizeof(enterGrade); i < e; i++)
{
if(strval(inputtext) != enterGrade[i])
return SendClientMessage(playerid, -1, "Senha incorreta, nгo foi possivel abrir o portгo.");
/* Atй aqui, jб estб com todo o caminho andado, agora vocк apenas faz as alteraзхes com o portгo.
Usando MoveObject e etc. */
}
}
}
return true;
}
CMD:opengrade(playerid)
{
if(!IsPlayerConnected(playerid))
return false;
ShowPlayerDialog(playerid, 201, DIALOG_STYLE_INPUT, "Senha para abertura do portгo", "Digite a senha para executar a abertura do portгo", "Avanзar", "Cancelar");
return true;
}
if(dialogid == 10102)
{
if(response)
{
new idc = GetPVarInt(playerid,"portaofrente");
if(!strcmp(inputtext, SistemaPortao[idc][PortaoSenha]))
{
if(PortaoOcupado[idc] == 1) return SendClientMessage(playerid, -1,"Portгo em movimento ! Aguarde atй ele parar.");
SistemaAbrirPortao(playerid, idc);
}
else
{
ShowPlayerDialog(playerid,10102, DIALOG_STYLE_INPUT, "Senha Portao", "{ff0000}[ERRO] {ffffff}Senha Incorreta !\nDigite a Senha deste portao:", "Ok", "Cancelar");
}
return 1;
}
return 1;
}
Vamos fazer de uma forma mais simples, й уbvio.
Tome uma base, e desenvolva o seu prуprio. PHP код:
|
new enterGrade[] =
{
2001,
2002
};
PortaoDono = uguinho
PortaoSenha = 1234 // essa й a senha que deveria abrir o portao sу que se o cara digita 1 ela ja abre
PortaoText = {CD853F}Portao de {ffffff}uguinho{CD853F} buzine ou
digite {ffffff}/abrirportao{CD853F} para abrir
PortaoText = {CD853F}Portao de {ffffff}uguinho{CD853F} buzine ou
digite {ffffff}/abrirportao{CD853F} para abrir
PortaoX = 1473.07043457
PortaoY = -1700.18176269
PortaoZ = 15.04687500
PortaoRX = 0.00000000
PortaoRY = 0.00000000
PortaoRZ = 0.00000000
PortaoInterior = 0
PortaoMundo = 3
if(dialogid == 10102)
{
if(response)
{
new idc = GetPVarInt(playerid,"portaofrente");
if(strcmp(inputtext, FilePortao(idc), true) == 0){
if(PortaoOcupado[idc] == 1) return SendClientMessage(playerid, -1,"Portгo em movimento ! Aguarde atй ele parar.");
SistemaAbrirPortao(playerid, idc);
}else{
ShowPlayerDialog(playerid,10102, DIALOG_STYLE_INPUT, "Senha Portao", "{ff0000}[ERRO] {ffffff}Senha Incorreta !\nDigite a Senha deste portao:", "Ok", "Cancelar");
}
}
return 1;
}
static FilePortao(idc){
new file[64];
format(file, sizeof(file), "ArquivosBPS/Portoes/Portao_%d.ini", idc);
return DOF2_SetString(file, "PortaoSenha");
}
PHP код:
PHP код:
|
C:\Users\igorm\Desktop\Brasil \gamemodes\bps.pwn(14007) : error 035: argument type mismatch (argument 2)
C:\Users\igorm\Desktop\Brasil \gamemodes\bps.pwn(95892) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
if(strcmp(inputtext, FilePortao(idc), true) == 0){ //linha 14007
return DOF2_SetString(file, "PortaoSenha"); // linha 95892
if(dialogid == 10102)
{
if(response)
{
new idc = GetPVarInt(playerid,"portaofrente");
new file[64];
format(file, sizeof(file), "ArquivosBPS/Portoes/Portao_%d.ini", idc);
if(strcmp(inputtext, DOF2_GetString(file, "PortaoSenha"), true) == 0){
if(PortaoOcupado[idc] == 1) return SendClientMessage(playerid, -1,"Portгo em movimento ! Aguarde atй ele parar.");
SistemaAbrirPortao(playerid, idc);
}else{
ShowPlayerDialog(playerid,10102, DIALOG_STYLE_INPUT, "Senha Portao", "{ff0000}[ERRO] {ffffff}Senha Incorreta !\nDigite a Senha deste portao:", "Ok", "Cancelar");
}
}
return 1;
}