[AYUDA]Comando -
Fluid016 - 21.04.2012
Hola forum samp, bueno mi pregunta es que hice mal en este comando
pawn Код:
if(!strcmp("/skin",cmdtext,true))
{
new iString[128], tmp[128];
tmp = strtok(cmdtext, idx);
if (!strlen(tmp))
{
SendClientMessage(playerid, COLOR_ROJO, "[USA]: /skin [ID]");
return true;
}
idx = strval(tmp);
if (SkinInvalido(idx) || idx < MIN_SKIN_ID || idx > MAX_SKIN_ID)
{
SendClientMessage(playerid, COLOR_ROJO, "[ERROR]:ID de skin no valido!");
return true;
}
SetPlayerSkin(playerid, idx);
JugadorSkin[playerid] = idx;
format(iString, 128, "[SKIN]: Ha cambiado a Skin (ID:%d)", idx);
SendClientMessage(playerid, COLOR_VERDE, iString);
return 1;
}
cuando pongo /skin sale [USA]: /skin [ID] y cuando pongo /skin 299(o cualquier otro skin) sale que el comando no existe... cual es el error??
espero que me puedan ayudar
Respuesta: [AYUDA]Comando -
OTACON - 21.04.2012
PHP код:
if(!strcmp("/skin",cmdtext,true))
{
new iString[128], tmp[128];
tmp = strtok(cmdtext, idx);
if (!strlen(tmp))
{
SendClientMessage(playerid, COLOR_ROJO, "[USA]: /skin [ID]");
return true;
}
tmp = strval(tmp);
if (SkinInvalido(tmp) || tmp < MIN_SKIN_ID || tmp > MAX_SKIN_ID)
{
SendClientMessage(playerid, COLOR_ROJO, "[ERROR]:ID de skin no valido!");
return true;
}
SetPlayerSkin(playerid, tmp);
JugadorSkin[playerid] = tmp;
format(iString, 128, "[SKIN]: Ha cambiado a Skin (ID:%d)", tmp);
SendClientMessage(playerid, COLOR_VERDE, iString);
return 1;
}
Respuesta: [AYUDA]Comando -
Fluid016 - 21.04.2012
Код:
(578) : error 033: array must be indexed (variable "tmp")
(580) : error 035: argument type mismatch (argument 1)
(585) : error 035: argument type mismatch (argument 2)
(586) : error 006: must be assigned to an array
pawn Код:
if(!strcmp("/skin",cmdtext,true))
{
new iString[128], tmp[128];
tmp = strtok(cmdtext, idx);
if (!strlen(tmp))
{
SendClientMessage(playerid, COLOR_ROJO, "[USA]: /skin [ID]");
return true;
}
error(578) tmp = strval(tmp);
error(580) if (SkinInvalido(tmp) || tmp < MIN_SKIN_ID || tmp > MAX_SKIN_ID)
{
SendClientMessage(playerid, COLOR_ROJO, "[ERROR]:ID de skin no valido!");
return true;
}
error(585) SetPlayerSkin(playerid, tmp);
error(586) JugadorSkin[playerid] = tmp;
format(iString, 128, "[SKIN]: Ha cambiado a Skin (ID:%d)", tmp);
SendClientMessage(playerid, COLOR_VERDE, iString);
return 1;
}
Respuesta: [AYUDA]Comando -
OTACON - 21.04.2012
PHP код:
if(strcmp(cmd, "/skin", true)==0)
{
new tmp[128], nombre[MAX_PLAYER_NAME], string[128];
tmp = strtok(cmdtext, idx);
new skin = strval(tmp);
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "Usa: /skin [ID]");
SetPlayerSkin(playerid, skin);
format(string, sizeof(string), "[SKIN]: Ha cambiado a Skin (ID:%d)", skin);
SendClientMessage(playerid, -1, string);
return 1;
}
Respuesta: [AYUDA]Comando -
Fluid016 - 21.04.2012
No me sirve ese comando yo quiero saber el error del mio porque tengo 2 comandos mas con el mismo error.
Re: [AYUDA]Comando -
Soi_salva - 21.04.2012
ya tienes definido idx?
Respuesta: [AYUDA]Comando -
Fluid016 - 21.04.2012
SI ¬¬
Respuesta: [AYUDA]Comando -
TiNcH010 - 21.04.2012
Como vas a usar = strval definiendo el mismo contenido del strval, es algo imposible.
pawn Код:
tmp = strtok(cmdtext, idx);
Respuesta: [AYUDA]Comando -
Fluid016 - 21.04.2012
Osea no te entendн nada xDDDDDDD si me lo puedes dar bien echo te agradecerнa demasiado..
Respuesta: [AYUDA]Comando -
ValenRatti - 21.04.2012
Me pareceria mas facil hacerlo con dialog:
En los defines:
OnPlayerCommandText
pawn Код:
if(strcmp(cmd,"/Ropa",true) == 0)
{
ShowPlayerDialog(playerid,DIALOG_SKIN,DIALOG_STYLE_INPUT,"SKIN","Pon el id del skin que quieras","Acceptar","Cancelar");
return 1;
}
OnDialogResponse
pawn Код:
if(dialogid == DIALOG_SKIN)
{
for (new i = 0;i < MAX_PLAYERS; i++)
{
if(!response)
{
return 1;
}
if(response == 1)
{
if(IsNumeric(inputtext))
{
if(inputtext[0] > 0 && inputtext[0] < 255)
{
SetPlayerSkin(playerid, strval(inputtext));
}
}
}
}
return 1;
}