error en consola
#1

hola cuando abro el samp-server me sale muchas veces esto
Код:
sscanf warnung: Format specifier does not match parameter count.
El servidor funciona pero eso aparece como 20 veces їComo lo soluciono?
Reply
#2

Debe ser algъn cуdigo echo con sscanf que esta mal.
Reply
#3

Pasa que usas una cadena en sscanf pero no le das su longitud.

Mal:

pawn Код:
if(sscanf(params, "s", params[0]))
Bien:

pawn Код:
if(sscanf(params, "s[144]", params[0]))
Reply
#4

Hola enzo encontrй esto:
Код:
if(sscanf(params, "d", anim))
Lo debo cambiar por?
Код:
if(sscanf(params, "d[144]", anim))
Codigo completo:
Код:
    zcmd(sentarse, playerid, params[])
	{
	    new anim;
	    if(Info[playerid][pEstado] != 0 || IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "No puedes hacer esto ahora!");
        if(sscanf(params, "d", anim)) return SendClientMessageEx(playerid,COLOR_WHITE,"USA: /sentarse [1-5]");
        switch(anim){
			case 1: LoopingAnim(playerid,"BEACH","bather",4.0,1,0,0,0,0);
			case 2: LoopingAnim(playerid,"BEACH","Lay_Bac_Loop",4.0,1,0,0,0,0);
			case 3: LoopingAnim(playerid,"BEACH","ParkSit_W_loop",4.0,1,0,0,0,0);
			case 4: LoopingAnim(playerid,"BEACH","SitnWait_loop_W",4.0,1,0,0,0,0);
			case 5: LoopingAnim(playerid,"BEACH","SitnWait_loop_W",4.0,1,0,0,0,0);
			case 6: LoopingAnim(playerid,"BEACH", "ParkSit_M_loop", 4.0,1,0,0,0,0);
			default: return SendClientMessageEx(playerid,COLOR_WHITE,"USA: /sentarse [1-5]");
		}
		return 1;
	}
Reply
#5

No, ya que no utiliza un string.
Reply
#6

Quote:
Originally Posted by Alexander11
Посмотреть сообщение
No, ya que no utiliza un string.
Entonces porque me da error en la consola?
Reply
#7

Debe ser otro comando, ya que en el que dices, estas utilizando nъmeros enteros, no un string.
Reply
#8

