3DTextLabel is not working properly. -
Hello. I have this problem:
1: is when the player uses /status (yo in spanish) to create an status over his head like /status Green t-shirt - Blue pants - 30yo.
2: When the player dies, the same 3DLABEL is deleted and a new one is created (THIS PLAYER IS DEAD /INJURY ID)... the problem here is that it removes or remplaces the 3D label from the first player, for example:
If player 1 dies a 3D label will be displayed over his head, BUT if a second player dies, the first player Label won't show up anymore (is eliminated or changes to the second player), happens like if only exist 1 and rotates from player to player, but is not like that.. I hope someone can help me out here, i tried tons of things.
Код:
Text3D:estado[MAX_PLAYERS],
(this function is called when the player is under 9HP, avoids the player death and sets him with anims on the ground)
funcion SinSangre(playerid, tipo)
{
usandoYo[playerid] = 0;
_Mensaje(playerid, 4, "fcc1fd", "Comandos disponibles en crack: /avisarpd /heridas /qfa");
_Mensaje(playerid, 4, "fcc1fd", "Reaparecerбs en el hospital de Santa Flora en 8 minutos de no ser revivido.");
ConEscudo[playerid] = 0;
ShutOffBlinkingLights(playerid);
PLights[playerid] = 0;
DestroyObject(OEscudo[playerid]);
SetPVarInt(playerid, "Esta_Herido", 1);
SetPVarInt(playerid, "Necesita_LSED", 1);
SetPVarInt(playerid, "Llamada_LSED", 1);
user[playerid][jSangre] = 50.0;
user[playerid][jMuerto2] = 1;
user[playerid][jMuerto] = 1;
ApplyAnimation(playerid, "WUZI", "CS_Dead_Guy", 4.0, 0, 0, 0, 1, 0, 1);
KillTimer(MuertoTimer[playerid]);
MuertoTimer[playerid] = SetTimerEx("Muerto", 480000, false, "i", playerid);
new str[128];
format(str, sizeof(str), "Esta persona estб brutalmente herida\n(/heridas %d)", playerid);
Delete3DTextLabel(estado[playerid]);
estado[playerid] = Create3DTextLabel(str,0xEAD055FF,30.0,40.0,5.0,40.0,1);
//Update3DTextLabelText(estado[playerid], 0xEAD055FF, str); //0xAA3333FF --- 0xC23E3EFF
Attach3DTextLabelToPlayer(estado[playerid], playerid, 0.0, 0.0, 0.5);
case 2:
{
if (IsPlayerInAnyVehicle(playerid))
{
RemovePlayerFromVehicle(playerid);
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(playerid, X, Y, Z+2);
}
Esposado[playerid] = 0; RemovePlayerAttachedObject(playerid, 9);
usandoYo[playerid] = 0;
TogglePlayerControllable(playerid, 0);
_Mensaje(playerid, 4, "b00000", "Te han rematado, en 2 minutos vas a respawnear en el hospital.");
SetPVarInt(playerid, "Necesita_LSED", 1);
SetPVarInt(playerid, "Esta_Herido", 2);
SetPVarInt(playerid, "Llamada_LSED", 1);
user[playerid][jSangre] = 15.0;
user[playerid][jMuerto2] = 2;
user[playerid][jMuerto] = 1;
ClearAnimations(playerid);
ApplyAnimation(playerid, "WUZI", "CS_Dead_Guy", 4.0, 0, 0, 0, 1, 0, 1);
KillTimer(MuertoTimer[playerid]);
MuertoTimer[playerid] = SetTimerEx("Muerto", 120000, false, "i", playerid);
new str[128];
format(str, sizeof(str), "Esta persona estб muerta\n(/heridas %d)", playerid);
Delete3DTextLabel(estado[playerid]);
estado[playerid] = Create3DTextLabel(str,0xEAD055FF,30.0,40.0,5.0,40.0,1);
//Update3DTextLabelText(estado[playerid], 0xEAD055FF, str); //0xAA3333FF --- 0xC23E3EFF
Attach3DTextLabelToPlayer(estado[playerid], playerid, 0.0, 0.0, 0.5);
}
________________________
public OnPlayerConnect(playerid)
{
Delete3DTextLabel(estado[playerid]);
//Update3DTextLabelText(estado[playerid], 0xBFC0C2FF, "null");
//Attach3DTextLabelToPlayer(estado[playerid], playerid, 0.0, 0.0, 1000.0);
public OnPlayerDisconnect(playerid, reason)
{
Delete3DTextLabel(estado[playerid]);
_OnPlayerSpawn(playerid) { (this is another function after the login, checks if the player is in jail and blah blah)
Delete3DTextLabel(estado[playerid]);
//Update3DTextLabelText(estado[playerid], 0xBFC0C2FF, "void");
//Attach3DTextLabelToPlayer(estado[playerid], playerid, 0.0, 0.0, 1000.0);
stock _Limuerte(pd) {
usandoYo[pd] = 0;
Delete3DTextLabel(estado[pd]);
//Update3DTextLabelText(estado[pd], 0xBFC0C2FF, "void");
//Attach3DTextLabelToPlayer(estado[pd], pd, 0.0, 0.0, 1000.0);
CMD:estado(playerid, params[]) return cmd_yo(playerid, params); (this one is the "/status or /yo")
CMD:yo(playerid, params[])
{
if (GetPVarInt(playerid, "EnCrack") == 1) return _Mensaje(playerid, 0, "12", "No puedes usar este comando mientras estбs herido.");
if (usandoYo[playerid] == 1) return _Mensaje(playerid, 0, "12", "Ya posees una descripciуn, escribe /qyo.");
if (sscanf(params, "s[128]", params[0])) return _Mensaje(playerid, 3, "0", "/yo [descripciуn]");
if (strlen(params[0]) > 45) { _Mensaje(playerid, 4, "b00000", " El mбximo de carбcteres es de 45."); }
_Mensaje(playerid, 4, "E9921E", params[0]);
estado[playerid] = Create3DTextLabel(params[0],0xEAD055FF,30.0,40.0,5.0,40.0,1);
//Update3DTextLabelText(estado[playerid], 0xE9921EFF, params[0]); //0xAA3333FF
Attach3DTextLabelToPlayer(estado[playerid], playerid, 0.0, 0.0, 0.4);
usandoYo[playerid] = 1;
return 1;
}
CMD:sinestado(playerid) return cmd_qyo(playerid);
CMD:qyo(playerid)
{
if (GetPVarInt(playerid, "EnCrack") == 1) return _Mensaje(playerid, 0, "12", "No puedes usar este comando mientras estбs herido.");
if (usandoYo[playerid] == 0) return _Mensaje(playerid, 0, "12", "No posees ninguna descripciуn.");
Delete3DTextLabel(estado[playerid]);
//Update3DTextLabelText(estado[playerid], 0xBFC0C2FF, "void");
//Attach3DTextLabelToPlayer(estado[playerid], playerid, 0.0, 0.0, 1000.0);
usandoYo[playerid] = 0;
return 1;
}
Also: this thing had the "update3dtextlabel" at the beginning but i changed it with create and delete3dlabel because i thought that was the problem, its not working like you can see.
Also2: i just added the important things about the script, so, don't worry if there is an { w/o }.
Also3: this thing fucks w/ the /callsign too, dunno why because the /callsign for PD is different, created per ID car not ID player.