Delete3DTextLabel help (+rep)
#1

Hello, I am trying to make it so when a player becomes wounded, it says (( THIS PLAYER IS BRUTALLY WOUNDED )) so i created and attached that, and i want the player to then /acceptdeath and when they happens it updates that text label so it says (( THIS PLAYER IS DEAD )), i havent used the function Update3DTextLabelText so i just used Delete3DTextLabel and Create3DTextLabel.

Код:
C:\Users\Nick\Documents\SAMP S\INGENIOUS ROLEPLAY\gamemodes\igrp.pwn(13657) : warning 213: tag mismatch
C:\Users\Nick\Documents\SAMP S\INGENIOUS ROLEPLAY\gamemodes\igrp.pwn(13658) : warning 213: tag mismatch
C:\Users\Nick\Documents\SAMP S\INGENIOUS ROLEPLAY\gamemodes\igrp.pwn(17016) : warning 217: loose indentation
C:\Users\Nick\Documents\SAMP S\INGENIOUS ROLEPLAY\gamemodes\igrp.pwn(24927) : error 017: undefined symbol "labelid"
C:\Users\Nick\Documents\SAMP S\INGENIOUS ROLEPLAY\gamemodes\igrp.pwn(31346) : warning 217: loose indentation
C:\Users\Nick\Documents\SAMP S\INGENIOUS ROLEPLAY\gamemodes\igrp.pwn(31362) : warning 217: loose indentation
C:\Users\Nick\Documents\SAMP S\INGENIOUS ROLEPLAY\gamemodes\igrp.pwn(33886) : error 017: undefined symbol "labelid"
Код:
CMD:acceptdeath(playerid, params[])
{
	if(GetIntVar(playerid, "JustDied") == 1 || PlayerInfo[playerid][pDied] == 1)
	{
 		new Text3D:label = Create3DTextLabel("(( THIS PLAYER IS DEAD ))", 0xFFFF0000, 30.0, 40.0, 50.0, 40.0, 0);
    	Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
    	DeletePlayer3DTextLabel(playerid, labelid);
    	SCM(playerid, COLOR_LIGHTRED, "HINT: You can /respawnme to respawn.");
		StopPlayerAnims(playerid);
		SetIntVar(playerid, "JustAcceptedDeath", 1);
		RemoveVar(playerid, "JustDied");
		RemoveVar(playerid, "LoggedInDead");
		PlayerInfo[playerid][pDied] = 0;
		FreezePlayer(playerid);
	}
	else
	{
		SCM(playerid, -1, "You are not wounded.");
	}
	return 1;
}
Код:
CMD:respawnme(playerid, params[])
{
	if(GetIntVar(playerid, "JustAcceptedDeath") == 1)
	{
    	DeletePlayer3DTextLabel(playerid, label);
	    SetIntVar(playerid, "JustRespawnedMe", 1);
		HospitalWait{playerid} = 60;
		PutPlayer(playerid,1191.6139,-1323.5557,10.3984);
		SetPlayerCameraPos(playerid, 1222.4498, -1345.3663, 17.4686);
		SetPlayerCameraLookAt(playerid, 1221.5580, -1344.9164, 17.4135);
		SCM(playerid, COLOR_LIGHTRED, "[Hospital] Your medical bill is $1,000.");
		SCM(playerid, COLOR_LIGHTRED, "Please wait 1 minute before you walk out from the hospital.");
		GiveCash(playerid, -1000);
	}
	else
	{
	    SCM(playerid, -1, "You are not dead.");
	}
	return 1;
}
Код:
CMD:revive(playerid, params[])
{
	new id;
	if(!CheckAdmin(playerid, ADMIN_LEVEL_1)) return NotAuthMSG(playerid);
	if(sscanf(params,"d",id)) return SyntaxMSG(playerid, "/revive [playerid] (Only if he's wounded)");
	if(!PlayerIsOn(id)) return NotConnectedMSG(playerid);
	if(GetIntVar(id, "JustDied") == 1 || PlayerInfo[id][pDied] == 1 || GetIntVar(id, "LoggedInDead") == 1)
	{
		SetPlayerHealth(id, 100.0);
		PlayerInfo[id][pDied] = 0;
		RemoveVar(id, "JustDied");
		RemoveVar(id, "LoggedInDead");
		RemoveVar(id, "JustAcceptedDeath");
		DeletePlayer3DTextLabel(playerid, labelid);
		StopPlayerAnims(id);
		UnFreezePlayer(id);
		SCM(playerid, -1, "Player was healed.");
		SavePlayerPos(id);
		StopPlayerSpec(id);
		PutPlayer(id, PlayerInfo[id][pPosX],PlayerInfo[id][pPosY],PlayerInfo[id][pPosZ]);
	}
	else
	{
		SCM(playerid, -1, "This player isn't wounded");
	}
	return 1;
}
Код:
public CheckWounded(playerid)
{
	if(GetIntVar(playerid, "JustDied") == 1)
	{
 		new PlayerText3D:labelid = Create3DTextLabel("(( THIS PLAYER IS BRUTALLY WOUNDED ))", COLOR_PINK, 30.0, 40.0, 50.0, 40.0, 0);
    	Attach3DTextLabelToPlayer(labelid, playerid, 0.0, 0.0, 0.7);
    	SetCameraBehindPlayer(playerid);
		PutPlayer(playerid,PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ]);
		SetInterior(playerid, PlayerInfo[playerid][pInt]);
		SetWorld(playerid, PlayerInfo[playerid][pWorld]);
		SetPlayerCameraPos(playerid,PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ]);
		SetPlayerHealth(playerid, 15.0);
		GameTextForPlayer(playerid, "~b~Brutally Wounded", 5000, 3);
		GiveCash(playerid, -500);
		SCM(playerid, COLOR_PINK, "EMT: Your Medical Bills are $500");
		SCM(playerid, COLOR_LIGHTRED, "You are Brutally Wounded. If a medic or anyone else doesn't save you, you will die.");
		SCM(playerid, COLOR_LIGHTRED, "To accept death type /acceptdeath");
		FreezePlayer(playerid);
		OnAnim{playerid} = true;
		ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_DIE",3.5,0,0,0,1,0);
	}
}
Reply
#2

