Delete 3DTextlabelid after X seconds -
IKnowWhatIAmDoing - 21.08.2014
When a player spawns, I want a 3DTextLabel to appear at the place they spawned for specific players (Players that have some variable equal to 1) and after 15 seconds I want this label to be destroyed for all players which it was created for. So we will know who spawned where. And also I'd store a variable for the 3Dtextlabel
for each player but then It wont work if you get multiple spawns at once. (It will override the other labels)
I tried this:
pawn Код:
foreach(new i : Player) // onplayerspawn
{
if(SomeVar[i] == 1)
{
new PlayerText3D:playertextid
playertextid = CreatePlayer3DTextLabel(i,"bla bla bla",0x008080FF,x,y,z,40.0);
SetTimerEx("DeleteLabel", 15000, false, "dd", i, playertextid); // warning 213: tag mismatch
}
}
forward DeleteLabel(playerid,labelid);
public DeleteLabel(playerid,labelid)
{
DeletePlayer3DTextLabel(playerid, PlayerText3D:labelid);
}
AW: Delete 3DTextlabelid after X seconds -
CIBERKILLER - 21.08.2014
You can still just as good a for loop to use a foreach loop then why ??
Re: Delete 3DTextlabelid after X seconds -
Sawalha - 21.08.2014
pawn Код:
SetTimerEx("DeleteLabel", 15000, false, ,"i", playertextid);
AW: Re: Delete 3DTextlabelid after X seconds -
CIBERKILLER - 21.08.2014
Quote:
Originally Posted by Sawalha
pawn Код:
SetTimerEx("DeleteLabel", 15000, false, ,"i", playertextid);
|
Does not make sense, since it is a Playertextdraw
ii was right! (or dd)
Код:
for(new i;i<GetMaxPlayers();i++)// onplayerspawn
{
if(i == INVALID_PLAYER_ID)continue;
if(SomeVar[i] != 1)continue;
new PlayerText3D:playertextid, test;
playertextid,test = CreatePlayer3DTextLabel(i,"bla bla bla",0x008080FF,x,y,z,40.0);
SetTimerEx("@DeleteLabel", 15000, false, "ii", i, test);
}
@DeleteLabel(id, lid); @DeleteLabel(id, lid){DeletePlayer3DTextLabel(playerid, lid);}
Try this code a try, again I'm sorry for my bad english
Re: Delete 3DTextlabelid after X seconds -
IKnowWhatIAmDoing - 21.08.2014
Quote:
Originally Posted by Sawalha
pawn Код:
SetTimerEx("DeleteLabel", 15000, false, ,"i", playertextid);
|
First of all, the label is created for a player THEREFORE it has to HAVE playerid (i at this case since Its in a loop). Anyway what you said doesn't work, your way or the other, both don't.
Edit: CIBER I will try that code when I'm at my house, thanks in advance.