Рекомендованные сообщения



Не найдено.

8 posts in this topic

Всем привет! Опять встретился с ошибкой sscanf в консоле(

Помогите исправить пожалуйста :$

Консоль:

Спойлер

----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3e, (C)2005-2012 SA-MP Team

[20:50:04] weburl = "www.sa-mp.com"  (string)
[20:50:04] password = ""  (string)
[20:50:04] 
[20:50:04] Server Plugins
[20:50:04] --------------
[20:50:04]  Loading plugin: streamer
[20:50:04] 

*** Streamer Plugin v2.6.1 by Incognito loaded ***

[20:50:04]   Loaded.
[20:50:04]  Loading plugin: sscanf
[20:50:04] 

[20:50:04]  ===============================

[20:50:04]       sscanf plugin loaded.     

[20:50:04]    (c) 2009 Alex "Y_Less" Cole

[20:50:04]    0.3d-R2 500 Players "dnee"

[20:50:04]  ===============================

[20:50:04]   Loaded.
[20:50:04]  Loading plugin: mysql
[20:50:04] 

  > MySQL plugin R5 successfully loaded.

[20:50:04]   Loaded.
[20:50:04]  Loaded 3 plugins.

[20:50:04] 
[20:50:04] Filterscripts
[20:50:04] ---------------
[20:50:04]   Loaded 0 filterscripts.

[20:50:04] password = ""  (string)
[20:50:04] MySQL: Подключение к базе данных установлено.
[20:50:04] ARPLOAD: Успешная загрузка 'LoadHouses' - загружено 0 за 2 м.с
[20:50:04] ARPLOAD: Успешная загрузка 'LoadBizz' - загружено 0 за 2 м.с
[20:50:04] ARPLOAD: Успешная загрузка 'LoadVehicle' - загружено 22 за 38 м.с
[20:50:04] ARPLOAD: Успешная загрузка 'LoadEnters' - загружено 54 пикапов за 39 м.с
[20:50:04] ARPLOAD: Успешная загрузка 'LoadATM' - загружено 0 банкоматов за 2 м.с
[20:50:04] ARPLOAD: Успешная загрузка 'LoadPodezd' - загружено 0 подьездов за 3 м.с
[20:50:04] ARPLOAD: Успешная загрузка 'LoadRooms' - загружено 0 квартир за 2 м.с
[20:50:04] ARPLOAD: Успешная загрузка 'LoadMayor' за 3 м.с
[20:50:04] ARPLOAD: Успешная загрузка 'LoadOther' за 3 м.с
[20:50:04] sscanf warning: String buffer overflow.
[20:50:04] sscanf warning: String buffer overflow.
[20:50:04] sscanf warning: String buffer overflow.
[20:50:04] sscanf warning: String buffer overflow.
[20:50:04] sscanf warning: String buffer overflow.
[20:50:04] sscanf warning: String buffer overflow.
[20:50:04] sscanf warning: String buffer overflow.
[20:50:04] sscanf warning: String buffer overflow.
[20:50:04] sscanf warning: String buffer overflow.
[20:50:04] sscanf warning: String buffer overflow.
[20:50:04] sscanf warning: String buffer overflow.
[20:50:04] sscanf warning: String buffer overflow.
[20:50:04] sscanf warning: String buffer overflow.
[20:50:04] sscanf warning: String buffer overflow.
[20:50:04] sscanf warning: String buffer overflow.
[20:50:04] sscanf warning: String buffer overflow.
[20:50:04] sscanf warning: String buffer overflow.
[20:50:04] sscanf warning: String buffer overflow.
[20:50:04] sscanf warning: String buffer overflow.
[20:50:04] sscanf warning: String buffer overflow.
[20:50:04] ARPLOAD: Успешная загрузка 'LoadFrac' - загружено 20 за 24 м.с
[20:50:04] ARPLOAD: Успешная загрузка 'LoadPromo' - загружено 0 за 2 м.с
[20:50:04] ==============================================
[20:50:04] Author - Jack_Yermolov Server - Old RolePlay©
[20:50:04]  Подключение к базе `rrp2` успешно
[20:50:04] ==============================================
[20:50:04] Number of vehicle models: 40

 

 

Возможная строка:

 

stock LoadOther()
{
	new time = GetTickCount();
	format(query,sizeof(query), "SELECT * FROM `"TABLE_OTHER"`");
	mysql_query(query);
	mysql_store_result();
	if(mysql_fetch_row(query) == 1)
	{
		mysql_fetch_row(query);
		sscanf(query, "p<|>iiiiiiiiiiiiis[40]iiiiiiiiiiiiiiiiiiiiiiiiiii",
		FracBank[0],
		FracBank[1],
		FracBank[3],
		FracBank[4],
		FracBank[5],
		FracBank[6],
		FracBank[7],
		FracBank[8],
		FracBank[9],
		sklads,
		ugol,
		drev,
		ed,
		NewsPrice,
		Mats[1],//Police
		Mats[2],//DPC
		Mats[0],///Army
		Mats[4],//FSB
		Mats[5],//GOP
		Mats[6],//LB
		Mats[8],//BB
		Mats[9],//UGBRATVA
		Mineral[0],//mineral
		Metal,
		Mineral[1],
//		FracBank[11],
		Mats[16],
		Mats[12],
		Mats[18],
		MafiaMineral[0],
		MafiaMineral[1],
		MafiaMineral[2],
		DrugsBank[F_GOPOTA],
		DrugsBank[F_LYTBRATVA],
		DrugsBank[F_BATBRATVA],
		DrugsBank[F_UGBRATVA],
		DrugsBank[F_YAKUZA],
		DrugsBank[F_LCN],
		DrugsBank[F_RM],
		FuelBank,
		Plavnya,
		TOTALPRIZ);
		sscanf(NewsPrice, "p<,>iiiiii",SmsPrice[0], SmsPrice[1], CallPrice[0], CallPrice[1], AdvertPrice[0], AdvertPrice[1]);
	}
	mysql_free_result();
	printf("ARPLOAD: Успешная загрузка 'LoadOther' за %d м.с",GetTickCount() - time);
	return true;
}

 

0

Share this post


Link to post
Share on other sites

@Zishka, а так:

Спойлер

 


stock LoadOther()
{
	new time = GetTickCount();
	format(query,sizeof(query), "SELECT * FROM `"TABLE_OTHER"`");
	mysql_query(query);
	mysql_store_result();
	if(mysql_fetch_row(query) == 1)
	{
		mysql_fetch_row(query);
		sscanf(query, "p<|>iiiiiiiiiiiiis[40]iiiiiiiiiiiiiiiiiiiiiiiiiiii",
		FracBank[0],
		FracBank[1],
		FracBank[3],
		FracBank[4],
		FracBank[5],
		FracBank[6],
		FracBank[7],
		FracBank[8],
		FracBank[9],
		sklads,
		ugol,
		drev,
		ed,
		NewsPrice,
		Mats[1],//Police
		Mats[2],//DPC
		Mats[0],///Army
		Mats[4],//FSB
		Mats[5],//GOP
		Mats[6],//LB
		Mats[8],//BB
		Mats[9],//UGBRATVA
		Mineral[0],//mineral
		Metal,
		Mineral[1],
//		FracBank[11],
		Mats[16],
		Mats[12],
		Mats[18],
		MafiaMineral[0],
		MafiaMineral[1],
		MafiaMineral[2],
		DrugsBank[F_GOPOTA],
		DrugsBank[F_LYTBRATVA],
		DrugsBank[F_BATBRATVA],
		DrugsBank[F_UGBRATVA],
		DrugsBank[F_YAKUZA],
		DrugsBank[F_LCN],
		DrugsBank[F_RM],
		FuelBank,
		Plavnya,
		TOTALPRIZ);
		sscanf(NewsPrice, "p<,>iiiiii",SmsPrice[0], SmsPrice[1], CallPrice[0], CallPrice[1], AdvertPrice[0], AdvertPrice[1]);
	}
	mysql_free_result();
	printf("ARPLOAD: Успешная загрузка 'LoadOther' за %d м.с",GetTickCount() - time);
	return true;
}

 

1

Share this post


Link to post
Share on other sites

Тоже-самое

19 часов назад, odosenok сказал:

@Zishka, а так:

  код (закрыть спойлер)

 



stock LoadOther()
{
	new time = GetTickCount();
	format(query,sizeof(query), "SELECT * FROM `"TABLE_OTHER"`");
	mysql_query(query);
	mysql_store_result();
	if(mysql_fetch_row(query) == 1)
	{
		mysql_fetch_row(query);
		sscanf(query, "p<|>iiiiiiiiiiiiis[40]iiiiiiiiiiiiiiiiiiiiiiiiiiii",
		FracBank[0],
		FracBank[1],
		FracBank[3],
		FracBank[4],
		FracBank[5],
		FracBank[6],
		FracBank[7],
		FracBank[8],
		FracBank[9],
		sklads,
		ugol,
		drev,
		ed,
		NewsPrice,
		Mats[1],//Police
		Mats[2],//DPC
		Mats[0],///Army
		Mats[4],//FSB
		Mats[5],//GOP
		Mats[6],//LB
		Mats[8],//BB
		Mats[9],//UGBRATVA
		Mineral[0],//mineral
		Metal,
		Mineral[1],
//		FracBank[11],
		Mats[16],
		Mats[12],
		Mats[18],
		MafiaMineral[0],
		MafiaMineral[1],
		MafiaMineral[2],
		DrugsBank[F_GOPOTA],
		DrugsBank[F_LYTBRATVA],
		DrugsBank[F_BATBRATVA],
		DrugsBank[F_UGBRATVA],
		DrugsBank[F_YAKUZA],
		DrugsBank[F_LCN],
		DrugsBank[F_RM],
		FuelBank,
		Plavnya,
		TOTALPRIZ);
		sscanf(NewsPrice, "p<,>iiiiii",SmsPrice[0], SmsPrice[1], CallPrice[0], CallPrice[1], AdvertPrice[0], AdvertPrice[1]);
	}
	mysql_free_result();
	printf("ARPLOAD: Успешная загрузка 'LoadOther' за %d м.с",GetTickCount() - time);
	return true;
}

 

 

0

Share this post


Link to post
Share on other sites

Так? 

Спойлер

stock LoadOther()
{
	new time = GetTickCount();
	format(query,sizeof(query), "SELECT * FROM `"TABLE_OTHER"`");
	mysql_query(query);
	mysql_store_result();
	if(mysql_fetch_row(query) == 1)
	{
		mysql_fetch_row(query);
		sscanf(query, "p<|>iiiiiiiiiiiiis[128]iiiiiiiiiiiiiiiiiiiiiiiiiii", //41
		FracBank[0],
		FracBank[1],
		FracBank[3],
		FracBank[4],
		FracBank[5],
		FracBank[6],
		FracBank[7],
		FracBank[8],
		FracBank[9],
		sklads,
		ugol,
		drev,
		ed,
		NewsPrice,
		Mats[1],//Police
		Mats[2],//DPC
		Mats[0],///Army
		Mats[4],//FSB
		Mats[5],//GOP
		Mats[6],//LB
		Mats[8],//BB
		Mats[9],//UGBRATVA
		Mineral[0],//mineral
		Metal,
		Mineral[1],
//		FracBank[11],
		Mats[16],
		Mats[12],
		Mats[18],
		MafiaMineral[0],
		MafiaMineral[1],
		MafiaMineral[2],
		DrugsBank[F_GOPOTA],
		DrugsBank[F_LYTBRATVA],
		DrugsBank[F_BATBRATVA],
		DrugsBank[F_UGBRATVA],
		DrugsBank[F_YAKUZA],
		DrugsBank[F_LCN],
		DrugsBank[F_RM],
		FuelBank,
		Plavnya,
		TOTALPRIZ);
		sscanf(NewsPrice, "p<,>iiiiii",SmsPrice[0], SmsPrice[1], CallPrice[0], CallPrice[1], AdvertPrice[0], AdvertPrice[1]);
	}
	mysql_free_result();
	printf("ARPLOAD: Успешная загрузка 'LoadOther' за %d м.с",GetTickCount() - time);
	return true;
}

 

 

Edited by SCRIPTMAN

0

Share this post


Link to post
Share on other sites

@Zishka Конечно совет - это избавляться от такого рода кода. Лучше сделайте key-value таблицу и будет намного удобней

key value
FracBank0 ...
FracBank1 ...
Metal ...
... ...
0

Share this post


Link to post
Share on other sites
1 час назад, SCRIPTMAN сказал:

Так? 

  Код (открыть спойлер)


stock LoadOther()
{
	new time = GetTickCount();
	format(query,sizeof(query), "SELECT * FROM `"TABLE_OTHER"`");
	mysql_query(query);
	mysql_store_result();
	if(mysql_fetch_row(query) == 1)
	{
		mysql_fetch_row(query);
		sscanf(query, "p<|>iiiiiiiiiiiiis[128]iiiiiiiiiiiiiiiiiiiiiiiiiii", //41
		FracBank[0],
		FracBank[1],
		FracBank[3],
		FracBank[4],
		FracBank[5],
		FracBank[6],
		FracBank[7],
		FracBank[8],
		FracBank[9],
		sklads,
		ugol,
		drev,
		ed,
		NewsPrice,
		Mats[1],//Police
		Mats[2],//DPC
		Mats[0],///Army
		Mats[4],//FSB
		Mats[5],//GOP
		Mats[6],//LB
		Mats[8],//BB
		Mats[9],//UGBRATVA
		Mineral[0],//mineral
		Metal,
		Mineral[1],
//		FracBank[11],
		Mats[16],
		Mats[12],
		Mats[18],
		MafiaMineral[0],
		MafiaMineral[1],
		MafiaMineral[2],
		DrugsBank[F_GOPOTA],
		DrugsBank[F_LYTBRATVA],
		DrugsBank[F_BATBRATVA],
		DrugsBank[F_UGBRATVA],
		DrugsBank[F_YAKUZA],
		DrugsBank[F_LCN],
		DrugsBank[F_RM],
		FuelBank,
		Plavnya,
		TOTALPRIZ);
		sscanf(NewsPrice, "p<,>iiiiii",SmsPrice[0], SmsPrice[1], CallPrice[0], CallPrice[1], AdvertPrice[0], AdvertPrice[1]);
	}
	mysql_free_result();
	printf("ARPLOAD: Успешная загрузка 'LoadOther' за %d м.с",GetTickCount() - time);
	return true;
}

 

 

Так-же :(

0

Share this post


Link to post
Share on other sites

А как вообщем sscanf пользоваться? Что за символы

"p<|>iiiiiiiiiiiiis[128]iiiiiiiiiiiiiiiiiiiiiiiiiii"
0

Share this post


Link to post
Share on other sites

@Zishka, порядок типов аргументов. i - целочисленное значение, s[длина] - строковое (массив). p<> - тип разделителя, и в угловых скобках сам разделитель (|).

1

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • Андрей Гречка
      By Андрей Гречка
      Не мой сервер, но обратились, я не нашёл ошибку, но суть в том что любой игрок заходит на сервер и выадёт фулл доступ, админку 9 лвл (мод аризоны). Логов нету, прошу помочь! 
      Мод на Яндексе.https://yadi.sk/d/oXr8hBMqHuOQAA