Quote:
Originally Posted by Matical
Посмотреть сообщение
Hello, I am trying to make it so when a player becomes wounded, it says (( THIS PLAYER IS BRUTALLY WOUNDED )) so i created and attached that, and i want the player to then /acceptdeath and when they happens it updates that text label so it says (( THIS PLAYER IS DEAD )), i havent used the function Update3DTextLabelText so i just used Delete3DTextLabel and Create3DTextLabel.

Код:
C:\Users\Nick\Documents\SAMP S\INGENIOUS ROLEPLAY\gamemodes\igrp.pwn(13657) : warning 213: tag mismatch
C:\Users\Nick\Documents\SAMP S\INGENIOUS ROLEPLAY\gamemodes\igrp.pwn(13658) : warning 213: tag mismatch
C:\Users\Nick\Documents\SAMP S\INGENIOUS ROLEPLAY\gamemodes\igrp.pwn(17016) : warning 217: loose indentation
C:\Users\Nick\Documents\SAMP S\INGENIOUS ROLEPLAY\gamemodes\igrp.pwn(24927) : error 017: undefined symbol "labelid"
C:\Users\Nick\Documents\SAMP S\INGENIOUS ROLEPLAY\gamemodes\igrp.pwn(31346) : warning 217: loose indentation
C:\Users\Nick\Documents\SAMP S\INGENIOUS ROLEPLAY\gamemodes\igrp.pwn(31362) : warning 217: loose indentation
C:\Users\Nick\Documents\SAMP S\INGENIOUS ROLEPLAY\gamemodes\igrp.pwn(33886) : error 017: undefined symbol "labelid"
Код:
CMD:acceptdeath(playerid, params[])
{
	if(GetIntVar(playerid, "JustDied") == 1 || PlayerInfo[playerid][pDied] == 1)
	{
 		new Text3D:label = Create3DTextLabel("(( THIS PLAYER IS DEAD ))", 0xFFFF0000, 30.0, 40.0, 50.0, 40.0, 0);
    	Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
    	DeletePlayer3DTextLabel(playerid, labelid);
    	SCM(playerid, COLOR_LIGHTRED, "HINT: You can /respawnme to respawn.");
		StopPlayerAnims(playerid);
		SetIntVar(playerid, "JustAcceptedDeath", 1);
		RemoveVar(playerid, "JustDied");
		RemoveVar(playerid, "LoggedInDead");
		PlayerInfo[playerid][pDied] = 0;
		FreezePlayer(playerid);
	}
	else
	{
		SCM(playerid, -1, "You are not wounded.");
	}
	return 1;
}
Код:
CMD:respawnme(playerid, params[])
{
	if(GetIntVar(playerid, "JustAcceptedDeath") == 1)
	{
    	DeletePlayer3DTextLabel(playerid, label);
	    SetIntVar(playerid, "JustRespawnedMe", 1);
		HospitalWait{playerid} = 60;
		PutPlayer(playerid,1191.6139,-1323.5557,10.3984);
		SetPlayerCameraPos(playerid, 1222.4498, -1345.3663, 17.4686);
		SetPlayerCameraLookAt(playerid, 1221.5580, -1344.9164, 17.4135);
		SCM(playerid, COLOR_LIGHTRED, "[Hospital] Your medical bill is $1,000.");
		SCM(playerid, COLOR_LIGHTRED, "Please wait 1 minute before you walk out from the hospital.");
		GiveCash(playerid, -1000);
	}
	else
	{
	    SCM(playerid, -1, "You are not dead.");
	}
	return 1;
}
Код:
CMD:revive(playerid, params[])
{
	new id;
	if(!CheckAdmin(playerid, ADMIN_LEVEL_1)) return NotAuthMSG(playerid);
	if(sscanf(params,"d",id)) return SyntaxMSG(playerid, "/revive [playerid] (Only if he's wounded)");
	if(!PlayerIsOn(id)) return NotConnectedMSG(playerid);
	if(GetIntVar(id, "JustDied") == 1 || PlayerInfo[id][pDied] == 1 || GetIntVar(id, "LoggedInDead") == 1)
	{
		SetPlayerHealth(id, 100.0);
		PlayerInfo[id][pDied] = 0;
		RemoveVar(id, "JustDied");
		RemoveVar(id, "LoggedInDead");
		RemoveVar(id, "JustAcceptedDeath");
		DeletePlayer3DTextLabel(playerid, labelid);
		StopPlayerAnims(id);
		UnFreezePlayer(id);
		SCM(playerid, -1, "Player was healed.");
		SavePlayerPos(id);
		StopPlayerSpec(id);
		PutPlayer(id, PlayerInfo[id][pPosX],PlayerInfo[id][pPosY],PlayerInfo[id][pPosZ]);
	}
	else
	{
		SCM(playerid, -1, "This player isn't wounded");
	}
	return 1;
}
Код:
public CheckWounded(playerid)
{
	if(GetIntVar(playerid, "JustDied") == 1)
	{
 		new PlayerText3D:labelid = Create3DTextLabel("(( THIS PLAYER IS BRUTALLY WOUNDED ))", COLOR_PINK, 30.0, 40.0, 50.0, 40.0, 0);
    	Attach3DTextLabelToPlayer(labelid, playerid, 0.0, 0.0, 0.7);
    	SetCameraBehindPlayer(playerid);
		PutPlayer(playerid,PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ]);
		SetInterior(playerid, PlayerInfo[playerid][pInt]);
		SetWorld(playerid, PlayerInfo[playerid][pWorld]);
		SetPlayerCameraPos(playerid,PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ]);
		SetPlayerHealth(playerid, 15.0);
		GameTextForPlayer(playerid, "~b~Brutally Wounded", 5000, 3);
		GiveCash(playerid, -500);
		SCM(playerid, COLOR_PINK, "EMT: Your Medical Bills are $500");
		SCM(playerid, COLOR_LIGHTRED, "You are Brutally Wounded. If a medic or anyone else doesn't save you, you will die.");
		SCM(playerid, COLOR_LIGHTRED, "To accept death type /acceptdeath");
		FreezePlayer(playerid);
		OnAnim{playerid} = true;
		ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_DIE",3.5,0,0,0,1,0);
	}
}
Why create new text Labe, when the short message is SetPlayerChatBubble()?
PHP код:
#define MAX_CHATBUBBLE_LENGTH 144
SetPlayerChatBubble(playerid"(( THIS PLAYER IS BRUTALLY WOUNDED ))" , -160.010000); 
Note: Which displays the text on the player's head.
Reply
#3

