[Ajuda] passar um comando
#1

BOAS PESSOAL

Eu queria passar este comando do lladmin:
pawn Код:
CMD:falar(playerid, params[])
{
    new Fala[128];
    if(PlayerDados[playerid][Admin] < 3) return SendClientMessage(playerid, BRANCO, "Vocк precisa ser admin nivel 3 para usar este comando!");
    if(PlayerDados[playerid][Trabalhando] == false) return SendClientMessage(playerid, CINZA, "Vocк precisa trabalhar para usar o comando. Use /servico.");
    if(sscanf(params, "s", Fala)) return SendClientMessage(playerid, CINZA, "Use /falar [texto]"), SendClientMessage(playerid, CINZA, "Use o comando para falar usando a voz do ****** tradutor");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        format(String, sizeof(String), "http://translate.******.com/translate_tts?tl=pt&q=%s", Fala);
        PlayAudioStreamForPlayer(i, String, 0, 0, 0, 0, 0);
    }
    format(String, sizeof(String), "[LL ADMIN] Admin {1B95E0}%s{00C2EC} Falando!", Nome(playerid));
    SendClientMessageToAll(AZUL_CLARO, String);
    return 1;
}
PARA DCMD,JA TENTEI DE TUDO! E NAO DA OU ENTAO DA UMA CARRADA DE ERROS! AJUDEM-ME SFF
ABRAЗOS
Reply
#2

Se vocк usa sscanf acho que esta correto fazer assim.
pawn Код:
dcmd_falar(playerid, params[])
{
    new Fala[128];
    if(PlayerDados[playerid][Admin] < 3) return SendClientMessage(playerid, BRANCO, "Vocк precisa ser admin nivel 3 para usar este comando!");
    if(PlayerDados[playerid][Trabalhando] == false) return SendClientMessage(playerid, CINZA, "Vocк precisa trabalhar para usar o comando. Use /servico.");
    if(sscanf(params, "s", Fala)) return SendClientMessage(playerid, CINZA, "Use /falar [texto]"), SendClientMessage(playerid, CINZA, "Use o comando para falar usando a voz do ****** tradutor");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        format(String, sizeof(String), "http://translate.******.com/translate_tts?tl=pt&q=%s", Fala);
        PlayAudioStreamForPlayer(i, String, 0, 0, 0, 0, 0);
    }
    format(String, sizeof(String), "[LL ADMIN] Admin {1B95E0}%s{00C2EC} Falando!", Nome(playerid));
    SendClientMessageToAll(AZUL_CLARO, String);
    return 1;
}

public OnPlayerCommandText(playerid, const cmdtext[]){

  dcmd(falar,5,cmdtext);

  return 0;
}

Mas se nгo usa sscanf, deve usar strtok.


Sу uma coisa, vocк deveria fazer ao contrario, converter todos comandos para ZCMD e nгo usar dcmd. dcmd й um sistema antigo que usa um macro para strcmp...
Reply
#3

Quote:
Originally Posted by Schocc
Посмотреть сообщение
Se vocк usa sscanf acho que esta correto fazer assim.
pawn Код:
dcmd_falar(playerid, params[])
{
    new Fala[128];
    if(PlayerDados[playerid][Admin] < 3) return SendClientMessage(playerid, BRANCO, "Vocк precisa ser admin nivel 3 para usar este comando!");
    if(PlayerDados[playerid][Trabalhando] == false) return SendClientMessage(playerid, CINZA, "Vocк precisa trabalhar para usar o comando. Use /servico.");
    if(sscanf(params, "s", Fala)) return SendClientMessage(playerid, CINZA, "Use /falar [texto]"), SendClientMessage(playerid, CINZA, "Use o comando para falar usando a voz do ****** tradutor");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        format(String, sizeof(String), "http://translate.******.com/translate_tts?tl=pt&q=%s", Fala);
        PlayAudioStreamForPlayer(i, String, 0, 0, 0, 0, 0);
    }
    format(String, sizeof(String), "[LL ADMIN] Admin {1B95E0}%s{00C2EC} Falando!", Nome(playerid));
    SendClientMessageToAll(AZUL_CLARO, String);
    return 1;
}

public OnPlayerCommandText(playerid, const cmdtext[]){

  dcmd(falar,5,cmdtext);

  return 0;
}

Mas se nгo usa sscanf, deve usar strtok.


Sу uma coisa, vocк deveria fazer ao contrario, converter todos comandos para ZCMD e nгo usar dcmd. dcmd й um sistema antigo que usa um macro para strcmp...
Isso seria o correto adaptado ao ladmin4v2:
pawn Код:
dcmd_falar(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 1 || IsPlayerAdmin(playerid)) {
    if(!strlen(params)) return SendClientMessage(playerid,red,"USO: /falar [texto]");
    CMDMessageToAdmins(playerid,"FALAR");
    {
        format(String, sizeof(String), "http://translate.******.com/translate_tts?tl=pt&q=%s", Fala);
        PlayAudioStreamForPlayer(i, String, 0, 0, 0, 0, 0);
    } else return SendClientMessage(playerid,red,"[ERRO]: Vocк nгo й adm!");
}
Olhe o resultado:
Quote:

