hello guys im preparing a OnPlayerDeath but it doesnt seem to work as when i die i still can talk.here is my code:
Any help is appreciated
Code:
public OnPlayerDeath(playerid, killerid, reason)
{
if(IsDead[playerid] == 1 && InCall[playerid] == 1 && Tallking[playerid] == 1) IsDead[playerid] = 1;
new Float:px,Float:py,Float:pz;
GetPlayerPos(playerid,px,py,pz);
USER[playerid][DEATHS]=1;
SendClientMessage(playerid,COLOR_RED, "You Are Brutally Wounded. If You Don't Get Help You Will Die.(/acceptdeath to die)");
SetPlayerPos(playerid,px,py,pz);
ApplyAnimation(playerid,"ped","FALL_fall",4.1,1,1,1,0,0,1);
return 1;
}
public OnPlayerText(playerid, text[])
{
if(InCall[playerid] == 1)
{
if(IsPlayerConnected(TallkingID[playerid]) && Tallking[playerid] == 1 && TallkingID[playerid] > -1 && Tallking[TallkingID[playerid]] == 1)
{
new str[128];
format(str,sizeof(str),"[Ph]%s (phone): %s",GetName(playerid),text);
SendClientMessage(TallkingID[playerid],COLOR_LIGHTGRAY,str);
format(str,sizeof(str),"[Ph]%s (phone): %s",GetName(playerid),text);
SendClientMessage(playerid,COLOR_LIGHTGRAY,str);
ProxDetector(23.0, playerid, str, -1);
return 0;
}
}
else
{
if(USER[playerid][DEATHS]==1) return SendClientMessage(playerid,COLOR_RED,"You Are Brutally Wounded And Can't Talk");
else
{
if(USER[playerid][DEATHS]==0)
{
new texts[128],name[24];
GetPlayerName(playerid,name,24);
format(texts,sizeof(texts), "%s: %s",name,text);
ProxDetector(23.0, playerid, texts, -1);
return 0;
}
}
}
return 0;
}