Textdraw - SetString
#1

Hey, again me and textdraws...

So, basically I have this function:

Код:
stock ShowPlayerTextDrawGroup(playerid, txd_group[], type=0){
	new query[128];
	mysql_format(mdb, query, sizeof(query), "SELECT * FROM `textdraws` WHERE tgroup='%s'", txd_group);
	mysql_tquery(mdb, query, "OnPlayerTextDrawGroup", "dsd", playerid, txd_group, type);
	return 1;
}

forward OnPlayerTextDrawGroup(playerid, txd_group[], type);
public OnPlayerTextDrawGroup(playerid, txd_group[], type){
	new rows; cache_get_row_count(rows);
	if(rows != 0){
	    for(new i=0;i<rows;i++){
	        if(Txds[i]) PlayerTextDrawDestroy(playerid, Txds[i]);
            
			new
			    name[25],
			    Float:X, Float:Y,
			    text[30],
				Float:LSX, Float:LSY,
				Float:TSX, Float:TSY,
				align,
				color,
				usebox, boxcolor,
				setshadow,
				outline, backgroundcolor,
				font,
				proportional,
				selectable;

			cache_get_value_float(      i,      "posX",         		X);
			cache_get_value_float(      i,      "posY",         		Y);
			cache_get_value_float(      i,      "LetterSizeX",         	LSX);
			cache_get_value_float(      i,      "LetterSizeY",         	LSY);
			cache_get_value_float(      i,      "TextSizeX",         	TSX);
			cache_get_value_float(      i,      "TextSizeY",         	TSY);

			cache_get_value(    i,      "text",     text, sizeof(text));
			cache_get_value(    i,      "name",     name, sizeof(name));

			cache_get_value_int(    i,      "alignment",        		align);
			cache_get_value_int(    i,      "color",        			color);
			cache_get_value_int(    i,      "usebox",        			usebox);
			cache_get_value_int(    i,      "boxcolor",        			boxcolor);
			cache_get_value_int(    i,      "setshadow",        		setshadow);
			cache_get_value_int(    i,      "outline",        			outline);
			cache_get_value_int(    i,      "backgroundcolor",        	backgroundcolor);
			cache_get_value_int(    i,      "font",        				font);
			cache_get_value_int(    i,      "proportional",        		proportional);
			cache_get_value_int(    i,      "selectable",        		selectable);

	  		Txds[i] = CreatePlayerTextDraw(playerid, X, Y, text);

			PlayerTextDrawLetterSize(playerid, Txds[i], LSX, LSY);
			PlayerTextDrawTextSize(playerid, Txds[i], TSX, TSY);
			PlayerTextDrawAlignment(playerid, Txds[i], align);
			PlayerTextDrawColor(playerid, Txds[i], color);
			PlayerTextDrawUseBox(playerid, Txds[i], usebox);
			PlayerTextDrawBoxColor(playerid, Txds[i], boxcolor);
			PlayerTextDrawSetShadow(playerid, Txds[i], setshadow);
			PlayerTextDrawSetOutline(playerid, Txds[i], outline);
			PlayerTextDrawBackgroundColor(playerid, Txds[i], backgroundcolor);
			PlayerTextDrawFont(playerid, Txds[i], font);
			PlayerTextDrawSetProportional(playerid, Txds[i], proportional);
			PlayerTextDrawSetSelectable(playerid, Txds[i], selectable);

			if(type == CHARCHOOSE){
		        //when changing a few txds (in choosing character)
		        
		        new ustr[56];
		        if(!strcmp(name, "CHAR-V-NAME", false)) { GetPVarString(playerid, "ch_username", ustr, sizeof(ustr)); PlayerTextDrawSetString(playerid, Txds[i], ustr); }
		    }
		    else if(type == CHARCHOOSE_NONE){
		        //when character doesn't exist
		        if(!strcmp(name, "CHAR-SPAWN", false)) { PlayerTextDrawSetString(playerid, Txds[i], "CREATE CHARACTER"); }
		    }

            if(!strcmp(name, "CHAR-SPAWN", false)) { ChooseTxds[0] = i; }
            else if(!strcmp(name, "CHAR-AR-L", false)) { ChooseTxds[1] = i; }
            else if(!strcmp(name, "CHAR-AR-R", false)) { ChooseTxds[2] = i; }
            
			PlayerTextDrawShow(playerid, Txds[i]);
			
	    }
	}else printf("TEXTDRAW GROUP %s DOESN'T EXIST !", txd_group);
	return 1;
}
Everything works fine, all textdraws, which are supposed to, show, but when I change text for textdraw "CHAR-SPAWN", it won't delete after another use of this function, ... and it should. For that, I have this "if" here...

Код:
if(Txds[i]) PlayerTextDrawDestroy(playerid, Txds[i]);
I do the same with textdraw "CHAR-V-NAME" and it works. I have no problem in database, everything is the same. The only thing which could be problem is, that the "CHAR-SPAWN" textdraw is with index "0"... I don't know about anything else...


Thanks.
Reply
#2

Anyone? Still doesn't work,...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)