25.08.2010, 09:42
Hi,
I have created command which adds description (as 3DTextLabel) to car. It's working nice, but if I want to edit the text (Update3DTextLabel) there is no reaction.
Here is my code, look at it and if you know what's the problem write in this topic please
. Thanks!
I have created command which adds description (as 3DTextLabel) to car. It's working nice, but if I want to edit the text (Update3DTextLabel) there is no reaction.
Here is my code, look at it and if you know what's the problem write in this topic please
. Thanks!Код:
new car, Madec[MAX_VEHICLES];
Код:
if(strcmp(cmd, "/cardescription", true) == 0)
{
new string[256], tmp[256], Text3D:vehicle3Dtext[MAX_VEHICLES];
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "Ceresto: /cardescription [CarID] [Text]");
return 1;
}
car = strval(tmp);
if (IsPlayerAdmin(playerid))
{
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, "Ceresto: /cardescription [CarID] [Text]");
return 1;
}
if(Madec[car] == 0)
{
format(string, sizeof(string), "Ceresto: Car (ID: %d) description set!.", car);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "Ceresto: Result: (%s).", result);
SendClientMessage(playerid, COLOR_YELLOW, string);
vehicle3Dtext[car] = Create3DTextLabel(result, COLOR_LIGHTBLUE, 0.0, 0.0, 0.0, 50.0, 0, 1 );
Attach3DTextLabelToVehicle(vehicle3Dtext[car], car, 0.0, 0.0, 0.0);
Madec[car] = 1;
return 1;
}
else if(Madec[car] == 1)
{
format(string, sizeof(string), "Ceresto: Car (ID: %d) description changed.", car);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), ""Ceresto: Result: (%s).", result);
SendClientMessage(playerid, COLOR_YELLOW, string);
Update3DTextLabelText(vehicle3Dtext[car], COLOR_LIGHTBLUE, result);
Madec[car] = 1;
return 1;
}
return 1;
}
}
return 1;
}


