Hy everyone,i made a command for my car ownership system ,/plate to be on 3dtext.But the problem came when i type /plate [newplate] ,te new plate appear upcar,but the previous 3dTEXT doesn`t remove,it stays there,what should i do that the previous 3dtext delete cand stay only the new one from /plate ? SORRY FOR MY BAD ENGLISH
Код:
if(strcmp(cmd, "/plate", true) == 0)
{
if(IsPlayerInVehicle(playerid, vehid) || PlayerInfo[vehid][pPcarkey] != -1 && PlayerInfo[vehid][pPcarkey2] != -1 && PlayerInfo[vehid][pPcarkey3] != -1)
{
if(cmdtext[idx++] != 32 || cmdtext[idx] == EOS)
{
SendClientMessage(playerid,0xFFFFFFAA,"Use: /plate [newplate]");
return 1;
}
new Text3D: Vehplate;
new Float:XX,Float:YY,Float:ZZ,Float:AA;
new Float:CarHP, Float:OldCarHP;
new panels,doors,lights,tires;
GetVehicleHealth(vehid, CarHP);
GetVehicleDamageStatus(vehid,panels,doors,lights,tires);
OldCarHP = CarHP;
format(CarInfo[vehid][cLicense], 32 ,"%s",cmdtext[idx]);
Delete3DTextLabel(Text3D:Vehplate);
Vehplate = Create3DTextLabel(CarInfo[vehid][cLicense], 0x33AAFFFF, 0.0, 0.0, 0.0, 20, 0, 1);
Attach3DTextLabelToVehicle(Vehplate, vehid, 0.0, 0.0, 1.2);
Update3DTextLabelText(Vehplate, 0x00FF00FF, CarInfo[vehid][cLicense]);
GetVehiclePos(vehid,XX,YY,ZZ);
GetVehicleZAngle(vehid, AA);
SetVehicleToRespawn(vehid);
SetVehiclePos(vehid,XX,YY,ZZ);
SetVehicleZAngle(vehid, AA);
PutPlayerInVehicle(playerid,vehid,0);
SetVehicleHealth(vehid, OldCarHP);
UpdateVehicleDamageStatus(vehid,panels,doors,lights,tires);
format(string, sizeof(string), "{DFF709}Vehicle Plate set to: {FFFFFF}%s", CarInfo[vehid][cLicense]);
SendClientMessage(playerid, COLOR_WHITE, string);
OnPropUpdate(); SavePlayerData(playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "{DFF709}* You must be in your PersonalVehicle to change the plate.");
return 1;
}
}