08.07.2010, 23:26
(
Последний раз редактировалось Lilcuete; 09.07.2010 в 13:55.
)
Well my problem is that when ever my owned vehicle explodes it is supposed to send a message lets says i have 5 insurance and my car explodes it is supposed to say EX:"You now have 4 insurance left",but sometimes it does and sometimes it doesnt only sends it to id 0 please tell me whats wrong or help me fix this code.
Код:
public OnVehicleDeath(vehicleid)
{
foreach (Player, i)
{
new str[256];
new plname[MAX_PLAYER_NAME];
GetPlayerName(i, plname, sizeof(plname));
new string[64];
if(strcmp(plname, VehicleInfo[vehicleid][vOwner], true) == 0)
{
if(VehicleInfo[vehicleid][vOwned])
{
if(VehicleInfo[vehicleid][vInsurances] >= 1)
{
VehicleInfo[vehicleid][vInsurances]--;
VehicleInfo[vehicleid][vScratch] += 1;
new file[256];
format(file, sizeof(file), "Vehicles/Vehicles/%s.%s.cfg", plname, VehicleNames[GetVehicleModel(vehicleid)-400]);
if(dini_Exists(file))
{
dini_IntSet(file, "Scratches", VehicleInfo[vehicleid][vScratch]);
dini_IntSet(file, "Insurances", VehicleInfo[vehicleid][vInsurances]);
}
DestroyVehicle(vehicleid);
SetVehicleToRespawn(vehicleid);
format(string, sizeof(string), "You have %d insurance left.", VehicleInfo[vehicleid][vInsurances]);
SendClientMessage(i, COLOR_LIGHTRED, string);
format(string, sizeof(string), "You have now %d Scratches in your car.", VehicleInfo[vehicleid][vScratch]);
SendClientMessage(i, COLOR_LIGHTRED, string);
return 1;
}
else
{
if(strfind(plname, VehicleInfo[vehicleid][vOwner], true) == 0)
{
format(string, sizeof(string), "You have 0 insurance left and now your car has been destroyed.");
SendClientMessage(i, COLOR_LIGHTRED, string);
new plname[MAX_PLAYER_NAME];
GetPlayerName(i, plname, sizeof(plname));
format(string, sizeof(string), "Vehicles/Vehicles/%s.%s.cfg", plname, VehicleNames[GetVehicleModel(vehicleid)-400]);
new str[256];
format(str, sizeof(str), "%s.%s.cfg", plname, VehicleNames[GetVehicleModel(vehicleid)-400]);
if(strfind(str, PlayerVehicle[i][pVeh1], true) == 0)
{
DestroyVehicle(vehicleid);
fremove(string);
strmid(PlayerVehicle[i][pVeh1], "None", 0, strlen("None"), 255);
return 1;
}
else if(strfind(str, PlayerVehicle[i][pVeh2], true) == 0)
{
DestroyVehicle(vehicleid);
fremove(string);
strmid(PlayerVehicle[i][pVeh2], "None", 0, strlen("None"), 255);
return 1;
}
else if(strfind(str, PlayerVehicle[i][pVeh3], true) == 0)
{
DestroyVehicle(vehicleid);
fremove(string);
strmid(PlayerVehicle[i][pVeh3], "None", 0, strlen("None"), 255);
return 1;
}
else if(strfind(str, PlayerVehicle[i][pVeh4], true) == 0)
{
DestroyVehicle(vehicleid);
fremove(string);
strmid(PlayerVehicle[i][pVeh4], "None", 0, strlen("None"), 255);
return 1;
}
else if(strfind(str, PlayerVehicle[i][pVeh5], true) == 0)
{
DestroyVehicle(vehicleid);
fremove(string);
strmid(PlayerVehicle[i][pVeh5], "None", 0, strlen("None"), 255);
return 1;
}
}
}
}
}
}
return 1;
}

