Update3DTextLabel help
#1

I would like to create a text label that is changing two words every four seconds. For example you have "1", and after few seconds "2". I know that there is something to do with timers, but I don't know how to make it. Also, it should create label with /command

If anyone can give me some ideas how it will be nice..
Reply
#2

Any solutions ?
Reply
#3

Do you want ideas or are you asking for someone to make it for you?

Well, I'm assuming you know how to make a command. Lets just say you're using ZCMD for beginners' sake.
PHP код:
CMD:command(playeridparams[]) 
Congratulations, you've now created a command.

Now you can use Create3DTextLabel to create a label.

Then you can set a timer using SetTimerEx or SetTimer, coolies. You could either make a global loop in the timer, or a label ID specific update timer. (Update all labels at once > Run a loop in the timer) (Update a single label at once > Pass the label ID through SetTimerEx)

Now within that timer, you can just use Update3DTextLabel to update the label. Wow, that's so easy!

--

Good luck!
Reply
#4

This is what I want to make...
I want to make command (/something) that will create 3d text label on your "police vehicle" and it should be changed every 4 seconds like Police Emergency | after 4 seconds | Keep back
Reply
#5

here a small example goes

pawn Код:
new Text3D:MyLabel;
new Text3DTimer;

public OnGameModeInit() {

    MyLabel = Create3DTextLabel("1", color, x, y, z, DrawDistance, VirtualWorld, testLOS);
    Text3DTimer = SetTimer("UpdateText3D", 2000, true);
     
    return 1;
}

forward UpdateText3D(); public UpdateText3D() {

    Update3DTextLabelText(MyLabel, color, "2");
    KillTimer(Text3DTimer);

    return 1;
   
}
Reply
#6

Код:
new Text3DTimer;
new Text3DTimer2;
new getcar = GetPlayerVehicleID(MAX_PLAYERS);
new Text3D:vehicle3Dtext[MAX_VEHICLES];
-------------------------------------------------------------
if(strcmp(cmd, "/emergency", true) == 0)
{

if(!IsACop(playerid)) return SendClientMessage(playerid, 0xFFFFFFAA, "You are not a cop");
if(!(IsPlayerInAnyVehicle(playerid))) return SendClientMessage(playerid, COLOR_BLUE, "You must be in vehicle");
vehicle3Dtext[getcar] = Create3DTextLabel("Police Emergency", -1, 0.0, 0.0, 0.0, 50.0, 0, 1);
Attach3DTextLabelToVehicle(vehicle3Dtext[getcar], getcar, -0.8, -2.8, -0.3);
SendClientMessage(playerid, COLOR_BLUE, "USAGE: /stopemergency- when done.");
Text3DTimer = SetTimer("UpdateText3D", 4000, true);
return 1;
}

if(strcmp(cmd, "/stopemergency", true) == 0)
{

if(!IsACop(playerid)) return SendClientMessage(playerid, 0xFFFFFFAA, "You are not a cop");
if(!(IsPlayerInAnyVehicle(playerid))) return SendClientMessage(playerid, COLOR_BLUE, "You must be in vehicle");
Delete3DTextLabel(vehicle3Dtext[getcar]);
KillTimer(Text3DTimer);
KillTimer(Text3DTimer2);
return 1;
}
-------------------------------------------------------------
forward UpdateText3D(); public UpdateText3D() {

	Update3DTextLabelText(vehicle3DText[getcar], 0xFFFFF, "Keep Back");
	Text3DTimer2 = SetTimer("UpdateText3D2", 4000, true);
	KillTimer(Text3DTimer);
	return 1;

}

forward UpdateText3D2(); public UpdateText3D2() {

	Update3DTextLabelText(vehicle3DText[getcar], 0xFFFFF, "Police Emergency");
	Text3DTimer2 = SetTimer("UpdateText3D", 4000, true);
	KillTimer(Text3DTimer2);
	return 1;

}
Here is what I did, but I can't compile because it crashes.. any errors here or something ?
Reply
#7

Quote:

if(!(IsPlayerInAnyVehicle(playerid))) return SendClientMessage(playerid, COLOR_BLUE, "You must be in vehicle");

To

if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_BLUE, "You must be in vehicle");

and nice scripting skills x'D
Reply
#8

Quote:
Originally Posted by Yaa
Посмотреть сообщение
and nice scripting skills x'D
Yeah, I missed that few brackets, but still crashing...
Reply
#9

Okay, I got one clue
Error is here
Код:
new getcar = GetPlayerVehicleID(MAX_PLAYERS);
I deleted this and now it is not crashing, but then I have errors inside

Код:
vehicle3Dtext[getcar]
Reply
#10

Switch it
Код:
 vehicle3Dtext[playerid]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)