Wrong data is loading..
#1

Whenever I'm doing /checkms I get this out put "46 - 56". This command is to check which vehicle model you have on your vehicle slot 1 and 2.
This is the command.

Код:
CMD:checkms(playerid, params[])
{
	new string[256];
	format(string, sizeof(string), "%d - %d", playerVariables[playerid][pCarModel1], playerVariables[playerid][pCarModel2]);
	SCM(playerid, -1, string);
	return 1;
}
Now, as you know these vehicle model id's do not exist.
This is my OnAccountLoad data.

Код:
		cache_get_field_content_int(0, "playerCarModel", playerVariables[extraid][pCarModel1]);
		cache_get_field_content_int(0, "playerCarModel2", playerVariables[extraid][pCarModel2]);
		cache_get_field_content_int(0, "playerCarModel3", playerVariables[extraid][pCarModel3]);
		cache_get_field_content_int(0, "playerCarModel4", playerVariables[extraid][pCarModel4]);
As you can see, everything should be loading correctly, but it ain't.
In my database, "playerCarModel" and "playerCarModel2" are set to 0 which means that the player does not have a vehicle on that slot. However it still sets the "pCarModel1" and "pCarModel2" variable to something different than it is in the database.

Also, this is my database.
http://imgur.com/LLsPNLi
Reply
#2

You must assign the value returned by cache_get_field_content_int to the variables.

PHP код:
playerVariables[extraid][pCarModel] = cache_get_field_content_int(0"playerCarModel"connectionHandle);
playerVariables[extraid][pCarModel2] = cache_get_field_content_int(0"playerCarModel2"connectionHandle);
playerVariables[extraid][pCarModel3] = cache_get_field_content_int(0"playerCarModel3"connectionHandle);
playerVariables[extraid][pCarModel4] = cache_get_field_content_int(0"playerCarModel4"connectionHandle); 
Replace connectionHandle with the variable you use to connect to the database.
Reply
#3

This :

PHP код:
playerVariables[extraid][pCarModel] = cache_get_field_content_int(0"playerCarModel");
playerVariables[extraid][pCarModel2] = cache_get_field_content_int(0"playerCarModel2");
playerVariables[extraid][pCarModel3] = cache_get_field_content_int(0"playerCarModel3");
playerVariables[extraid][pCarModel4] = cache_get_field_content_int(0"playerCarModel4"); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)