3D label on death
#1

Okay, so I've figured out how to attach a label to someone when they die.. 'This player is bruitally wounded'

But I want to so when they /acceptdeath it deletes it..

ADDING THE LABEL:

Код:
forward PlayerDeathMode(playerid);
public PlayerDeathMode(playerid)
{
	new string[128];
	format(string, sizeof(string), "(( This player is bruitally wounded..\n/damages %s to check damages ))", playerid);
	new Text3D:deathlabel = Create3DTextLabel(string, COLOR_LIGHTRED, 0.0, 0.0, 0.0, 15.0, 0);
	Attach3DTextLabelToPlayer(deathlabel, playerid, 0.0, 0.0, 0.7);
	ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die", 4.1, 0, 0, 0, 1, 0, 1);
	SetPlayerColor(playerid, TRANSPARENT_GREY);
	SendClientMessage(playerid, COLOR_LIGHTRED, "(( You are not bruitally wounded, you have 2 minutes to get help before you can acceptdeath. ))");
	deathmodedeath[playerid] = SetTimerEx("PlayerDeathModeDEATH", 120000, false, "i", playerid);
	deathmodeaccept[playerid] = SetTimerEx("PlayerDeathModeACCEPT", 60000, false, "i", playerid);
	pDeathMode[playerid] = 1;
	cantacceptdeath[playerid] = 1;
	return 1;
}
And here I want the label to be removed

Код:
CMD:acceptdeath(playerid, params[])
{
	if(cantacceptdeath[playerid] == 1) return SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER:{FFFFFF} You must wait first.. ))");
	SetPlayerPos(playerid, 1177.9880, -1323.7708, 15.0878);
	SendClientMessage(playerid, COLOR_LIGHTRED, "** You accepted your fate, you're medical bills come to $500");
 	GivePlayerMoney(playerid, -500);
 	KillTimer(deathmodeaccept[playerid]);
 	KillTimer(deathmodedeath[playerid]);
 	return 1;
}
Reply
#2

Hello!

Write it so:
PHP код:
new Text3D:deathlabel[MAX_PLAYERS] = {-1,...};//global
//In OnPlayerConnect
deathlabel[playerid] = -1;
forward PlayerDeathMode(playerid);
public 
PlayerDeathMode(playerid)
{
    new 
string[128],name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,name,sizeof name);
    
format(stringsizeof(string), "(( This player is bruitally wounded..\n/damages %s to check damages ))"name);
    
deathlabel[playerid] = Create3DTextLabel(stringCOLOR_LIGHTRED0.00.00.015.00);
    
Attach3DTextLabelToPlayer(deathlabel[playerid], playerid0.00.00.7);
    
ApplyAnimation(playerid"KNIFE""KILL_Knife_Ped_Die"4.1000101);
    
SetPlayerColor(playeridTRANSPARENT_GREY);
    
SendClientMessage(playeridCOLOR_LIGHTRED"(( You are not bruitally wounded, you have 2 minutes to get help before you can acceptdeath. ))");
    
deathmodedeath[playerid] = SetTimerEx("PlayerDeathModeDEATH"120000false"i"playerid);
    
deathmodeaccept[playerid] = SetTimerEx("PlayerDeathModeACCEPT"60000false"i"playerid);
    
pDeathMode[playerid] = 1;
    
cantacceptdeath[playerid] = 1;
    return 
1;
}
CMD:acceptdeath(playeridparams[])
{
    if(
cantacceptdeath[playerid] == 1) return SendClientMessage(playeridCOLOR_LIGHTRED"SERVER:{FFFFFF} You must wait first.. ))");
    
SetPlayerPos(playerid1177.9880, -1323.770815.0878);
    
SendClientMessage(playeridCOLOR_LIGHTRED"** You accepted your fate, you're medical bills come to $500");
     
GivePlayerMoney(playerid, -500);
     
KillTimer(deathmodeaccept[playerid]);
     
KillTimer(deathmodedeath[playerid]);
     
Delete3DTextLabel(deathlabel[playerid]);
     
deathlabel[playerid] = -1;
     return 
1;

Mencent
Reply
#3

Код:
C:\Users\Nathan\Desktop\Downtown Roleplay\gamemodes\core.pwn(171) : warning 213: tag mismatch
C:\Users\Nathan\Desktop\Downtown Roleplay\gamemodes\core.pwn(434) : warning 213: tag mismatch
C:\Users\Nathan\Desktop\Downtown Roleplay\gamemodes\core.pwn(4803) : warning 217: loose indentation
C:\Users\Nathan\Desktop\Downtown Roleplay\gamemodes\core.pwn(4807) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Warnings.
Reply
#4

The warnings are these..


deathlabel[playerid] = -1;
new Text3D:deathlabel[MAX_PLAYERS] = {-1,...};//global

For tag mismatch
Reply
#5

Oh, sorry.
Write it in the following way:
PHP код:
new Text3D:deathlabel[MAX_PLAYERS];//global 
PHP код:
In OnPlayerConnect:
deathlabel[playerid] = 0
Mencent
Reply
#6

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Oh, sorry.
Write it in the following way:
PHP код:
new Text3D:deathlabel[MAX_PLAYERS];//global 
PHP код:
In OnPlayerConnect:
deathlabel[playerid] = 0
Mencent
On /acceptdeath and onplayerconnect if I use deathlabel[playerid] = 0; i get:

Код:
C:\Users\Nathan\Desktop\Downtown Roleplay\gamemodes\core.pwn(4808) : warning 213: tag mismatch
Reply
#7

Sorry again, but write it so:
PHP код:
new Text3D:deathlabel[MAX_PLAYERS] = {-1,...};//global 
And in OnPlayerConnect and /acceptdeath:
PHP код:
deathlabel[playerid] = Text3D:0
Mencent
Reply
#8

no errors but this 1.. and ty for the help

Код:
C:\Users\Nathan\Desktop\Downtown Roleplay\gamemodes\core.pwn(170) : warning 213: tag mismatch
Код:
new Text3D:deathlabel[MAX_PLAYERS] = {-1,...};//global
Reply
#9

Send me more code, because for me it works.

Mencent
Reply
#10

this is where i get the error about tag miss match:
Код:
new Text3D:deathlabel[MAX_PLAYERS] = {-1,...};//global
on player conn:
Код:
deathlabel[playerid] = Text3D:0;
although if i make it this there's no pawn errors, dont know about IG tho

Код:
new Text3D:deathlabel[MAX_PLAYERS];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)