|
|
#1 |
|
Little Clucker
![]() Join Date: Oct 2007
Posts: 16
Reputation: 0
|
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!Code:
new car, Madec[MAX_VEHICLES]; Code:
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;
}
|
|
|
|
|
#2 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Apr 2007
Location: Norway
Posts: 3,561
Reputation: 129
|
Why are people still using strtok, and wtf is with 256 cell size? You don't need more than 128.
The second pawn Code:
What the problem is, I can't say. I did my best to look for any "errors", but couldn't find anything, sorry. |
|
|
|
|
#3 | |
|
Little Clucker
![]() Join Date: Oct 2007
Posts: 16
Reputation: 0
|
Quote:
So what I should use instead of strtok? :P. |
|
|
|
|
|
#4 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Apr 2007
Location: Norway
Posts: 3,561
Reputation: 129
|
imo try learning dcmd (or zcmd).
It's so simple, and much faster + more convinient |
|
|
|
|
#5 |
|
Little Clucker
![]() Join Date: Oct 2007
Posts: 16
Reputation: 0
|
I was using dcmd in different script. This is test one and it's enough fast. Anybody knows why te text isn't chaning while using Update3DText?
|
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Search not working properly | WARBI | General | 14 | 19/07/2010 02:04 PM |
| Random isn't working properly :S | Maxips2 | Help Archive | 10 | 12/07/2010 11:31 AM |
| [HELP]Realchat not working properly | Lilcuete | Help Archive | 11 | 19/06/2010 02:37 PM |
| /Admins not working properly | `Robo | Help Archive | 0 | 27/01/2010 06:11 PM |