3D Text label OnPlayerDeath -
Counterafk - 21.10.2015
solved original issue, got a new(irrelevant to this)issue, posted it as a reply.
Alright so I basicly want to make it so that when a person dies, a label appears on their position with players name, killers name along with the weapon used.
Код:
new Text3D:Deathlabel[MAX_PLAYERS]; //global
public OnPlayerDeath(playerid, killerid, reason)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
Deathlabel = Create3DTextLabel("%s's body.\nKilled by %s\nwith a %s.", -1, x, y, z, 40.0, 0, 0); //
SetTimerEx("RemoveDeathlabel",8000,0,"i",playerid);
return 1;
}
Код:
GW.pwn(450) : error 035: argument type mismatch (argument 1)
GW.pwn(495) : error 033: array must be indexed (variable "Deathlabel")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Errors.
I guess what I need to know / what someone needs to explain to me is: where do I add playerid, killerid and reason? A little lost on the whole "symbol is assigned a value that is never used: "Deathlabel" aswell.
Also, I'm pretty sure theres something else in the code that I messed up with.
I think I understand what the problem is I just lack the experience/knowledge to set it up properly.
Thanks for taking your time!
AW: 3D Text label OnPlayerDeath -
Kaliber - 21.10.2015
You should do it like this:
PHP код:
new Text3D:Deathlabel[MAX_PLAYERS]; //global
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid == INVALID_PLAYER_ID) return 1;
new Float:x, Float:y, Float:z,string[128],n[MAX_PLAYER_NAME],tmp[32];
GetPlayerPos(playerid,x,y,z),GetWeaponName(reason,tmp,sizeof(tmp)),
GetPlayerName(playerid,n,MAX_PLAYER_NAME),GetPlayerName(killerid,string,MAX_PLAYER_NAME),
format(string,sizeof(string),"%s's body.\nKilled by %s\nwith a %s.",n,string,tmp);
Deathlabel[playerid] = Create3DTextLabel(string, -1, x, y, z, 40.0, 0, 0); //
SetTimerEx("RemoveDeathlabel",8000,0,"i",playerid);
return 1;
}
Re: 3D Text label OnPlayerDeath -
Vince - 21.10.2015
Or just pass the Deathlabel value to the function instead of the playerid. No extra space wasting variable needed. Use _: tag override to suppress the tag mismatch warning that will come up in this case.
Re: 3D Text label OnPlayerDeath -
Counterafk - 22.10.2015
Hi! Works like a charm! Although I've got a little issue with my own timer to remove the label.
Код:
SetTimerEx("RemoveDeathlabel",6500,0,"i");
forward RemoveDeathlabel();
public RemoveDeathlabel()
{
//Delete3DTextLabel("Deathlabel");
}
Код:
GW.pwn(450) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.





Re: 3D Text label OnPlayerDeath -
J0sh... - 22.10.2015
Doesn't work like that, you need to set a variable to the 3dtextlabel then use Delete3DText(variable);
Re: 3D Text label OnPlayerDeath -
AbyssMorgan - 22.10.2015
PHP код:
SetTimerEx("RemoveDeathlabel",6500,0,"i",playerid);
forward RemoveDeathlabel(playerid);
public RemoveDeathlabel(playerid)
{
Delete3DTextLabel(Deathlabel[playerid]);
}
Re: 3D Text label OnPlayerDeath -
Counterafk - 22.10.2015
Thanks!
Got another problem ( kind of irrelevant to the original one ) figured I might aswell add it here.
Timer works like it should (I think). F**cked up somewhere on CMD:armor, If I was to guess.
Код:
new CanArmor[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
SetTimerEx("CanArmorTimer",60000,0,"i",playerid); // How long before you can /armor
CanArmor[playerid] = 0;
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
KillTimer(CanArmorTimer);
return 1;
}
forward CanArmorTimer(playerid);
public CanArmorTimer(playerid)
{
SendClientMessage(playerid, -1, "You can now buy armor!(/Armor)");
CanArmor[playerid] = 1;
}
CMD:armor(playerid,params[])
{
if(CanArmor[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREEN, "You have bought extra armor!");
SetPlayerArmour(playerid, 100);
CanArmor[playerid] = 0;
}
else
{
SendClientMessage(playerid, COLOR_RED, "You can not buy extra armor yet!");
}
return 1;
}
Код:
GW.pwn(535) : error 076: syntax error in the expression, or invalid function call
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Only error message is from the timer, but another problem is also that "You can not buy extra armor yet" appears, even though the timer notified me that 60 seconds had passed and I should be able to have joined.
Re: 3D Text label OnPlayerDeath -
jlalt - 23.10.2015
PHP код:
new CanArmor[MAX_PLAYERS],timer[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
timer[playerid] = SetTimerEx("CanArmorTimer",60000,0,"i",playerid); // How long before you can /armor
CanArmor[playerid] = 0;
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
KillTimer(timer[playerid]);
return 1;
}
forward CanArmorTimer(playerid);
public CanArmorTimer(playerid)
{
SendClientMessage(playerid, -1, "You can now buy armor!(/Armor)");
CanArmor[playerid] = 1;
}
CMD:armor(playerid,params[])
{
if(CanArmor[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREEN, "You have bought extra armor!");
SetPlayerArmour(playerid, 100);
CanArmor[playerid] = 0;
}
else
{
SendClientMessage(playerid, COLOR_RED, "You can not buy extra armor yet!");
}
return 1;
}
you did not name the timer for kill it, look above
PHP код:
timer[MAX_PLAYERS];
timer[playerid] = SetTimerEx(....);
KillTimer(timer[playerid);
if you use just new timer; and killtimer(timer); // on kill timer all players timer will be disabled then if you just spawned and other player dies you will never can use /armor xd xp hope i helped
Re: 3D Text label OnPlayerDeath -
Counterafk - 23.10.2015
Oh yeah. Didnt think of that

Thanks for the help, everyone!