19.08.2016, 11:34
OnVehicleDeath, you must check killerid before using it to avoid run time 4 error, same in OnPlayerDeath
PHP код:
public OnVehicleDeath(vehicleid, killerid)
{
if(killerid != INVALID_PLAYER_ID)
{
new text[128];
if(IsCapturing[killerid][usapro] == 1)
{
if(vehicleid == usapro)
{
DisablePlayerCheckpoint(killerid);
IsCapturing[killerid][usapro] = 0;
format(text, sizeof(text), "%s has failed to capture the USA Prototype.", pName(killerid));
SendClientMessageToAll( RED, text);
TogglePlayerAllDynamicCPs(killerid, 1);
}
}
if(IsCapturing[killerid][auspro] == 1)
{
if(vehicleid == auspro)
{
DisablePlayerCheckpoint(killerid);
IsCapturing[killerid][auspro] = 0;
format(text, sizeof(text), "%s has failed to capture the Australian Prototype.", pName(killerid));
SendClientMessageToAll( RED, text);
TogglePlayerAllDynamicCPs(killerid, 1);
}
}
if(IsCapturing[killerid][sovpro] == 1)
{
if(vehicleid == sovpro)
{
DisablePlayerCheckpoint(killerid);
IsCapturing[killerid][sovpro] = 0;
format(text, sizeof(text), "%s has failed to capture the Arabian Prototype.", pName(killerid));
SendClientMessageToAll( RED, text);
TogglePlayerAllDynamicCPs(killerid, 1);
}
}
if(IsCapturing[killerid][eurapro] == 1)
{
if(vehicleid == eurapro)
{
DisablePlayerCheckpoint(killerid);
IsCapturing[killerid][eurapro] = 0;
format(text, sizeof(text),"%s has failed to capture the Arabian Prototype.", pName(killerid));
SendClientMessageToAll( RED, text);
TogglePlayerAllDynamicCPs(killerid, 1);
}
}
new Float:P[3]; GetVehiclePos(vehicleid, P[0], P[1], P[2]);
if(P[2] <= 0.4) return true;
new model = GetVehicleModel(vehicleid);
switch(model)
{
case PLANES: return true;
case HELIS: return true;
default:
{
new
ht = random(EFFECT_RANDOM),
xang = random(EFFECT_RANDOM)-EFFECT_FIX_DEFAULT,
yang = random(EFFECT_RANDOM)-EFFECT_FIX_DEFAULT,
zang = random(EFFECT_RANDOM)
;
GetVehiclePos(vehicleid, P[0], P[1], P[2]);
CreateExplosion(P[0], P[1], P[2]+EFFECT_EXPLOSIONOFFSET, EFFECT_EXPLOSIONTYPE, EFFECT_EXPLOSIONRADIUS);
SetVehicleAngularVelocity(vehicleid, xang*EFFECT_MULTIPLIER, yang*EFFECT_MULTIPLIER, zang*EFFECT_FIX_Z);
GetVehicleVelocity(vehicleid, P[0], P[1], P[2]);
SetVehicleVelocity(vehicleid, P[0], P[1], P[2] + (ht*EFFECT_FIX_Z) );
}
}
}
return 1;
}