Problema con comandos basicos :S -
alexpramer - 04.03.2012
Hola, estoy en un GM de 0 y he puesto el comando /b y no funciona. Explico, pongo /b y sale por ej: [OOC] [ID:0] Nombre Dice: /b
Osea que en el texto sale /b, y si pongo /b ola me dice que el comando no existe :S
Respuesta: Problema con comandos basicos :S -
ValenRatti - 04.03.2012
Fijate si te ayuda, te doy el mio.
pawn Код:
if(strcmp(cmd, "/b", true) == 0)//local ooc
{
if(IsPlayerConnected(playerid))
{
if(!IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_GREY, " Necesiats logearte antes de usar esto!");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
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, "[INFO]: /b [chat OOC]");
return 1;
}
if(PlayerInfo[playerid][pMascara] == 1) // probablemente en tu sv la mascara va a ser differente, fijate si es pMask o como sea.
{
format(string, sizeof(string), "(( [FJ] Extraсo dice: %s ))", result);
}
else
{
format(string, sizeof(string), "(( [FJ] %s dice: %s ))", NombreEx(playerid), result);
}
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
printf("%s", string);
}
return 1;
}
Respuesta: Problema con comandos basicos :S -
alexpramer - 04.03.2012
Es asi como yo lo tengo... :S
Respuesta: Problema con comandos basicos :S -
Jovanny - 04.03.2012
pawn Код:
if(strcmp(cmd, "/b", true,2) == 0)//local ooc
{
if(IsPlayerConnected(playerid))
{
if(!IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_GREY, " Necesiats logearte antes de usar esto!");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
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, "[INFO]: /b [chat OOC]");
return 1;
}
if(PlayerInfo[playerid][pMascara] == 1) // probablemente en tu sv la mascara va a ser differente, fijate si es pMask o como sea.
{
format(string, sizeof(string), "(( [FJ] Extraсo dice: %s ))", result);
}
else
{
format(string, sizeof(string), "(( [FJ] %s dice: %s ))", NombreEx(playerid), result);
}
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
printf("%s", string);
}
return 1;
}
Este tiene algo diferente que casi ni se nota y por lo tanto si funcionara
Respuesta: Problema con comandos basicos :S -
El Bardo - 04.03.2012
O puedes usar ZCMD y sscanf
pawn Код:
CMD:b(playerid,params[])
{
new string[128];
if(sscanf(params,"s",string)) SendClientMessage(playerid, COLOR_YELLOW, "[USO]: /b [texto]");
else
{
if(PlayerInfo[playerid][pMaskuse] == 1)
{
format(string, sizeof(string), "(( Enmascarado Dice: %s ))", string);
}
else
{
format(string, sizeof(string), "(( [%i] %s Dice: %s ))", playerid, GetPlayerNameEx(playerid), string);
}
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
}
return 1;
}
pawn Код:
stock GetPlayerNameEx(playerid)
{
new string[24];
GetPlayerName(playerid,string,24);
new str[24];
strmid(str,string,0,strlen(string),24);
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if (str[i] == '_') str[i] = ' ';
}
return str;
}
Recuerda cambiar por tus funciones
Respuesta: Problema con comandos basicos :S -
alexpramer - 05.03.2012
Gracias ovanny me sirvio! Me puedes decir que le cambiaste? Y El Bardo prefiero usar STRCMP, pero gracias igualmente