OnVehicleDeath - how can I do? - 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)
+--- Thread: OnVehicleDeath - how can I do? (
/showthread.php?tid=572853)
OnVehicleDeath - how can I do? -
DarkLouis - 02.05.2015
Hi. I created my vehicle system that is totally different with SA:MP's vehicles. In fact, I never use vehicleid. I have a problem. I want to set that if a vehicle death, it set to him a variable that say that it is dead. When it respawn it set a total of health.
The problem is: id = ?
"VicinoVeicolo" = IsPlayerNearVehicle -> return id;
"InVeicolo" = IsPlayerInVehicle -> return id;
but don't work neither of both.
PHP код:
public OnVehicleDeath(vehicleid, killerid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
//new id = VicinoVeicolo(i);
//new id = InVeicolo(i);
if(Veicolo[id][Creato] == 1)
{
if(Veicolo[id][Acquistato] == 1)
Veicolo[id][Distrutto] = 1;
else Veicolo[id][Distrutto] = 0;
}
}
return 1;
}
Re: OnVehicleDeath - how can I do? -
Mencent - 02.05.2015
Hello!
Why you use a loop? You have the parameter "vehicleid".
PHP код:
public OnVehicleDeath(vehicleid,killerid)
{
if(Veicolo[vehicleid][Creato] == 1)
{
if(Veicolo[vehicleid][Acquistato] == 1)Veicolo[vehicleid][Distrutto] = 1;
else Veicolo[vehicleid][Distrutto] = 0;
}
return 1;
}
I don't know wheather you want it so.
Re: OnVehicleDeath - how can I do? -
sammp - 02.05.2015
Код:
public OnVehicleDeath(vehicleid, killerid)
{
if(Veicolo[vehicleid][Acquistato] == 1) { Veicolo[vehicleid][Distrutto] = 1; }
else Veicolo[id][Distrutto] = 0;
return 1;
}
// Basic template- guy above me bet me to it, use his example
Re: OnVehicleDeath - how can I do? -
DarkLouis - 02.05.2015
Example: VEHICLEID in GAME = 5; ID of script = 1; So Vehicleid isn't ID.
Re: OnVehicleDeath - how can I do? -
Mencent - 02.05.2015
I do not know your system, but try this:
PHP код:
public OnVehicleDeath(vehicleid,killerid)
{
//new id = VicinoVeicolo(killerid);
//new id = InVeicolo(killerid);
if(Veicolo[id][Creato] == 1)
{
if(Veicolo[id][Acquistato] == 1)Veicolo[id][Distrutto] = 1;
else Veicolo[id][Distrutto] = 0;
}
return 1;
}
killerid is the id who killed the vehicle.
Re: OnVehicleDeath - how can I do? -
DarkLouis - 02.05.2015
EDIT
Re: OnVehicleDeath - how can I do? -
DarkLouis - 02.05.2015
After a lot of time, I created a function that will work. Thank you...