21.12.2013, 02:23
Disculpe por postear tantas veces cosas sobre codigos que contengan sscanf pero esque aъn no consigo saber usarlo correctamente...
Bueno lo que pasa esque yo puse un sistema de clanes que vi en una gm, el cmd es /clan y tiene opciones de invitar, stats, entrar etc... algo asн... /clan [crear/entrar/salir/stats] etc... bueno el problema esta al usar el /clan crear... lo estuve pasando a sscanf... y al momento de usar /clan crear xLoLx(es un ejemplo para nombre de clan) y el clan queda guardado como crear xLolx y no entiendo porque esta el crear ahн, si eso es para crear el clan... se adhiere al nombre del clan... esta es la parte del codigo, solo es el crear:
intente cambiando el params[1] por params[0] y pasa eso, pero si lo dejo en params[1] tampoco funciona, muchas gracias
Bueno lo que pasa esque yo puse un sistema de clanes que vi en una gm, el cmd es /clan y tiene opciones de invitar, stats, entrar etc... algo asн... /clan [crear/entrar/salir/stats] etc... bueno el problema esta al usar el /clan crear... lo estuve pasando a sscanf... y al momento de usar /clan crear xLoLx(es un ejemplo para nombre de clan) y el clan queda guardado como crear xLolx y no entiendo porque esta el crear ahн, si eso es para crear el clan... se adhiere al nombre del clan... esta es la parte del codigo, solo es el crear:
pawn Код:
if(strcmp(tmp, "crear", true) == 0)
{
if(sscanf(params, "s", params[1])) return SCM(playerid, -1, ""RO"* Uso: /Crew crear [nombre]");
//if(!strlen(tmp2)) return SendClientMessage(playerid, -1, ""RO"* Uso: /Crew crear [nombre]");
if(PlayerGang[playerid] == 1)return SendClientMessage(playerid, -1, ""RO"* Ya tienes Crew, usa /Crew salir para irte de la Crew");
if(GetPlayerScore(playerid)<=2000) return SendClientMessage(playerid, -1, ""RO"* Necesitas 2000 de score para crear una Crew");
if(IsValidName(params[0]))
{
if(strlen(params[1]) > 2 || strlen(params[1]) < 16)
{
if(GANG_NUMBER >= MAX_GANG)
{
new string[128];
new file[30];
for(new i = 0; i <= GANG_NUMBER; i++)
{
format(file, sizeof(file), GANG_FILE, i);
if(dini_Exists(file) && dini_Int(file,"GANG_MEMBERS") <= 1)
{
dini_Remove(file);
format(string, sizeof(string), ""CE"* ID: %d, Miembros: %d, Nombre: %s", i, GangInfo[i][GANG_MEMBERS], GangInfo[i][GANG_NAME]);
SendClientMessage(playerid, -1, string);
format(string, sizeof(string), ""CE"* La Crew %s estб vacнa!", GangInfo[i][GANG_NAME]);
SendClientMessageToAll(-1, string);
for(new p; p < MAX_PLAYERS; p++)
{
if(PlayerGang[p] == i && IsPlayerConnected(p))
{
dUserSetINT(nombre(playerid)).("clan",0);
PlayerGang[p] = 0;
}
}
}
}
}
}
else
{
SendClientMessage(playerid, -1, ""RO"* El nombre de la Crew debe ser entre 3 y 15 carбcteres");
}
return 1;
}
new gangid = 0;
for(new i; i < GANG_NUMBER; i++)
{
new file[100];
format(file, sizeof(file), GANG_FILE, i);
if(dini_Exists(file))
{
new gname[15];
strcat(gname, dini_Get(file, "GANG_NAME"),15);
if(strfind(params[0], gname, true) == 0)return SendClientMessage(playerid, -1, ""RO"* Ya hay una Crew llamada asн");
}
else if(!dini_Exists(file) && i != 0) gangid = i;
}
if(gangid == 0)
{
GANG_NUMBER++;
gangid = GANG_NUMBER;
}
dini_IntSet(CFG,"GANG_NUMBER",GANG_NUMBER);
new gfile[100];
format(gfile, sizeof(gfile), GANG_FILE, gangid);
dini_Create(gfile);
format(GangInfo[gangid][GANG_NAME], sizeof(tmp2), "%s", params[1]);
dini_Set(gfile, "GANG_NAME", GangInfo[gangid][GANG_NAME]);
dini_IntSet(gfile, "GANG_ID", gangid);
dini_IntSet(gfile,"GANG_MEMBERS",0);
GangInfo[gangid][GANG_ID] = gangid;
GangInfo[gangid][GANG_MEMBERS] = 0;
GangInfo[gangid][GANG_COLOR] = RandomColors[gangid];
new string[128];
format(string, sizeof(string), ""CE"* Has creado una Crew! Nombre: %s, ID: %d", GangInfo[gangid][GANG_NAME], GangInfo[gangid][GANG_ID]);
SendClientMessage(playerid, -1, string);
JoinGang(playerid, gangid);
return 1;
}