Wrong data is loading.. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Wrong data is loading.. (
/showthread.php?tid=603185)
Wrong data is loading.. -
danielpalade - 19.03.2016
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
Re: Wrong data is loading.. -
zPain - 19.03.2016
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.
Re: Wrong data is loading.. -
YouServ - 19.03.2016
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");