// Enums enum PlayerData { pID, pName[512], pPassword[512], pAdminLevel, pMoney, pSkin, Float:pHealth, Float:pArmour }; new Player[MAX_PLAYERS][PlayerData]; // Loading from database stock LoadDatabase(playerid) { new query[512], health[64], armour[64]; format(query, sizeof(query), "SELECT * FROM `samp_users` WHERE `pName` = '%s' LIMIT 1", GetName(playerid)); mysql_query(query); mysql_store_result(); if(mysql_fetch_row(query)) { mysql_fetch_field("pID", Player[playerid][pID]); mysql_fetch_field("pName", Player[playerid][pName]); mysql_fetch_field("pPassword", Player[playerid][pPassword]); mysql_fetch_field("pAdminLevel", Player[playerid][pAdminLevel]); mysql_fetch_field("pMoney", Player[playerid][pMoney]); mysql_fetch_field("pSkin", Player[playerid][pSkin]); mysql_fetch_field("pHealth", health); Player[playerid][pHealth] = floatstr(health); mysql_fetch_field("pArmour", armour); Player[playerid][pArmour] = floatstr(armour); } mysql_free_result(); return 1; } // Displaying the data stock DebugSQL(playerid) { new string[512]; format(string, sizeof(string), "[DEBUG] ID: %i, Name: %s, Admin: %s, Money: %s, Skin: %s, Health: %f, Armour: %f", Player[playerid][pID], Player[playerid][pName], Player[playerid][pAdminLevel], Player[playerid][pMoney], Player[playerid][pSkin], Player[playerid][pHealth], Player[playerid][pArmour]); SendClientMessage(playerid, COLOR_WHITE, string); return 1; }
[Mon Jun 01 10:46:10 2015] ------------------------- [Mon Jun 01 10:46:10 2015] Logging Started [Mon Jun 01 10:46:10 2015] ------------------------- [Mon Jun 01 10:46:10 2015] Function: mysql_init executed with result: "0". [Mon Jun 01 10:46:11 2015] Connected (0) to root @ 127.0.0.1 via TCP/IP. [Mon Jun 01 10:46:11 2015] MySQL Server Version 5.6.24. [Mon Jun 01 10:46:37 2015] Function: mysql_query executed: "SELECT * FROM `samp_users` WHERE `pName` = 'Michael_Puglisi' LIMIT 1" with result: "0". [Mon Jun 01 10:46:37 2015] Function: mysql_store_result executed with result: "1" [Mon Jun 01 10:46:37 2015] Function: mysql_fetch_row executed with result: "12|Michael_Puglisi|344907E89B981CAF221D05F597EB57A6AF408F15F4DD7895BBD1B96A2938EC24A7DCF23ACB94ECE0B6D7B0640358BC56BDB448194B9305311AFF038A834A079F|0|50056|29|3332.153564 -481.794494 3332.153564|99|10|". [Mon Jun 01 10:46:37 2015] Function: mysql_fetch_field executed. [Mon Jun 01 10:46:37 2015] Function: mysql_fetch_field executed. [Mon Jun 01 10:46:37 2015] Function: mysql_fetch_field executed. [Mon Jun 01 10:46:37 2015] Function: mysql_fetch_field executed. [Mon Jun 01 10:46:37 2015] Function: mysql_fetch_field executed. [Mon Jun 01 10:46:37 2015] Function: mysql_fetch_field executed. [Mon Jun 01 10:46:37 2015] Function: mysql_fetch_field executed. [Mon Jun 01 10:46:37 2015] Function: mysql_fetch_field executed. [Mon Jun 01 10:46:37 2015] Function: mysql_free_result executed. [Mon Jun 01 10:46:37 2015] Function: mysql_free_result executed.
Player[playerid][pID] = cache_get_field_content_int(0, "id"); cache_get_field_content(0, "password", Player[playerid][pPassword], g_SQL, 129); //============================= //for integer and float new var = cache_get_field_content_int(rowindex, "fieldname"); new Float;var = cache_get_field_content_float(rowindex, "fieldname"); //for strings cache_get_field_content(rowindex, fieldname, variable,sqlhande,lenght);
I didn't look at the whole screenshot you provided, but from what I see at the pPlayerPos part you save the float as a string am I right? how are you supposed to load it?
Save each coordinate alone! and get them separately. (Use floatstr when loading to save in variables) I hope I helped any feedback is appreciated! |
format(string, sizeof(string), "[DEBUG] ID: %i, Name: %s, Admin: %s, Money: %s, Skin: %s, Health: %f, Armour: %f",
new string[512]; format(string, sizeof(string), "[DEBUG] ID: %i, Name: %s, Admin: %i, Money: %i, Skin: %i, Health: %f, Armour: %f", Player[playerid][pID], Player[playerid][pName], Player[playerid][pAdminLevel], Player[playerid][pMoney], Player[playerid][pSkin], Player[playerid][pHealth], Player[playerid][pArmour]); SendClientMessage(playerid, COLOR_WHITE, string);
new string[512] - why is this 512 I'm postive the maximum number of characters you can have in anyone string that can be displayed is 128
|