Quote:
Originally Posted by Logofero
Посмотреть сообщение
Why create new text Labe, when the short message is SetPlayerChatBubble()?
PHP код:
#define MAX_CHATBUBBLE_LENGTH 144
SetPlayerChatBubble(playerid"(( THIS PLAYER IS BRUTALLY WOUNDED ))" , -160.010000); 
Note: Which displays the text on the player's head.
Okay and then how do i make it remove when he does /acceptdeath
Reply
#4

Quote:
Originally Posted by Matical
Посмотреть сообщение
Okay and then how do i make it remove when he does /acceptdeath
PHP код:
SetPlayerChatBubble(playerid"(( THIS PLAYER IS BRUTALLY WOUNDED ))" , -160.010000); // call show text 
The text disappears itself through time. Now is 10000 milliseconds = 10 seconds
Reply
#5

Quote:
Originally Posted by Logofero
Посмотреть сообщение
PHP код:
SetPlayerChatBubble(playerid"(( THIS PLAYER IS BRUTALLY WOUNDED ))" , -160.010000); // call show text 
The text disappears itself through time. Now is 10000 milliseconds = 10 seconds
Well i dont want it to disappear after time thats why i was using text labels, i want it so when the player dies right as he dies it attaches the label saying (( THIS PLAYER IS BRUTALLY WOUNDED )) and when the player dead when he /acceptdeath it updates the label saying (( THIS PLAYER IS DEAD )) and then delete that when the player does /respawnme
Reply
#6

