Mysql r-41
#1

Код:
(2222) : warning 202: number of arguments does not match definition
(2225) : warning 219: local variable "ID" shadows a variable at a preceding level
(2228) : error 022: must be lvalue (non-constant)
(2228) : error 017: undefined symbol "cache_get_field_content_int"
(2228) : warning 215: expression has no effect
(2234) : error 017: undefined symbol "cache_get_field_content_int"
(2225) : warning 203: symbol is never used: "ID"
(2278) : error 017: undefined symbol "CamID"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.


Код:
enum SpeedTraps
{
	Cam_ID,
	Float:CamX,
	Float:CamY,
	Float:CamZ,
	Float:CamAngle,
	CamSpeed,
	CamObj1,
	CamObj2
}
new gCameras[MAX_CAMERAS][SpeedTraps];

CreateSpeedCamera(CamID, Float:x, Float:y, Float:z, Float:rot, MaxSpeed)
{
	gCameras[CamID][Cam_ID] = CamID+1;
	gCameras[CamID][CamX] = x;
	gCameras[CamID][CamY] = y;
	gCameras[CamID][CamZ] = z;
	gCameras[CamID][CamAngle] = rot;
	gCameras[CamID][CamSpeed] = MaxSpeed;
	gCameras[CamID][CamObj1] = CreateDynamicObject(18880, x, y, z, 0.0, 0.0, rot);
	//gCameras[CamID][CamObj2] = CreateDynamicObject(18880, x, y, z, 0.0, 0.0, rot + 180.0);
}

//Speed cam
forward LoadCams();
public LoadCams()
{
	new rows = cache_get_row_count();
	if(rows)
	{
		new i,ID;
		while(i < rows)
		{
			ID = cache_get_field_content_int(i, "CamID")-1;
			cache_get_value_name_float(i, "CamX", gCameras[ID][CamX]);
			cache_get_value_name_float(i, "CamY", gCameras[ID][CamY]);
			cache_get_value_name_float(i, "CamZ", gCameras[ID][CamZ]);
			cache_get_value_name_float(i, "CamX", gCameras[ID][CamX]);
			cache_get_value_name_float(i, "CamAngle", gCameras[ID][CamAngle]);
            cache_get_field_content_int(i, "CamSpeed", gCameras[ID][CamSpeed]);
			CreateSpeedCamera(ID, gCameras[ID][CamX], gCameras[ID][CamY], gCameras[ID][CamZ], gCameras[ID][CamAngle], gCameras[ID][CamSpeed]);
			i++;
		}
		printf("Loaded %d cams",rows);
	}
    return 1;
}

CMD:addcam(playerid, params[])
{
	new MaxSpeed;
	if(sscanf(params, "i", MaxSpeed)) return SendClientMessage(playerid, -1, "Usage: /addcam [Max Speed]");

	new Float:x, Float:y, Float:z, Float:Angle, string[128];
	GetPlayerPos(playerid, x, y, z);
	GetPlayerFacingAngle(playerid, Angle);
	SetPlayerPos(playerid, x, y + 1.0, z + 1.0);
	for(new i=0; i < MAX_CAMERAS; i++)
	{
		if(!gCameras[i][Cam_ID])
		{
			CreateSpeedCamera(i, x, y, z-1.0, Angle, MaxSpeed);
			format(string, sizeof(string),"INSERT INTO `Cams` VALUES (%d, %.4f, %.4f, %.4f, %.4f, %d);",i+1, x, y, z, Angle, MaxSpeed);
			mysql_tquery(mysql, string);
			format(string, sizeof(string), "You created a speed camera with ID: %i.", i+1);
			SendClientMessage(playerid, -1, string);
			return 1;
		}
	}
	format(string, sizeof(string), "You cannot create more than %i speedcameras.", MAX_CAMERAS);
	SendClientMessage(playerid, -1, string);
	return 1;
}

