SA-MP Forums Archive
playerid in OnVehicleDeath - 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: playerid in OnVehicleDeath (/showthread.php?tid=613444)



playerid in OnVehicleDeath - OKOK - 27.07.2016

I want to kill the vehicle only in Deathm. But only vehicleid, killerid params are valid.

Код HTML:
if(GetPVarInt(playerid,"Deathm"))
	{
		DestroyVehicle(vehicleid);
	}
Код:
public OnVehicleDeath( vehicleid, killerid )
{
	if(GetPVarInt(playerid,"Deathm"))
	{
		DestroyVehicle(vehicleid);
	}
	
    return ( 1 );
}



Re: playerid in OnVehicleDeath - AlexPalermitano97 - 27.07.2016

new vehicleid = GetPlayerVehicleId(playerid)


Re: playerid in OnVehicleDeath - OKOK - 27.07.2016

Hmm.. This one im talking about

Код HTML:
if(GetPVarInt(playerid,"Deathm"))



Re: playerid in OnVehicleDeath - Deadpoop - 27.07.2016

PHP код:
public OnVehicleDeathvehicleidkillerid )
{
    if(
GetPVarInt(playerid,"Deathm"))
    {
        
DestroyVehicle(GetPlayerVehicleID(playerid));
    }
    
    return 
1;

and i would suggest you to use arrays not pvars arrays use less memory and faster!


Re: playerid in OnVehicleDeath - OKOK - 27.07.2016

Quote:
Originally Posted by Deadpoop
Посмотреть сообщение
PHP код:
public OnVehicleDeathvehicleidkillerid )
{
    if(
GetPVarInt(playerid,"Deathm"))
    {
        
DestroyVehicle(GetPlayerVehicleID(playerid));
    }
    
    return 
1;

and i would suggest you to use arrays not pvars arrays use less memory and faster!
Thanks but error.

Код HTML:
error 017: undefined symbol "playerid"
error 017: undefined symbol "playerid"
the parameters
public OnVehicleDeath( vehicleid, killerid )


Re: playerid in OnVehicleDeath - Konstantinos - 27.07.2016

Quote:
Originally Posted by OKOK
Посмотреть сообщение
I want to kill the vehicle only in Deathm. But only vehicleid, killerid params are valid.

Код HTML:
if(GetPVarInt(playerid,"Deathm"))
	{
		DestroyVehicle(vehicleid);
	}
Код:
public OnVehicleDeath( vehicleid, killerid )
{
	if(GetPVarInt(playerid,"Deathm"))
	{
		DestroyVehicle(vehicleid);
	}
	
    return ( 1 );
}
Replace "playerid" with "killerid". I'll also agree about arrays as well.


Re: playerid in OnVehicleDeath - Deadpoop - 27.07.2016

then do it onplayerdeath

PHP код:
public OnPlayerDeath(playeridkillerid)
{
    if(
GetPVarInt(playerid,"Deathm"))
    {
        if(
IsPlayerInAnyVehicle(playerid))
        {
            
DestroyVehicle(GetPlayerVehicleID(playerid));
   }
   return 
1;




Re: playerid in OnVehicleDeath - Deadpoop - 27.07.2016

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Replace "playerid" with "killerid". I'll also agree about arrays as well.
That will destroy the vehicle of the killer not the one that died!


Re: playerid in OnVehicleDeath - OKOK - 27.07.2016

Quote:
Originally Posted by Deadpoop
Посмотреть сообщение
then do it onplayerdeath

PHP код:
public OnPlayerDeath(playeridkillerid)
{
    if(
GetPVarInt(playerid,"Deathm"))
    {
        if(
IsPlayerInAnyVehicle(playerid))
        {
            
DestroyVehicle(GetPlayerVehicleID(playerid));
   }
   return 
1;

lol clever

but i'm worrying if player a player jumps off the car. he is not in a vehicle anymore that time. but I think i'll use this for now. thanks tho.

if anyone can maneuver playerid on onvehicledeath then that would be cool! lol


Re: playerid in OnVehicleDeath - MerryDeer - 28.07.2016

Код:
public OnVehicleDeath(vehicleid, killerid) 
{ 
     foreach(new i : Player)
     {
          if(GetPVarInt(i,"Deathm")) 
         { 
        
                    DestroyVehicle(vehicleid); 
break;
              
         }
    } 
    return 1; 
}