Quote:
Originally Posted by Matical
Посмотреть сообщение
Well i dont want it to disappear after time thats why i was using text labels, i want it so when the player dies right as he dies it attaches the label saying (( THIS PLAYER IS BRUTALLY WOUNDED )) and when the player dead when he /acceptdeath it updates the label saying (( THIS PLAYER IS DEAD )) and then delete that when the player does /respawnme
Are you sure that this (the text does not disappear) will be interested in the game? Imagine yourself. Always see the text breakdown head about what the wounded, whether it is necessary withdraw.

I understand if it is a status level, the slogan.
Reply
#7

Ok. Im show you method make/upd/destroy text label and you will modify it

Give code:
PHP код:
// Init Text Labels
new Text3D:p_dmgstatus[MAX_PLAYERS] = {INVALID_3DTEXT_ID, ...};
public 
OnPlayerSpawn(playerid) {
      
// Create damage status ---------------------------------------------------------
      // Delete OLD Text Label
      
if (Text3D:p_dmgstatus[playerid] != Text3D:INVALID_3DTEXT_ID) {
            
Delete3DTextLabel(Text3D:p_dmgstatus[playerid]);
            
p_dmgstatus[playerid] = Text3D:INVALID_3DTEXT_ID;
      }
      
p_dmgstatus[playerid] = Text3D:Create3DTextLabel("(( Damage status ))"0xAAAAAAAA0.00.00.00.000);
      if (
Text3D:p_dmgstatus[playerid]) Attach3DTextLabelToPlayer(Text3D:p_dmgstatus[playerid], playerid0.00.00.4);
      
// EOF Create damage status ---------------------------------------------------------
      
return true;
}
public 
OnPlayerDeath(playeridkilleridreason) {
      
// Update danage status ---------------------------------------------------------
      
new 
           
msg[256]
      ;
      if (
killerid != INVALID_PLAYER_ID) {
           new 
                
kname[MAX_PLAYER_NAME]
           ;
           
GetPlayerName(killeridknamesizeof(kname));
           
format(msgsizeof(msg), "<Is Killed %s(%d)>"knamekillerid);
      } else {
           
msg "<Is dead>";
      }
      
Update3DTextLabelText(Text3D:p_dmgstatus[playerid], 0xFFFF00AAmsg);
      
// EOF Update danage status ---------------------------------------------------------
      
return true;
}
public 
OnPlayerDisconnect(playeridreason) {
      
// Destroy Text Label ---------------------------------------------------------
      
if (Text3D:p_dmgstatus[playerid] != Text3D:INVALID_3DTEXT_ID) {
            
Delete3DTextLabel(Text3D:p_dmgstatus[playerid]);
            
p_dmgstatus[playerid] = Text3D:INVALID_3DTEXT_ID;
      }
      
// EOF Destroy Text Label ---------------------------------------------------------
      
return true;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)