Cambiar de strcmp a cmd
#1

Bueno me vais a llamar pesado pero estoy empezando y cuando tengo dudas os pregunto por aqui.
Espero que no moleste.

Bueno aqui voy estos comando estan en strcmp y los quiero pasar a cmd si no es molestia y me lo explicais
PHP код:
    if(strcmp(cmd"/me"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
             if(
JugadorLogeado[playerid] == 0)
            {
                
SendClientMessage(playeridCOLOR_GREY"ЎNo estas logeado!");
                return 
1;
            }
            
GetPlayerName(playeridsendernamesizeof(sendername));
            new 
length strlen(cmdtext);
            while ((
idx length) && (cmdtext[idx] <= ' '))
            {
                
idx++;
            }
            new 
offset idx;
            new 
result[64];
            while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
            {
                
result[idx offset] = cmdtext[idx];
                
idx++;
            }
            
result[idx offset] = EOS;
            if(!
strlen(result))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"Uso: /me [acciуn]");
                return 
1;
            }
            if(
InfoJugador[playerid][jMascara] == 1)
            {
               
format(stringsizeof(string), "* Desconocido %s"result);
            }
            else
            {
               
format(stringsizeof(string), "* %s %s"sendernameresult);
            }
            
ProxDetector(30.0playeridstringCOLOR_PURPURA,COLOR_PURPURA,COLOR_PURPURA,COLOR_PURPURA,COLOR_PURPURA);
        }
        return 
1;
      }
    if(
strcmp(cmd"/do"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
JugadorLogeado[playerid] == 0)
            {
                
SendClientMessage(playeridCOLOR_GREY"ЎNo estas logeado!");
                
Kick(playerid);
                return 
1;
            }
            
GetPlayerName(playeridsendernamesizeof(sendername));
            new 
length strlen(cmdtext);
            while ((
idx length) && (cmdtext[idx] <= ' '))
            {
                
idx++;
            }
            new 
offset idx;
            new 
result[64];
            while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
            {
                
result[idx offset] = cmdtext[idx];
                
idx++;
            }
            
result[idx offset] = EOS;
            if(!
strlen(result))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"Use: /do [acciуn]");
                return 
1;
            }
            if(
InfoJugador[playerid][jMascara] == 1)
            {
                
format(stringsizeof(string), "* %s (( Desconocido ))"result);
            }
            else
            {
                
format(stringsizeof(string), "* %s (( %s ))"resultsendername);
            }
            
ProxDetector(30.0playeridstringCOLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
            
printf("%s"string);
        }
        return 
