Jobs ID's aren't loading successfully.
#1

I'm working on a dynamic job system. Everything works fine and loads fine, but somehow my /gotojob command fails me. Let's say I do /gotojob 1, which should teleport me to the job with the id 1. It doesn't. It teleports me to the job with the id 2 instead. I don't know why or what I did wrong.
But there is the command and the load function for the jobs from the database.

Код:
CMD:gotojob(playerid, params[])
{
	if(pInfo[playerid][pAdminLevel] > 0)
	{
		new aName[MAX_PLAYER_NAME], id;
		GetPlayerName(playerid, aName, sizeof(aName));
		if(sscanf(params, "d", id)) return SendClientMessage(playerid, COLOR_GREY, "Usage: {FFFFFF}/gotojob [jobid]");
		new string[256], string2[256];
		format(string2, sizeof(string2), "Admin %s has teleported to the job %d.", aName, id);
		AdminChat(string2, COLOR_CHATADMIN);
		format(string, sizeof(string), "You have teleported to the job ID: %d.", id);
		SendClientMessage(playerid, COLOR_GREY, string);
		SetPlayerPos(playerid, jInfo[id][jPosX], jInfo[id][jPosY], jInfo[id][jPosZ]);
	}
	else return SendClientMessage(playerid, COLOR_GREY, NotAdmin);
	return 1;
}
Код:
public OnJobsLoad(jobid)
{
	new string5[256], string3[256];
	for(new i = 0; i < cache_num_rows(); i++)
	{
		jInfo[i][jID] = cache_get_field_content_int(i, "jobID");
		cache_get_field_content(i,"jobName",jInfo[i][jName],mysql,256);
		jInfo[i][jPickup] = cache_get_field_content_int(i, "jobPickup");
		jInfo[i][jPosX] = cache_get_field_content_float(i, "jobPosX");
		jInfo[i][jPosY] = cache_get_field_content_float(i, "jobPosY");
		jInfo[i][jPosZ] = cache_get_field_content_float(i, "jobPosZ");
		jInfo[i][jType] = cache_get_field_content_int(i, "jobType");
		jCount++;
		CreatePickup(jInfo[i][jPickup], 1, jInfo[i][jPosX],jInfo[i][jPosY],jInfo[i][jPosZ], 0);
		format(string3, sizeof(string3), "{0095E6}Job ID: {FFFFFF}%d\n{0095E6}Job Name: {FFFFFF}%s\n{0095E6}Use /getjob", jInfo[i][jID], jInfo[i][jName]);
		Create3DTextLabel(string3, 0x008080FF, jInfo[i][jPosX],jInfo[i][jPosY],jInfo[i][jPosZ], 8.0, 0, 0);
	}
	format(string5, sizeof(string5), " %d jobs loaded from database.", jCount);
	print(string5);
	return 1;
}
Код:
	mysql_format(mysql, query2, sizeof(query2), "SELECT * FROM `jobs`");
	mysql_tquery(mysql, query2, "OnJobsLoad");
How can I fix this and what can I do better?
Reply


Messages In This Thread
Jobs ID's aren't loading successfully. - by danielpalade - 06.02.2016, 19:08
Re: Jobs ID's aren't loading successfully. - by Lucky13 - 06.02.2016, 19:15
Re: Jobs ID's aren't loading successfully. - by danielpalade - 06.02.2016, 19:17
Re: Jobs ID's aren't loading successfully. - by Lucky13 - 06.02.2016, 19:19
Re: Jobs ID's aren't loading successfully. - by danielpalade - 06.02.2016, 19:22
Re: Jobs ID's aren't loading successfully. - by Lucky13 - 06.02.2016, 19:26

Forum Jump:


Users browsing this thread: 2 Guest(s)