[UNSOLVED]OnVehicleDeath not working good. -
Lilcuete - 18.03.2010
For some reason, I think my OnVehicleDeath isn't called. Nothing happens if I destroy those vehicles. Here's the code:
Код:
public OnVehicleDeath(vehicleid,killerid)
{
new playerid;
new vehicleid = GetPlayerVehicleID(killerid);
new str[256];
//new vehi = GetPlayerVehicleID(killerid);
if(IsVehicleSpawned(vehicleid))
{
if (VehicleInfo[vehicleid][vInsurances] == 0)
{
if(strfind(str,PlayerVehicle[killerid][pVeh1], true) == 0)
{
DestroyVehicle(vehicleid);
fremove(string);
strmid(PlayerVehicle[killerid][pVeh1], "None", 0, strlen("None"), 255);
return 1;
}
else if(strcmp(str, PlayerVehicle[killerid][pVeh2], true) == 0)
{
DestroyVehicle(vehicleid);
fremove(string);
strmid(PlayerVehicle[killerid][pVeh2], "None", 0, strlen("None"), 255);
return 1;
}
else if(strcmp(str, PlayerVehicle[killerid][pVeh3], true) == 0)
{
DestroyVehicle(vehicleid);
fremove(string);
strmid(PlayerVehicle[killerid][pVeh3], "None", 0, strlen("None"), 255);
return 1;
}
else if(strcmp(str, PlayerVehicle[killerid][pVeh4], true) == 0)
{
DestroyVehicle(vehicleid);
fremove(string);
strmid(PlayerVehicle[killerid][pVeh4], "None", 0, strlen("None"), 255);
return 1;
}
else if(strcmp(str, PlayerVehicle[killerid][pVeh5], true) == 0)
{
DestroyVehicle(vehicleid);
fremove(string);
strmid(PlayerVehicle[killerid][pVeh5], "None", 0, strlen("None"), 255);
return 1;
}
else
{
VehicleInfo[vehicleid][vInsurances] -= 1;
SaveVehicles(killerid, vehicleid);
format(string, sizeof(string), "You have %d insurance left",VehicleInfo[vehicleid][vInsurances]);
SendClientMessage(killerid, COLOR_LIGHTRED, string);
}
return 1;
{
return 0;
}
}
}
}
Re: [HELP]OnVehicleDeath not working good. -
Backwardsman97 - 18.03.2010
The main reason why it isn't working is because you have IsVehicleSpawned at the very beginning. None of it will get called because obviously the car isn't spawned if it called OnVehicleDEATH.
Re: [HELP]OnVehicleDeath not working good. -
Lilcuete - 18.03.2010
lol im sorry but i took it out and still don't work
Re: [UNSOLVED]OnVehicleDeath not working good. -
Lilcuete - 18.03.2010
Re: [HELP]OnVehicleDeath not working good. -
Lilcuete - 19.03.2010
BUMPED
Re: [HELP]OnVehicleDeath not working good. -
Joe Staff - 19.03.2010
'playerid' is never used.
pawn Код:
GetPlayerVehicleID(killerid);
Just because a player "killed" a vehicle, doesn't mean that vehicle belongs to that player, someone else could have "killed" the vehicle.
pawn Код:
new vehicleid = GetPlayerVehicleID(killerid);
VehicleID already exists.
pawn Код:
strfind(str,PlayerVehicle[killerid][pVeh1], true)
The variable, 'str' doesn't have anything on it, it's blank.
Re: [HELP]OnVehicleDeath not working good. -
Lilcuete - 19.03.2010
Edited:Still doesn't work
Re: [HELP]OnVehicleDeath not working good. -
Lilcuete - 19.03.2010
anyone??
Re: [HELP]OnVehicleDeath not working good. -
Lilcuete - 20.03.2010
Re: [UNSOLVED]OnVehicleDeath not working good. -
Lilcuete - 20.03.2010
BUMP