SA-MP Forums Archive
[AJUDA] Duvida a respeito servidor DOF2 e zcmd - 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] Duvida a respeito servidor DOF2 e zcmd (/showthread.php?tid=665252)



[AJUDA] Duvida a respeito servidor DOF2 e zcmd - Thomazinny - 27.03.2019

Pessoal, reparei que a maioria das gm da internet nгo suportao a include zcmd ,pode ate pegando quando compila, mas quando entra no servidor da ''unknown comman'', e gostaria saber o porque.

Outra questгo, ouvir falar que tem como converter uma parte da gm pra zcmd, gostaria saber se e verнdico.



Re: [AJUDA] Duvida a respeito servidor DOF2 e zcmd - RenanMsV - 27.03.2019

o que й zcmd?


Re: [AJUDA] Duvida a respeito servidor DOF2 e zcmd - MituhBR - 27.03.2019

Quote:
Originally Posted by RenanMsV
Посмотреть сообщение
o que й zcmd?
Um processador de comandos


Re: [AJUDA] Duvida a respeito servidor DOF2 e zcmd - MultiKill - 27.03.2019

Desde a versгo 0.3 a callback OnPlayerCommandText nгo pode mais ser usada.

Para isso use a callback OnPlayerCommandPerformed, exemplo:

PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success){
    
//retorna a 1 caso o comando jб tenha sido executado
    
if(success){
        return 
1;
    }
    if(!
strcmp(cmdtext"/teste")){
        
SendClientMessage(playerid, -1"Testando 123.");
        return 
1;
    }
    
    
//Retorna a mensagem de erro, pelo comando nгo existir
    
return SendClientMessage(playerid, -1"O comando nгo foi encontrado.");

Recomendo refazer todos os comandos usando algum processador de comandos como o prуprio zcmd.

Se quiser entender melhor como a include funciona, sу abrir ela e analisar. O funcionamento й muito simples.


Re: [AJUDA] Duvida a respeito servidor DOF2 e zcmd - RenanMsV - 27.03.2019

esqueзa zcmd e use Pawn.CMD


Re: [AJUDA] Duvida a respeito servidor DOF2 e zcmd - Thomazinny - 28.03.2019

Quote:
Originally Posted by MultiKill
Посмотреть сообщение
Desde a versгo 0.3 a callback OnPlayerCommandText nгo pode mais ser usada.

Para isso use a callback OnPlayerCommandPerformed, exemplo:

PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success){
    
//retorna a 1 caso o comando jб tenha sido executado
    
if(success){
        return 
1;
    }
    if(!
strcmp(cmdtext"/teste")){
        
SendClientMessage(playerid, -1"Testando 123.");
        return 
1;
    }
    
    
//Retorna a mensagem de erro, pelo comando nгo existir
    
return SendClientMessage(playerid, -1"O comando nгo foi encontrado.");

Recomendo refazer todos os comandos usando algum processador de comandos como o prуprio zcmd.

Se quiser entender melhor como a include funciona, sу abrir ela e analisar. O funcionamento й muito simples.
Pelo que eu entendi, vou ter q procurar todas as linhas que contem ''callback OnPlayerCommandText''
E converter para ''callback OnPlayerCommandPerformed''


Re: [AJUDA] Duvida a respeito servidor DOF2 e zcmd - MultiKill - 28.03.2019

Quote:
Originally Posted by Thomazinny
Посмотреть сообщение
Pelo que eu entendi, vou ter q procurar todas as linhas que contem ''callback OnPlayerCommandText''
E converter para ''callback OnPlayerCommandPerformed''
No gamemode, tu terб que mover os comandos da callback OnPlayerCommandText para callback OnPlayerCommandPerformed, se usar dcmd sу mover a chamada do comando de OnPlayerCommandText para OnPlayerCommandPerformed.

Mas й muito melhor jб deixar tudo usando um processador de comandos, do que fazer esse tipo de gambiarra.

Lembrando que nгo basta trocar sу "OnPlayerCommandText" para "OnPlayerCommandPerformed", verifique se o parвmetro success й igual a 1, caso for o comando jб foi executado.

Ai sу retornar a 1, e deixar os restantes dos comandos abaixo.


Re: [AJUDA] Duvida a respeito servidor DOF2 e zcmd - Thomazinny - 28.03.2019

Muito obrigado multkill, ajudou mt, teria um tutorial que ajude isso?
Outra por que maioria gms nгo possui sistema pra ZCMD


Re: [AJUDA] Duvida a respeito servidor DOF2 e zcmd - MultiKill - 28.03.2019

Existem alguns tutorias ensinado a usar a callback OnPlayerCommandText, mas recomendo usar OnPlayerCommandPerformed.

Um exemplo de "conversгo":
PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    new 
cmd[256+1];
    new 
idx;
    
cmd strtok(cmdtextidx);
    if(
strcmp(cmd"/player2v"true) == 0)
    {
          new 
tmp[256];
          new 
tmp2[256];
        
tmp strtok(cmdtext,idx);
        
tmp2 strtok(cmdtext,idx);
        
PutPlayerInVehicle(strval(tmp),strval(tmp2),0);
        return 
1;
    }
    
    if(
strcmpcmd"/vc"true ) == )
    {
        new 
tmp[256];
        new 
created_vehicle_id;
        
tmp strtokcmdtextidx );
        
created_vehicle_id SpawnVehicle_InfrontOfPlayer(playeridstrval(tmp), -1, -1);
        new 
msg[128+1];
        
format(msg,128,"Created vehicle: %d",created_vehicle_id);
        
SendClientMessage(playerid,0xAAAAAAAA,msg);
        return 
1;
    }
    
    return 
SendClientMessage(playerid, -1"O comando nгo foi encontrado.");

Ficando:

PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success){
    
//retorna a 1 caso o comando jб tenha sido executado
    
if(success){
        return 
1;
    }
    new 
cmd[256+1];
    new 
idx;
    
cmd strtok(cmdtextidx);
    if(
strcmp(cmd"/player2v"true) == 0)
    {
          new 
tmp[256];
          new 
tmp2[256];
        
tmp strtok(cmdtext,idx);
        
tmp2 strtok(cmdtext,idx);
        
PutPlayerInVehicle(strval(tmp),strval(tmp2),0);
        return 
1;
    }
    
    if(
strcmpcmd"/vc"true ) == )
    {
        new 
tmp[256];
        new 
created_vehicle_id;
        
tmp strtokcmdtextidx );
        
created_vehicle_id SpawnVehicle_InfrontOfPlayer(playeridstrval(tmp), -1, -1);
        new 
msg[128+1];
        
format(msg,128,"Created vehicle: %d",created_vehicle_id);
        
SendClientMessage(playerid,0xAAAAAAAA,msg);
        return 
1;
    }
    return 
SendClientMessage(playerid, -1"O comando nгo foi encontrado.");

Alguns links que tu pode olhar:
https://sampforum.blast.hk/showthread.php?tid=353756
https://sampforum.blast.hk/showthread.php?tid=619154

Como eu jб disse, o recomendado й refazer todos os comando usando um processados como o zcmd e sscanf.


Re: [AJUDA] Duvida a respeito servidor DOF2 e zcmd - Thomazinny - 29.03.2019

Muito obrigado meu amigo, vc ajudou demais.
resolvido minha duvida...
Tem discord ?