Command problem
#1

I have the following command for car plates
Код:
if (strcmp(cmd, "/vehicleplate", true) ==0 )
	{
	        new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[256];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_WHITE, "TBA");
				return true;
			}
		    if(!IsPlayerInAnyVehicle(playerid))
					   return SendClientMessage(playerid, COLOR_WHITE, "TBA");
		new vehicleid = GetPlayerVehicleID(playerid);
		Delete3DTextLabel(Plate[vehicleid]);
		Plate[vehicleid] = Create3DTextLabel(result,0x009999FF,0.0,0.0,0.0,40.0,1);
		Attach3DTextLabelToVehicle(Text3D:Plate[vehicleid], vehicleid, 0.0, 0.0, 0.0);
		SetVehicleToRespawn(vehicleid);
		return 1;
	}
The problem is that Delete3DTextLabe(Plate[vehicleid]); doesn't delete the right 3DTextLabel.For example I add a 3Dtext to one car,then I want to add another one to other car,but when I execute the command it deletes the 3DTextLabel from the first car.And If I don't put Delete3DTextLabel(Plate[vehicleid]) it puts more 3DTextLabels on one car.I don't know what's the problem,because it should delete the 3DText from the current car(Plate[vehicleid]) and new vehicleid = GetPlayerVehicleID(playerid);
I also tryed with update3DTextLabelText but it does the same...puts more labels on one car instead of updating the text or deletes the wrong 3dtextlabel.

I know 0.3c includes this but I'm making it for someone and I don't know what's the problem in here...weird..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)