Speedcameras is not loading (R40)
#1

It's not loading anything from the LoadCams.

Код:
    mysql_tquery(mysql, "SELECT * FROM `cams` ORDER BY CamID ASC", "LoadCams");
Код:
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;
   	printf("LoadCams was called");
    cache_get_row_count(rows);
	{
		new i, DID;
		while(i < rows)
		{
            DID = cache_get_value_name_int(i, "Cam_ID", gCameras[DID][Cam_ID]);
			cache_get_value_name_float(i, "CamX", gCameras[DID][CamX]);
			cache_get_value_name_float(i, "CamY", gCameras[DID][CamY]);
			cache_get_value_name_float(i, "CamZ", gCameras[DID][CamZ]);
			cache_get_value_name_float(i, "CamAngle", gCameras[DID][CamAngle]);
			cache_get_value_name_int(i, "CamSpeed", gCameras[DID][CamSpeed]);

			CreateSpeedCamera(i, gCameras[DID][CamX], gCameras[DID][CamY], gCameras[DID][CamZ], gCameras[DID][CamAngle], gCameras[DID][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;
}
Reply


Messages In This Thread
Speedcameras is not loading (R40) - by Ryan50 - 25.02.2017, 17:36
Re: Speedcameras is not loading (R40) - by Ryan50 - 25.02.2017, 22:15
Re: Speedcameras is not loading (R40) - by PowerPC603 - 26.02.2017, 09:00
Re: Speedcameras is not loading (R40) - by Runn3R - 26.02.2017, 10:12
Re: Speedcameras is not loading (R40) - by Ryan50 - 26.02.2017, 15:30
Re: Speedcameras is not loading (R40) - by PowerPC603 - 26.02.2017, 19:58
Re: Speedcameras is not loading (R40) - by Ryan50 - 26.02.2017, 20:33
Re: Speedcameras is not loading (R40) - by Runn3R - 26.02.2017, 22:26
Re: Speedcameras is not loading (R40) - by Ryan50 - 26.02.2017, 22:28
Re: Speedcameras is not loading (R40) - by Ryan50 - 27.02.2017, 14:37

Forum Jump:


Users browsing this thread: 1 Guest(s)