27.12.2013, 18:45
Hey guys when a players owned vehicles is destoryed it should send a message to the owners if he or she is online and playing.
Note: new ownerid = GetPlayerIDFromName(AddUnderScoreToName(VehicleInf o[slot][vOwnerName])); - is working correctly a returns a slot id and the correct slot, so no questions asking if it is working or not.
Note: new ownerid = GetPlayerIDFromName(AddUnderScoreToName(VehicleInf o[slot][vOwnerName])); - is working correctly a returns a slot id and the correct slot, so no questions asking if it is working or not.
pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
new slot = GetVehicleSlotFromID(vehicleid);
if(slot > -1)
{
new ownerid = GetPlayerIDFromName(AddUnderScoreToName(VehicleInfo[slot][vOwnerName]));
if(ownerid > -1)
{
if(IsPlayerConnected(ownerid))
{
if(VehicleInfo[slot][vInsurance] > 0)
{
VehicleInfo[slot][vInsurance] --;
VehicleInfo[slot][vDestroyed] ++;
VehicleInfo[slot][vImpounded] = 1;
} else {
SendClientMessage(ownerid, 0xFFFFFFFF, "[{33CCFF}INFO{FFFFFF}]: I'm sorry to inform you that you don't have any insurace to cover your vehicles destoruction, and it has been impounded until you can retrive it.");
}
}
}
}
return true;
}