1;
    }
    if(
strcmp(cmd"/intentar"true) == 0)
    {
        if(
NoIntentar[playerid] == MAXIMOS_INTENTAR) return SendClientMessage(playerid,0x7EBEFFFF,"Solo puedes usar el /intentar, una vez cada 10 segundos.");
        {
           if(
IsPlayerConnected(playerid))
           {
             if(
JugadorLogeado[playerid] == 0)
             {
                   
SendClientMessage(playeridCOLOR_GREY"ЎNo estas logeado!");
                   return 
1;
             }
             
GetPlayerName(playeridsendernamesizeof(sendername));
             new 
length strlen(cmdtext);
             while ((
idx length) && (cmdtext[idx] <= ' '))
             {
                
idx++;
             }
             new 
offset idx;
             new 
result[64];
             while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
             {
                
result[idx offset] = cmdtext[idx];
                
idx++;
             }
             
result[idx offset] = EOS;
             if(!
strlen(result))
             {
                
SendClientMessage(playeridCOLOR_GRAD2"Utiliza: /intentar [acciуn]");
                return 
1;
             }
                new 
rand random(2);
                if(
rand == 0)
                {
                     if(
InfoJugador[playerid][jMascara] == 0)
                     {
                        
format(stringsizeof(string), "* %s Intento %s y consiguio hacerlo"sendernameresult);
                        
ProxDetector(30.0,playeridstringCOLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
                    }
                    else
                    {
                        
format(stringsizeof(string), "* Desconocido Intento %s y consiguio hacerlo"result);
                        
ProxDetector(30.0,playeridstringCOLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
                    }
                }
                else if(
rand == 1)
                {
                    if(
InfoJugador[playerid][jMascara] == 0)
                    {
                        
format(stringsizeof(string), "* %s intento %s y no consiguio hacerlo"sendernameresult);
                        
ProxDetector(30.0,playeridstringCOLOR_ROJO,COLOR_ROJO,COLOR_ROJO,COLOR_ROJO,COLOR_ROJO);
                    }
                    else
                    {
                        
format(stringsizeof(string), "* Desconocido Intento %s y no consiguio hacerlo"result);
                        
ProxDetector(30.0,playeridstringCOLOR_ROJO,COLOR_ROJO,COLOR_ROJO,COLOR_ROJO,COLOR_ROJO);
                    }
                }
            }
       }
       if(
NoIntentar[playerid] < MAXIMOS_INTENTARNoIntentar[playerid]++;
       if(
NoIntentar[playerid] == MAXIMOS_INTENTAR)
       {
          
SetTimerEx("VolverUsarIntentar",6000,0,"d",playerid);
       }
       return 
1;
 }
     if(
strcmp(cmd"/b"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
JugadorLogeado[playerid] == 0)
            {
                
SendClientMessage(playeridCOLOR_GREY"ЎNo estas logeado!");
                return 
1;
            }
            
GetPlayerName(playeridsendernamesizeof(sendername));
            new 
length strlen(cmdtext);
            while ((
idx length) && (cmdtext[idx] <= ' '))
            {
                
idx++;
            }
            new 
offset idx;
            new 
result[64];
            while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
            {
                
result[idx offset] = cmdtext[idx];
                
idx++;
            }
            
result[idx offset] = EOS;
            if(!
strlen(result))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"Uso: /b [chat ooc]");
                return 
1;
            }
            if(
InfoJugador[playerid][jMascara] == 1)
            {
                
format(stringsizeof(string), "((Desconocido [OOC]:  %s))"result);
            }
            else
            {
                
format(stringsizeof(string), "(([%i] %s [OOC]: %s))"playeridsendernameresult);
            }
            
ProxDetector(20.0playeridstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
            
printf("%s"string);
        }
        return 
1;
    }
    return 
SendClientMessage(playerid, -1"Comando Incorrecto");

Reply
#2

Код:
#include    <zcmd>

CMD:me(playerid, params[])
{
   if(IsPlayerConnected(playerid)) 
        { 
             if(JugadorLogeado[playerid] == 0) 
            { 
                SendClientMessage(playerid, COLOR_GREY, "ЎNo estas logeado!"); 
                return 1; 
            } 
            GetPlayerName(playerid, sendername, sizeof(sendername)); 
            new length = strlen(cmdtext); 
            while ((idx < length) && (cmdtext[idx] <= ' ')) 
            { 
                idx++; 
            } 
            new offset = idx; 
            new result[64]; 
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) 
            { 
                result[idx - offset] = cmdtext[idx]; 
                idx++; 
            } 
            result[idx - offset] = EOS; 
            if(!strlen(result)) 
            { 
                SendClientMessage(playerid, COLOR_GRAD2, "Uso: /me [acciуn]"); 
                return 1; 
            } 
            if(InfoJugador[playerid][jMascara] == 1) 
            { 
               format(string, sizeof(string), "* Desconocido %s", result); 
            } 
            else 
            { 
               format(string, sizeof(string), "* %s %s", sendername, result); 
            } 
            ProxDetector(30.0, playerid, string, COLOR_PURPURA,COLOR_PURPURA,COLOR_PURPURA,COLOR_PURPURA,COLOR_PURPURA); 
 } 
        return 1;
Eso es todo lo que debes de hacer. No es tan difнcil. Solo quitale lo de arriba y ponle el comando correspondiente como te lo puse allн arriba.
Reply
#3

Me sale todo estos errores de que puede ser..
Quote:

F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(127) : error 004: function "GuardarCuentas" is not implemented
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(169) : error 004: function "GuardarInfo" is not implemented
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(177) : error 017: undefined symbol "NameJ"
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(184) : error 017: undefined symbol "NameJ"
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(197) : error 004: function "ColorJugadorDefault" is not implemented
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(221) : error 004: function "ProxDetector" is not implemented
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(225) : error 017: undefined symbol "NameJ"
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(226) : error 004: function "ProxDetector" is not implemented
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(246) : error 004: function "LogearJugador" is not implemented
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(265) : error 004: function "RegistrarJugador" is not implemented
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(266) : error 004: function "LogearJugador" is not implemented
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(29 : error 004: function "GuardarInfo" is not implemented
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(334) : error 017: undefined symbol "strtok"
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(334) : error 033: array must be indexed (variable "cmd")
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(343) : error 079: inconsistent return types (array & non-array)
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(362) : error 079: inconsistent return types (array & non-array)
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(372) : error 004: function "ProxDetector" is not implemented
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(374) : error 079: inconsistent return types (array & non-array)
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(376) : error 029: invalid expression, assumed zero
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(376) : error 017: undefined symbol "cmd_me"
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(376) : error 029: invalid expression, assumed zero
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(376) : fatal error 107: too many error messages on one line

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


22 Errors.

Reply
#4

Buenas e estado quitando algunos eerrores pero estos no se quitarlos
Quote:

F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(336) : error 029: invalid expression, assumed zero
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(336) : error 017: undefined symbol "cmd_"
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(336) : warning 215: expression has no effect
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(336) : error 029: invalid expression, assumed zero
F:\New Gothan Servidor\New Gothan RP\gamemodes\NGrp.pwn(336) : fatal error 107: too many error messages on one line

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


4 Errors.

Reply
#5

pawn Код:
CMD:me(playerid, params[])
{
    new sendername[MAX_PLAYER_NAME], new string[128];
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "ЎNo estбs conectado!");
    if(JugadorLogeado[playerid] == 0)
    {
        SendClientMessage(playerid, COLOR_GREY, "ЎNo estas logeado!");
        Kick(playerid);
        return 1;
    }
    if(sscanf(params,"s[128]",mensaje)) return SendClientMessage(playerid, COLOR_GRAD2, "USO: /me [accion]");
    GetPlayerName(playerid, sendername, sizeof(sendername));
    if(InfoJugador[playerid][jMascara] == 1)
    {
       format(string, sizeof(string), "* Desconocido %s", result);
    }
    else
    {
       format(string, sizeof(string), "* %s %s", sendername, result);
    }
    ProxDetector(30.0, playerid, string, COLOR_PURPURA,COLOR_PURPURA,COLOR_PURPURA,COLOR_PURPURA,COLOR_PURPURA);
    return 1;
}
CMD:do(playerid, params[])
{
    new sendername[MAX_PLAYER_NAME], new string[128];
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "ЎNo estбs conectado!");
    if(JugadorLogeado[playerid] == 0)
    {
        SendClientMessage(playerid, COLOR_GREY, "ЎNo estas logeado!");
        Kick(playerid);
        return 1;
    }
    if(sscanf(params,"s[128]",mensaje)) return SendClientMessage(playerid, COLOR_GRAD2, "USO: /do [accion]");
            GetPlayerName(playerid, sendername, sizeof(sendername));

    if(InfoJugador[playerid][jMascara] == 1)
    {
        format(string, sizeof(string), "* %s (( Desconocido ))", result);
    }
    else
    {
        format(string, sizeof(string), "* %s (( %s ))", result, sendername);
    }
    ProxDetector(30.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
    printf("%s", string);
    return 1;
}


CMD:intentar(playerid, params[])
{
    new sendername[MAX_PLAYER_NAME], new string[128];
    if(NoIntentar[playerid] == MAXIMOS_INTENTAR) return SendClientMessage(playerid,0x7EBEFFFF,"Solo puedes usar el /intentar, una vez cada 10 segundos.");
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "ЎNo estбs conectado!");
    if(JugadorLogeado[playerid] == 0)
    {
        SendClientMessage(playerid, COLOR_GREY, "ЎNo estas logeado!");
        Kick(playerid);
        return 1;
    }
    if(sscanf(params,"s[128]",mensaje)) return SendClientMessage(playerid, COLOR_GRAD2, "USO: /me [accion]");
   
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new rand = random(2);
    if(rand == 0)
    {
         if(InfoJugador[playerid][jMascara] == 0)
         {
            format(string, sizeof(string), "* %s Intento %s y consiguio hacerlo", sendername, result);
            ProxDetector(30.0,playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
        }
        else
        {
            format(string, sizeof(string), "* Desconocido Intento %s y consiguio hacerlo", result);
            ProxDetector(30.0,playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
        }
    }
    else if(rand == 1)
    {
        if(InfoJugador[playerid][jMascara] == 0)
        {
            format(string, sizeof(string), "* %s intento %s y no consiguio hacerlo", sendername, result);
            ProxDetector(30.0,playerid, string, COLOR_ROJO,COLOR_ROJO,COLOR_ROJO,COLOR_ROJO,COLOR_ROJO);
        }
        else
        {
            format(string, sizeof(string), "* Desconocido Intento %s y no consiguio hacerlo", result);
            ProxDetector(30.0,playerid, string, COLOR_ROJO,COLOR_ROJO,COLOR_ROJO,COLOR_ROJO,COLOR_ROJO);
        }
    }
   if(NoIntentar[playerid] < MAXIMOS_INTENTAR) NoIntentar[playerid]++;
   if(NoIntentar[playerid] == MAXIMOS_INTENTAR)
   {
      SetTimerEx("VolverUsarIntentar",6000,0,"d",playerid);
   }
   return 1;
 }
 

CMD:b(playerid, params[])
{
    new sendername[MAX_PLAYER_NAME], new string[128];
    if(NoIntentar[playerid] == MAXIMOS_INTENTAR) return SendClientMessage(playerid,0x7EBEFFFF,"Solo puedes usar el /intentar, una vez cada 10 segundos.");
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_GREY, "ЎNo estбs conectado!");
    if(JugadorLogeado[playerid] == 0)
    {
        SendClientMessage(playerid, COLOR_GREY, "ЎNo estas logeado!");
        Kick(playerid);
        return 1;
    }
    if(sscanf(params,"s[128]",mensaje)) return SendClientMessage(playerid, COLOR_GRAD2, "USO: /me [chat ooc]");
    GetPlayerName(playerid, sendername, sizeof(sendername));
    if(InfoJugador[playerid][jMascara] == 1)
    {
        format(string, sizeof(string), "((Desconocido [OOC]:  %s))", result);
    }
    else
    {
        format(string, sizeof(string), "(([%i] %s [OOC]: %s))", playerid, sendername, result);
    }
    ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
    printf("%s", string);
    return 1;
    }
Reply
#6

Quote:
Originally Posted by GOM3Z
Посмотреть сообщение
Buenas e estado quitando algunos eerrores pero estos no se quitarlos
Es porque no tienes el include ZCMD.

Include ZCMD <- Clickeame
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)