CMD:delcam(playerid, params[])
{
	new string[70];
	for(new i; i < MAX_CAMERAS; i++)
		if(gCameras[i][Cam_ID] > 0)
			if(IsPlayerInRangeOfPoint(playerid, 5.0, gCameras[i][CamX], gCameras[i][CamY], gCameras[i][CamZ]))
			{
				format(string, sizeof(string), "DELETE FROM `Cams` WHERE `CamID`= %d", i+1);
				mysql_tquery(connectionHandle, string);
				if(gCameras[CamID][CamObj1] > 0)
					DestroyDynamicObject(gCameras[i][CamObj1]);

				if(gCameras[i][CamObj2] > 0)
					DestroyDynamicObject(gCameras[i][CamObj2]);

				gCameras[i][Cam_ID] = 0;
				format(string, sizeof(string), "You deleted id camera %i", i+1);
				SendClientMessage(playerid, -1, string);
				break;
			}

	if(!string[0])
		SendClientMessage(playerid, -1, "You're not near by an speed trap!");

	return 1;
}
Reply
#2

In MySQL R40 function cache_get_field_content was renamed.

Quote:

renamed cache_get_field_content to cache_get_value_name (_int and _float likewise)

Source: https://github.com/pBlueG/SA-MP-MySQL/releases
Reply
#3

Quote:
Originally Posted by Rdx
Посмотреть сообщение
In MySQL R40 function cache_get_field_content was renamed.


Source: https://github.com/pBlueG/SA-MP-MySQL/releases
Still get errors.
Reply
#4

So show them.
Reply
#5

Quote:
Originally Posted by Rdx
Посмотреть сообщение
So show them.
Код:
(2230) : warning 202: number of arguments does not match definition
(2236) : warning 202: number of arguments does not match definition
(2236) : warning 215: expression has no effect
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.

Код:
forward LoadCams();
public LoadCams()
{
	new rows = cache_get_row_count();
	if(rows)
	{
		new i;
		while(i < rows)
		{
	        cache_get_value_name_int(i, "CamID")-1;
			cache_get_value_name_float(i, "CamX", gCameras[ID][CamX]);
			cache_get_value_name_float(i, "CamY", gCameras[ID][CamY]);
			cache_get_value_name_float(i, "CamZ", gCameras[ID][CamZ]);
			cache_get_value_name_float(i, "CamX", gCameras[ID][CamX]);
			cache_get_value_name_float(i, "CamAngle", gCameras[ID][CamAngle]);
			
			
			cache_get_value_name_int(0, "CamSpeed", gCameras[ID][CamSpeed]);
			
			CreateSpeedCamera(ID, gCameras[ID][CamX], gCameras[ID][CamY], gCameras[ID][CamZ], gCameras[ID][CamAngle], gCameras[ID][CamSpeed]);
			i++;
		}
		printf("Loaded %d cams",rows);
	}
    return 1;
}
Reply
#6

(2230)
(2236)
(2236)

Show these lines.

And i think problem is there:
Quote:

cache_get_row_count();

This function needs argument.

Example from MySQL wiki:

Quote:

new row_count;
if(!cache_get_row_count(row_count))
printf("couldn't retrieve row count");
else
printf("There are %d rows in the current result set.", row_count);

Reply
#7

Quote:
Originally Posted by Rdx
Посмотреть сообщение
(2230)
(2236)
(2236)

Show these lines.
Line 2230:
Код:
new rows = cache_get_row_count();
Line 2236 :
Код:
cache_get_value_name_int(i, "CamID")-1;
<-- still the same error line as this
Код:
(2236) : warning 215: expression has no effect
Reply
#8

Quote:

cache_get_value_name_int(i, "CamID")-1;

You can't use -1 here. And these line is wrong, you didnt placed destination array.

Example:

cache_get_value_name_int(i, "CamID", int_dest);

And about 2230, i've explained in previous post.
Reply
#9

Quote:
Originally Posted by Rdx
Посмотреть сообщение
You can't use -1 here. And these line is wrong, you didnt placed destination array.

And about 2230, i've explained in previous post.
fixed with
Код:
cache_get_value_name_int(i, "CamID", gCameras[ID][Cam_ID]);
i only got one error


Код:
(2230) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Код:
new rows = cache_get_row_count();
Reply
#10

Replace it to:

Quote:

new rows;
cache_get_row_count(rows);

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)