Command problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Command problem (
/showthread.php?tid=199685)
Command problem -
Yvax - 16.12.2010
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..