17.01.2015, 16:38
I have created a 3d textdraw system that saves and loads textdraws to my database. I make textdraws with a command. My issue here is when i create a textdraw it does not skip a line with \n or change the text color with {00FF00}. Also when I create a textdraw with the command It only creates a textdraw that is 31 long and I have it set to 256.
Please help
here is my enum 3dTextdraw:
here is my load textdraw
And Here is my Create Textdraw Command:
Everything else is working correctly, I just need the few errors fixed.
Thanks
Please help
here is my enum 3dTextdraw:
Код:
enum labelInfo { //Temp Values Text3D:lid, //Perm Values lText[256], Float:lX, Float:lY, Float:lZ, lVirtualWorld, } new LabelInfo[MAX_LABEL][labelInfo];
Код:
stock LoadLabels() { new idx=1; new query[500]; mysql_format(MySQLCon, query, sizeof(query), "SELECT * FROM `labels`"); mysql_query(MySQLCon, query); new rows, fields, temp[256]; cache_get_data(rows, fields); while(idx <= rows) { cache_get_row(idx-1, 1, temp), format(LabelInfo[idx][lText],256,temp); cache_get_row(idx-1, 2, temp), LabelInfo[idx][lX] = floatstr(temp); cache_get_row(idx-1, 3, temp), LabelInfo[idx][lY] = floatstr(temp); cache_get_row(idx-1, 4, temp), LabelInfo[idx][lZ] = floatstr(temp); cache_get_row(idx-1, 5, temp), LabelInfo[idx][lVirtualWorld] = strval(temp); LabelInfo[idx][lid] = Create3DTextLabel(LabelInfo[idx][lText], COLOR_WHITE, LabelInfo[idx][lX], LabelInfo[idx][lY], LabelInfo[idx][lZ], 50.0, LabelInfo[idx][lVirtualWorld], 1); new stringbanana[56]; format(stringbanana, sizeof(stringbanana), "Labels loaded: %d", idx); print(stringbanana); idx++; } return 1; }
Код:
CMD:createlabel(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command."); new text[256]; new string[256]; if(sscanf(params,"s", text)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /CreateLabel Text"); for(new idx=1; idx<MAX_LABEL; idx++) { if(!LabelInfo[idx][lText]) { new virtworld = GetPlayerVirtualWorld(playerid); new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z); format(LabelInfo[idx][lText], 256, text); LabelInfo[idx][lX] = X; LabelInfo[idx][lY] = Y; LabelInfo[idx][lZ] = Z; LabelInfo[idx][lVirtualWorld] = virtworld; LabelInfo[idx][lid] = Create3DTextLabel(LabelInfo[idx][lText], COLOR_WHITE, LabelInfo[idx][lX], LabelInfo[idx][lY], LabelInfo[idx][lZ], 50.0, LabelInfo[idx][lVirtualWorld], 1); new string2[32]; format(string2, sizeof(string2), "You have created Label with id: %d.", idx); SendClientMessage(playerid, COLOR_BLUE, string2); format(string, sizeof(string), "label ID\n%d", idx); SendAdminMessage(COLOR_DARKRED, 1, string); new query[300]; mysql_format(MySQLCon, query, sizeof(query), "INSERT INTO `labels` (`ID`, `Text`, `X`, `Y`, `Z`, `virtualworld`) VALUES ('%d', '%s', '%f', '%f', '%f', '%d')", idx, LabelInfo[idx][lText], LabelInfo[idx][lX], LabelInfo[idx][lY], LabelInfo[idx][lZ], LabelInfo[idx][lVirtualWorld]); mysql_query(MySQLCon, query); idx = MAX_LABEL; Log("logs/labels.log", string); } } return 1; }
Thanks