Los demas comandos tiene este formato:
Код:
if(sscanf(params, "s[32]", choice))
Codigo completo:
Код:
CMD:vender(playerid, params[])
{
	new choice[32];
	if(sscanf(params, "s[32]", choice))
	{
	SendClientMessage(playerid, COLOR_WHITE, "USA: /vender [Nombre]");
	return 1;
	}
	else if(strcmp(choice, "crack", true) == 0)
	{
	new string[128], giveplayerid, needed, money;
	if(sscanf(params, "ddd", giveplayerid, needed, money)) return SendClientMessageEx(playerid, COLOR_WHITE, "USA: /vender crack [playerid] [gramos] [precio]");

	if(needed < 1 || needed > 99) { SendClientMessageEx(playerid, COLOR_GREY, "   Los valores no pueden ser mayores a 99 gramos."); return 1; }
	if(money < 1 || money > 99999) { SendClientMessageEx(playerid, COLOR_GREY, "   El precio no puede ser menor que 1 ni mayor que 99999!"); return 1; }
	if(needed > Info[playerid][pCrack]) { SendClientMessageEx(playerid, COLOR_GREY, "  No tienes suficiente droga para venderla!"); return 1; }
	if(IsPlayerConnected(giveplayerid))	{
		if(giveplayerid != INVALID_PLAYER_ID){
			if (ProxDetectorS(8.0, playerid, giveplayerid)){
				if(giveplayerid == playerid) return SendClientMessageEx(playerid, COLOR_GREY, "No puedes venderte a ti mismo!");
				format(string, sizeof(string), "* Ofreciste a %s para que te compre %d gramos de crack por $%d.", GetPlayerNameEx(giveplayerid), needed, money);
				SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
				format(string, sizeof(string), "* Vendedor de drogas %s quiere venderte %d gramos de crack por $%d. (escribe /aceptar crack)", GetPlayerNameEx(playerid), needed, money);
				SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
				CrackOffer[giveplayerid] = playerid;
				CrackPrice[giveplayerid] = money;
				CrackGram[giveplayerid] = needed;
			}
			else return SendClientMessageEx(playerid, COLOR_GREY, "Ese jugador no estб cerca tuyo.");
		}
	}
	else SendClientMessageEx(playerid, COLOR_GREY, "   Ese jugador estб desconectado.");
	return 1;
}
	else if(strcmp(choice, "medicamentos", true) == 0)
	{
	new string[128], giveplayerid, needed, money;
	if(sscanf(params, "ddd", giveplayerid, needed, money)) return SendClientMessageEx(playerid, COLOR_WHITE, "USA: /vender medicamentos [playerid] [cantidad] [precio]");

	if(needed < 1 || needed > 99) { SendClientMessageEx(playerid, COLOR_GREY, "   Gramos no pueden ser menor que 1, ni mayor que 99!"); return 1; }
	if(money < 1 || money > 99999) { SendClientMessageEx(playerid, COLOR_GREY, "   Precio: Mнnimo 1 - Mбximo: 99999!"); return 1; }
	if(needed > Info[playerid][pPot]) { SendClientMessageEx(playerid, COLOR_GREY, "	No tienes tanta Medicamentos para vender."); return 1; }
	if(IsPlayerConnected(giveplayerid))
	{
		if(giveplayerid != INVALID_PLAYER_ID)
		{
			if (ProxDetectorS(8.0, playerid, giveplayerid))
			{
				if(giveplayerid == playerid)
				{
					SendClientMessageEx(playerid, COLOR_GREY, "   No puedes venderte a ti mismo!");
					return 1;
				}
				format(string, sizeof(string), "* Ofreciste a %s comprar %d gramos de Medicamentos por $%d.", GetPlayerNameEx(giveplayerid), needed, money);
				SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
				format(string, sizeof(string), "* Vendedor %s quiere venderte %d gramos de Medicamentos por $%d. (Usa /aceptar Medicamentos)", GetPlayerNameEx(playerid), needed, money);
				SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
				PotOffer[giveplayerid] = playerid;
				PotPrice[giveplayerid] = money;
				PotGram[giveplayerid] = needed;
			}
			else return SendClientMessageEx(playerid, COLOR_GREY, "Ese jugador no estб cerca tuyo.");
		}
	}
	else SendClientMessageEx(playerid, COLOR_GREY, "   Ese jugador estб desconectado.");
	return 1;
}
else if(strcmp(choice, "coche", true) == 0)
	{
	new vstring[1024];

	for(new i; i < MAX_PLAYERVEHICLES; i++)
	{
		if(PlayerVehicleInfo[playerid][i][pvId] > INVALID_PLAYER_VEHICLE_ID)
			format(vstring, sizeof(vstring), "%s\n%s", vstring, VehicleName[PlayerVehicleInfo[playerid][i][pvModelId] - 400]);

		else if(PlayerVehicleInfo[playerid][i][pvImpounded] == 1)
			format(vstring, sizeof(vstring), "%s\n%s (Confiscado)", vstring, VehicleName[PlayerVehicleInfo[playerid][i][pvModelId] - 400]);

		else
			format(vstring, sizeof(vstring), "%s\nVacнo", vstring);
	}
	SafeDialogEx(playerid, SELLCAR, DIALOG_STYLE_LIST, "Vender Vehiculo", vstring, "Vender", "Cancelar");
	SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "Si vendes el vehнculo te pagarбn la mitad del precio actual del vehнculo.");
	return 1;
}
else if(strcmp(choice, "casa", true) == 0)
	{
	new string[128];
	new house = Info[playerid][pPhousekey];
	if(house == INVALID_HOUSE_ID)
	{
		SendClientMessageEx(playerid, COLOR_WHITE, "No eres dueсo de una casa.");
		return 1;
	}
	if(IsPlayerInRangeOfPoint(playerid, 4.0,HouseInfo[house][hExteriorX],HouseInfo[house][hExteriorY],HouseInfo[house][hExteriorZ]))
	{
		ClearHouse(house);
		HouseInfo[house][hLock] = 1;
		format( HouseInfo[house][hOwner], 128, "Nobody" );
		GivePlayerCash(playerid,HouseInfo[house][hValue]);
		HouseInfo[house][hGLUpgrade] = 1;
		PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
		format(string, sizeof(string), "~w~Felicitaciones~n~ Vendiste tu casa por ~n~~g~$%d", HouseInfo[house][hValue]);
		GameTextForPlayer(playerid, string, 4000, 3);
		Info[playerid][pPhousekey] = INVALID_HOUSE_ID;
		if(Info[playerid][pVW] == house+6000)
		{
			SetPlayerInterior(playerid,0);
			SetPlayerPos(playerid,HouseInfo[house][hExteriorX],HouseInfo[house][hExteriorY],HouseInfo[house][hExteriorZ]);
			Info[playerid][pInt] = 0;
			Info[playerid][pPhousekey] = INVALID_HOUSE_ID;
		}
		//Info[playerid][pInsurance] = 0;
		SaveHouses();
		OnPlayerUpdate(playerid);
		DestroyDynamicPickup(HouseInfo[house][hPickupID]);
		HouseInfo[house][hPickupID] = CreateDynamicPickup(1273, 23, HouseInfo[house][hExteriorX], HouseInfo[house][hExteriorY], HouseInfo[house][hExteriorZ]);
		DestroyDynamic3DTextLabel(HouseInfo[house][hTextID]);
		format(string, sizeof(string), "En venta!\nDescripciуn: %s\nPrecio: $%d\n Nivel: %d\n/comprarcasa para comprarla.",HouseInfo[house][hDescription],HouseInfo[house][hValue],HouseInfo[house][hLevel]);
		HouseInfo[house][hTextID] = CreateDynamic3DTextLabel( string, COLOR_GREEN2, HouseInfo[house][hExteriorX], HouseInfo[house][hExteriorY], HouseInfo[house][hExteriorZ]+0.5, 10.0);
		new ip[32];
		GetPlayerIp(playerid,ip,sizeof(ip));
		format(string,sizeof(string),"%s (IP: %s) has sold their house (ID %d) for $%d.",GetPlayerNameEx(playerid),ip,house,HouseInfo[house][hValue]);
		Log("logs/house.log", string);
		return 1;
	}
	else SendClientMessageEx(playerid, COLOR_WHITE, "Necesitas estar cerca su casa (exterior) para venderla.");
	return 1;
}
	return 1;
	}
Reply
#9

EL error puede ser porque tengo #include <sscanf2> osea tiene el 2?
Reply
#10

Quote:
Originally Posted by Jeree10
Посмотреть сообщение
EL error puede ser porque tengo #include <sscanf2> osea tiene el 2?
eso no tiene nada que ver, yo uso el ese include y uso ZCMD pero no me da ningun error en la consola! haslo has puesto mal
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)