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


Messages In This Thread
update to r-41 MySQL - by Ryan50 - 14.02.2017, 01:34
Re: Mysql r-41 - by Rdx - 14.02.2017, 11:48
Re: Mysql r-41 - by Ryan50 - 14.02.2017, 11:49
Re: Mysql r-41 - by Rdx - 14.02.2017, 11:50
Re: Mysql r-41 - by Ryan50 - 14.02.2017, 11:52
Re: Mysql r-41 - by Rdx - 14.02.2017, 11:58
Re: Mysql r-41 - by Ryan50 - 14.02.2017, 12:00
Re: Mysql r-41 - by Rdx - 14.02.2017, 12:01
Re: Mysql r-41 - by Ryan50 - 14.02.2017, 12:04
Re: Mysql r-41 - by Rdx - 14.02.2017, 12:11

Forum Jump:


Users browsing this thread: 3 Guest(s)