SA-MP Forums Archive
[Ajuda] [AJUDA] gotoof e gotoon bugado! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] [AJUDA] gotoof e gotoon bugado! (/showthread.php?tid=508608)



[AJUDA] gotoof e gotoon bugado! - best95 - 23.04.2014

Bom meu /gotooff e /gotoon ta bugado se um player por exemplo block o goto com /gotooff e outro player digita /gotoon ele consegue dar goto no que bloqueou o goto! ajudem codigo abaixo ja tentei de tudo.

pawn Код:
if(strcmp(cmd, "/gotooff", true) == 0)
{
for(new i = 0; i < MAX_PLAYERS; i++)
xTravarComando [ i ] = true ;
SendClientMessage ( playerid, BRANCO, "Goto bloqueado{FFFFFF}" ) ;
return 1;
}
if(strcmp(cmd, "/gotoon", true) == 0)
{
for(new i = 0; i < MAX_PLAYERS; i++)
xTravarComando [ i ] = false ;
SendClientMessage ( playerid, BRANCO, "Goto desbloqueado{FFFFFF}!" ) ;
return 1;
}



Re: [AJUDA] gotoof e gotoon bugado! - Fel486 - 23.04.2014

Comando corrigido + implemento:

pawn Код:
new bool:bloqueado[MAX_PLAYERS]; // Topo do script

if(strcmp(cmd, "/gotooff", true) == 0)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        bloqueado [ i ] = true ;
        SendClientMessage ( playerid, BRANCO, "Goto bloqueado{FFFFFF}" ) ;
    }
    return 1;
}

if(strcmp(cmd, "/gotoon", true) == 0)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        bloqueado [ i ] = false ;
        SendClientMessage ( playerid, BRANCO, "Goto desbloqueado{FFFFFF}!" ) ;
    }
    return 1;
}

E no seu comando GOTO vocк adiciona a seguinte condiзгo:

pawn Код:
if(bloqueado [ PLAYERID_ALVO ] == true) return 0; // PLAYERID_ALVO = ID do jogador digitado (EXEMPLO)



Re: [AJUDA] gotoof e gotoon bugado! - best95 - 23.04.2014

if(bloqueado [ PLAYERID_ALVO ] == true) return 0;

deixo assim?

if(bloqueado [ PLAYERID ] == true) return 0;


Re: [AJUDA] gotoof e gotoon bugado! - Fel486 - 23.04.2014

Nгo, pois vocк se bloquearia.

O comando do goto й: /goto ALVO

entгo seria:
pawn Код:
if(bloqueado [ALVO] == true) return 0; // Ao invйs do 0, vocк poderia colocar alguma mensagem



Re: [AJUDA] gotoof e gotoon bugado! - best95 - 23.04.2014

ERRO!

error 017: undefined symbol "ALVO"


Re: [AJUDA] gotoof e gotoon bugado! - Fel486 - 23.04.2014

Quote:
Originally Posted by best95
Посмотреть сообщение
ERRO!

error 017: undefined symbol "ALVO"
Й porque a variavel "ALVO" que dei foi sу um exemplo. Todo comando tem seus parametros e variaveis.

Olhe um exemplo bбsico do GOTO que fiz com a variбvel "ALVO".

pawn Код:
CMD:goto(playerid, params[])
{
        // Criei esse comando com a variavel "ALVO", ou seja, vou para o jogador de ID "ALVO"
    new ALVO, Float:x, Float:y, Float:z;
   
    if(IsPlayerConnected(ALVO)) //  Se o "ALVO" estiver conectado...
    {
        GetPlayerPos(ALVO, x, y, z);
        if(bloqueado [ALVO] == true) return 0; // Se o "ALVO" tiver bloqueado o GOTO, nada acontece.
        else SetPlayerPos(playerid, x, y, z); // Caso contrбrio, irei atй o "ALVO"
    }
   
    return 1;
}



Re: [AJUDA] gotoof e gotoon bugado! - best95 - 23.04.2014

entгo meu goto aqui ficaria assim??

pawn Код:
if(strcmp(cmd, "/goto", true) == 0)
{
if(MundoMATAMATA[playerid] == true) return SendClientMessage(playerid, CorCinza, "Comando nгo pode ser usado no mundo Mata Mata {FFFFFF}/Mundos{FFFFFF}!");
if(bloqueado [giveplayerid] == true) return 0; // Ao invйs do 0, vocк poderia colocar alguma mensagem
GetPlayerName(playerid, sendername, sizeof(sendername));
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, Branco, "{FF0000}Uso correto: /Goto id");
return 1;
}
new Float:plocx,Float:plocy,Float:plocz;
giveplayerid = strval(tmp);
if(IsPlayerConnected(giveplayerid))
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "Vocк Foi atй o jogador {FFFFFF}%s{00F600}(%i).", giveplayer, giveplayerid);
SendClientMessage(playerid, Branco, string);
GetPlayerPos(giveplayerid, plocx, plocy, plocz);
new intid = GetPlayerInterior(giveplayerid);
SetPlayerInterior(playerid,intid);
if (GetPlayerState(playerid) == 2)
{
new tmpcar = GetPlayerVehicleID(playerid);
SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
}
else
{
SetPlayerPos(playerid,plocx,plocy+2, plocz);
}
}
else
{
format(string, sizeof(string), "%d nгo й um player ativo!", giveplayerid);
SendClientMessage(playerid, Branco, string);
}
return 1;
}