02.02.2012, 15:24
I have made a cmd wich edits different stuff from a team/faction, but it's the first time i use optional params in sscanf, and the cmd doesnt work well, here is the code:
It just doesnt work, if someone know how to make a cmd with optional params with sscanf, please tell me.
pawn Code:
cmd(editarfaccion,playerid,params[])
{
new opcs[30],id,opcd,opc[30];
new string[80];
if (GetPVarInt(playerid,"Logueado"))
{
if (InfoJugador[playerid][jAdmin] >= 11)
{
if (!sscanf(params,"ds[30]S(-1)[30]D(-1)",id,opc,opcs,opcd))
{
if(id < 0 || id > TOTAL_FACCIONES) return Mensaje(playerid,color_gris,"Nъmero de facciуn invalida!");
if (!strcmp(opc,"nombre",true))
{
if (!strlen(opcs))
{
format(string,sizeof(string),"Info: {ffffff}Usa /editarfaccion %d nombre [nuevo nombre]",id);
Mensaje(playerid,color_amarillo,string);
return 1;
}
if(strlen(opcs) > 30 || strlen(opcs) < 3) return Mensaje(playerid,color_gris,"El nombre de la facciуn no debe tener mбs de 30 caracteres o menos de 3.");
InfoFaccion[id][faccNombre] = opcs;
GuardarFaccion(id);
}
else
{
format(string,sizeof(string),"Info: {ffffff}Usa /editarfaccion %d [opciуn]",id);
Mensaje(playerid,color_amarillo,string);
return 1;
}
}
else
{
Mensaje(playerid,color_amarillo,"Info: {ffffff}Usa /editarfaccion [id] [opciуn]");
Mensaje(playerid,color_amarillo,"||____________Opciones____________||");
Mensaje(playerid,color_blanco," Nombre");
}
}
else Mensaje(playerid,color_rojo,NOADM);
}
else Mensaje(playerid,color_gris,NOLOG);
return 1;
}