03.09.2015, 20:44
Hi, I have a problem OnPlayerDeath callback.
After a player dies, he can still walk, can shoot a gun, etc. It is only the dead have seen other players. How can I solve this problem?
I tried to put SpawnPlayer (playerid);, but you regenerate too quickly and cause crashes.
After a player dies, he can still walk, can shoot a gun, etc. It is only the dead have seen other players. How can I solve this problem?
I tried to put SpawnPlayer (playerid);, but you regenerate too quickly and cause crashes.
PHP код:
public OnPlayerDeath(playerid, killerid, reason)
{
new string[100];
PlayerEnterTime[playerid] += 221;
if(Trailer[playerid] != INVALID_VEHICLE_ID)
{
DestroyVehicle(Trailer[playerid]);
}
Munceste[playerid] = 0;
if(JobVehicle[playerid] != INVALID_VEHICLE_ID)
{
DestroyVehicle(JobVehicle[playerid]);
}
DisablePlayerCheckpoint(playerid);
PlayerTextDrawHide(playerid, TruckerTD[playerid]);
PlayerTextDrawHide(playerid, TruckerTD2[playerid]);
PlayerTextDrawHide(playerid, TruckerTD3[playerid]);
PlayerTextDrawHide(playerid, TruckerTD4[playerid]);
PlayerTextDrawHide(playerid, Kilom1[playerid]);
PlayerTextDrawHide(playerid, Kilom2[playerid]);
PlayerTextDrawHide(playerid, Kilom3[playerid]);
PlayerTextDrawHide(playerid, Kilom4[playerid]);
PlayerTextDrawHide(playerid, Kilom5[playerid]);
PlayerTextDrawHide(playerid, BoxDMV1[playerid]);
PlayerTextDrawHide(playerid, InfoDMV[playerid]);
PlayerTextDrawHide(playerid, Sfat1DMV[playerid]);
PlayerTextDrawHide(playerid, TimpRamasDMV[playerid]);
PlayerTextDrawHide(playerid, BoxDMV2[playerid]);
PlayerTextDrawHide(playerid, BoxDMV3[playerid]);
PlayerTextDrawHide(playerid, BoxDMV4[playerid]);
PlayerTextDrawHide(playerid, Sfat2DMV[playerid]);
if(DutyOn[playerid] != 0)
{
DutyOn[playerid] = 0;
}
if(killerid != INVALID_PLAYER_ID)
{
if(GetPlayerState(killerid) == PLAYER_STATE_DRIVER && !IsAPlane(GetPlayerVehicleID(killerid)))
{
format(string, sizeof(string), "AdmWarning: %s [%d] a fost omorat de %s [%d] folosind metoda `Drive-By`.", GetName(playerid), playerid, GetName(killerid), killerid);
AdminsBroadCast(COLOR_LIGHTRED, string);
}
if(GetDistanceBetweenPlayers(killerid, playerid) > 90 && reason != 34 && reason != 33)
{
new gunname[50];
GetWeaponName(reason, gunname, sizeof(gunname));
format(string,sizeof(string),"AdmWarning: %s l-a omorat pe %s de la distanta de %.0f metri cu arma %s.",GetName(killerid),GetName(playerid), GetDistanceBetweenPlayers(killerid,playerid), gunname);
AdminsBroadCast(COLOR_LIGHTRED, string);
}
new fpm,fkm;
fpm = PlayerInfo[playerid][pMember];
fkm = PlayerInfo[killerid][pMember];
for(new turf = 1; turf < sizeof(TurfInfo); turf++)
{
if(IsPlayerInTurf(playerid, turf) && IsPlayerInTurf(killerid, turf))
{
if(IsAMember(playerid) && IsAMember(killerid))
{
if(WarInfo[turf][wFaction] == fpm && WarInfo[turf][wAttacker] == fkm || WarInfo[turf][wFaction] == fkm && WarInfo[turf][wAttacker] == fpm)
{
if(fkm == WarInfo[turf][wAttacker] || fkm == WarInfo[turf][wFaction])
{
WarScoreF[fkm][turf] += 1.0;
}
ucideri[killerid][turf] ++;
decese[playerid][turf] ++;
if(PlayerInfo[killerid][pMember] == WarInfo[turf][wAttacker])
{
if(ucideri[killerid][turf] > bestscoreat[turf])
{
bestscoreat[turf] = ucideri[killerid][turf];
bestmemberat[turf] = killerid;
}
}
if(PlayerInfo[killerid][pMember] == WarInfo[turf][wFaction])
{
if(ucideri[killerid][turf] > bestscoredf[turf])
{
bestscoredf[turf] = ucideri[killerid][turf];
bestmemberdf[turf] = killerid;
}
}
if(PlayerInfo[playerid][pMember] == WarInfo[turf][wAttacker])
{
if(decese[playerid][turf] > worstscoreat[turf])
{
worstscoreat[turf] = decese[playerid][turf];
worstmemberat[turf] = playerid;
}
}
if(PlayerInfo[playerid][pMember] == WarInfo[turf][wFaction])
{
if(decese[playerid][turf] > worstscoredf[turf])
{
worstscoredf[turf] = decese[playerid][turf];
worstmemberdf[turf] = playerid;
}
}
format(string, sizeof(string), "{0099FF}Razboi: {FFFFFF}L-ai omorat pe %s si ai primit 25$! (Turf ID: %d)",GetName(playerid), turf);
SCM(killerid, 0x0080FFFF, string);
GivePlayerCash(killerid, 25);
GivePlayerCash(playerid, -10);
format(string, sizeof(string), "{0099FF}Razboi: {FFFFFF}Ai fost omorat de %s! (Turf ID: %d)",GetName(killerid), turf);
SCM(playerid, 0x0080FFFF, string);
GameTextForPlayer(killerid, "~g~+$25", 600, 1);
GameTextForPlayer(playerid, "~r~-$10", 600, 1);
SendDeathMsgToWar( killerid, playerid, reason );
}
}
}
}
}
return 1;
}