20.02.2019, 12:37
OnPlayerDeath now looks like
PHP Code:
public OnPlayerDeath(playerid, killerid, reason)
{
print("Ok");
if(GroupInfo[PlayerInfo[killerid][pGroup]][gType]==GROUP_TYPE_HITMAN){
new cid,m[512];
if(IsPlayerInContract(playerid)){
cid = GetPlayerContractID(playerid);
ContractInfo[cid][c_killer] = PlayerInfo[killerid][pID];
GiveMoney(playerid,-ContractInfo[cid][c_amount]);
format(m, sizeof(m), "You were killed by hitman. You lost -$%i.", ContractInfo[cid][c_amount]);
SendClientMessage(playerid, COLOR_YELLOW, m);
format(m, sizeof(m), "You have finished a contract of $%i. You received $%d.", ContractInfo[cid][c_amount],ContractInfo[cid][c_amount]/2);
SendClientMessage(killerid, COLOR_YELLOW, m);
GiveMoney(killerid,ContractInfo[cid][c_amount]/2);
mysql_format(dbhandle, m, sizeof(m), "UPDATE contracts SET killer='%i' WHERE id='%i'", PlayerInfo[killerid][pID],ContractInfo[cid][c_SQLID]);
mysql_tquery(dbhandle, m);
SendPlayerToHospital(playerid);
return 1;
}
}
if (PlayerInfo[playerid][pInjured] == 0){
SendClientMessage(playerid, -1, "Reached");
PlayerInfo[playerid][pInjured] = 1;
GetPlayerPos(playerid, inj_x,inj_y,inj_z);
GetPlayerFacingAngle(playerid, injured_angle);
}
else if (PlayerInfo[playerid][pInjured] == 1)
{
KillTimer(AcceptDeathTimer[playerid]);
KillTimer(LoseHealthTimer[playerid]);
AcceptDeath[playerid] = 0;
PlayerInfo[playerid][pInjured] = 0;
Hospitalized[playerid] = 1;
}
return 1;
}