SA-MP Forums Archive
OnVehicleDeath Problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnVehicleDeath Problem (/showthread.php?tid=103991)



OnVehicleDeath Problem - Jakku - 22.10.2009

Why my OnVehicleDeath doesn't work? Nothing appears when that vehicle destroys:

pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{

    if(vehicleid == BuyInfernus)
    {
    SendClientMessage(killerid,COLOR_ELGGREEN, "Your Infernus has been destroyed!");
    OwningInfernus[killerid] = 0;
    }
    else if(vehicleid == BuySavanna)
    {
    SendClientMessage(killerid,COLOR_ELGGREEN, "Your Savanna has been destroyed!");
    OwningSavanna[killerid] = 0;
    }
    else if(vehicleid == BuyManana)
    {
    SendClientMessage(killerid,COLOR_ELGGREEN, "Your Manana has been destroyed!");
    OwningManana[killerid] = 0;
    }
    else if(vehicleid == BuyHuntley)
    {
    SendClientMessage(killerid,COLOR_ELGGREEN, "Your Huntley has been destroyed!");
    OwningHuntley[killerid] = 0;
    }
    if(vehicleid == BuySultan)
    {
    SendClientMessage(killerid,COLOR_ELGGREEN, "Your Sultan has been destroyed!");
    OwningSultan[killerid] = 0;
    }
  return 1;
}



Re: OnVehicleDeath Problem - dice7 - 22.10.2009

Not tested, but I think that the killerid is the one which destroyed the car and if you rolled yourself on the roof to make it burn, it will be INVALID_PLAYER_ID


Re: OnVehicleDeath Problem - Jakku - 22.10.2009

Quote:
Originally Posted by dice7
Not tested, but I think that the killerid is the one which destroyed the car and if you rolled yourself on the roof to make it burn, it will be INVALID_PLAYER_ID
Thanks, I'll try it

EDIT: It didnt work :S


Re: OnVehicleDeath Problem - Pawno_Master - 22.10.2009

OnVehicleDeath just doesn't work in pawno


Re: OnVehicleDeath Problem - Peter_Corneile - 22.10.2009

Quote:
Originally Posted by ekeleke
OnVehicleDeath just doesn't work in pawno
I dont think so (Correct me if i am wrong)


Re: OnVehicleDeath Problem - dice7 - 22.10.2009

Debug the 'killerid' variable to check if it's the same as your playerid. If not, then you'll need a new system


Re: OnVehicleDeath Problem - Jakku - 23.10.2009

Quote:
Originally Posted by ekeleke
OnVehicleDeath just doesn't work in pawno
Why shouldn't it work? Why the callback is made then?


Re: OnVehicleDeath Problem - Correlli - 23.10.2009

Quote:
Originally Posted by ekeleke
OnVehicleDeath just doesn't work in pawno
This callback was broken in 0.1 version, but it works in 0.2 and 0.3 just fine.


Re: OnVehicleDeath Problem - Finn - 23.10.2009

if(vehicleid == BuyInfernus)

What's BuyInfernus?


Re: OnVehicleDeath Problem - Correlli - 23.10.2009

Quote:
Originally Posted by Finn
if(vehicleid == BuyInfernus)

What's BuyInfernus?
It's an vehicle defined to a BuyInfernus variable.

Example:
pawn Код:
new
    BuyInfernus;

public OnGameModeInit()
{
  BuyInfernus = AddStaticVehicle(model_ID, xPos, yPos, zPos, angle, primary_color_ID, secondary_color_ID);
  return 1;
}