C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(329) : error 017: undefined symbol "AntiDeAMX"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(400) : error 017: undefined symbol "UpdateConfig"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(81 : error 017: undefined symbol "LoadConfig"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(820) : error 017: undefined symbol "SaveToFile"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(854) : error 017: undefined symbol "SaveToFile"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(881) : error 017: undefined symbol "ResetPlayerCash"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(960) : error 017: undefined symbol "PlayerName2"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(969) : error 017: undefined symbol "SaveToFile"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(972) : error 017: undefined symbol "PlayerName2"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(974) : error 017: undefined symbol "PlayerName2"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(977) : error 017: undefined symbol "PlayerName2"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(985) : error 017: undefined symbol "SaveToFile"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(1006) : error 017: undefined symbol "SaveToFile"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(1020) : error 017: undefined symbol "SaveToFile"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(1049) : error 017: undefined symbol "PlayerName2"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(1062) : error 017: undefined symbol "LoginPlayer"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(1079) : error 017: undefined symbol "PlayerName2"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(1087) : error 017: undefined symbol "LoginPlayer"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(1150) : error 017: undefined symbol "PlayerName2"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(1151) : error 017: undefined symbol "SaveToFile"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(1197) : error 017: undefined symbol "SavePlayer"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(119 : error 017: undefined symbol "PlayerName2"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(119 : error 017: undefined symbol "PlayerName2"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(120 : error 017: undefined symbol "CarDeleter"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(1213) : error 017: undefined symbol "AdvanceSpectate"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(1296) : error 017: undefined symbol "KickPlayerEx"

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


26 Errors.

Serб que me pode ajudar?
Reply
#4

Vocк removeu o loop for.

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{


}

Alйm disso, nгo esta correta a estrutura condicional;

Faltou uma chave }..


Sу se abre chaves {} em condiзгo if / else if

Em chamadas de funзхes nгo pode abrir chaves.


pawn Код:
comando_func();
{ // Isso esta incorreto

}

E lembre-se abre as chaves jб fecha no mesmo momento para nгo se esquecer.
Reply
#5

Quote:
Originally Posted by Schocc
Посмотреть сообщение
Vocк removeu o loop for.
Removi sim,errei ja adicionei porem continua a dar os mesmos erros!
pawn Код:
dcmd_falar(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 1 || IsPlayerAdmin(playerid)) {
    if(!strlen(params)) return SendClientMessage(playerid,red,"USO: /falar [texto]");
    for(new i = 0; i < MAX_PLAYERS; i++)
    CMDMessageToAdmins(playerid,"FALAR");
    {
        format(String, sizeof(String), "http://translate.******.com/translate_tts?tl=pt&q=%s", Fala);
        PlayAudioStreamForPlayer(i, String, 0, 0, 0, 0, 0);
    } else return SendClientMessage(playerid,red,"[ERRO]: Vocк nгo й adm!");
}
Alguma soluзгo?
Abraзos

Onde faltariam a } ?
Reply
#6

PHP код:
dcmd_falar(playerid,params[]) {
    if(
PlayerInfo[playerid][Level] >= || IsPlayerAdmin(playerid)) {
        if (!
strlen(params))
            return 
SendClientMessage(playerid,red,"USO: /falar [texto]");
        
        for(new 
0MAX_PLAYERSi++){
            
format(Stringsizeof(String), "http://translate.******.com/translate_tts?tl=pt&q=%s"params);
            
PlayAudioStreamForPlayer(iString00000);
        }
    }
    else
        
SendClientMessage(playerid,red,"[ERRO]: Vocк nгo й adm!");
    
    return 
1;

Reply
#7

Quote:
Originally Posted by Schocc
Посмотреть сообщение
PHP код:
dcmd_falar(playerid,params[]) {
    if(
PlayerInfo[playerid][Level] >= || IsPlayerAdmin(playerid)) {
        if (!
strlen(params))
        return 
SendClientMessage(playerid,red,"USO: /falar [texto]");
        
        for(new 
0MAX_PLAYERSi++){
            
format(Stringsizeof(String), "http://translate.******.com/translate_tts?tl=pt&q=%s"params);
            
PlayAudioStreamForPlayer(iString00000);
        }
    }
    else
        
SendClientMessage(playerid,red,"[ERRO]: Vocк nгo й adm!");
    
    return 
1;

Diminuiu os erros (; mas ainda..
pawn Код:
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(3402) : error 017: undefined symbol "String"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(3402) : error 017: undefined symbol "String"
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(3402) : error 029: invalid expression, assumed zero
C:\Users\Pedro\Desktop\Programs PC\RackSAMP\Bloody Vegas\filterscripts\ladmin4v2.pwn(3402) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply
#8

Crie a string.

new String[128];

Como vocк vai criar um sistema sem saber criar variбveis...
Nгo de o passo maior que sua perna.


Vocк deveria ler este tуpico.
https://sampforum.blast.hk/showthread.php?tid=252966
Reply
#9

Quote:
Originally Posted by Schocc
Посмотреть сообщение
Crie a string.

new String[128];

Como vocк vai criar um sistema sem saber criar variбveis...
Nгo de o passo maior que sua perna.


Vocк deveria ler este tуpico.
https://sampforum.blast.hk/showthread.php?tid=252966
Deu certo! Obrigado Rep+
Abraзos
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)