OnPlayerVehicleDeath Problams..
#1

Hey everyone I've got a problam... When my vehicle is on its death it explodes everyone and set everyones health...

heres my code..

Код:
public OnVehicleDeath(vehicleid, killerid)
{
 for(new i = 0; i < MAX_PLAYERS; i++)
	{
		new Float:x, Float:y, Float:z;
		SetPlayerHealth(i, 0.0);
		DestroyVehicle(vehicleid);
		GetPlayerPos(i,x, y, z);
		CreateExplosion(x, y , z, 0, 10);
	}
	return 1;
}
Would this work?

Код:
public OnVehicleDeath(vehicleid, killerid)
{
	new Float:x, Float:y, Float:z;
	SetPlayerHealth(killerid, 0.0);
	DestroyVehicle(vehicleid);
	GetPlayerPos(killerid,x, y, z);
	CreateExplosion(x, y , z, 0, 10);
	return 1;
}
are my loops fucked please help..
Reply
#2

pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
 
        new Float:x, Float:y, Float:z;
        SetPlayerHealth(playerid, 0.0);
        DestroyVehicle(vehicleid);
        GetPlayerPos(playerid,x, y, z);
        CreateExplosion(x, y , z, 0, 10);
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by ikarus❶❸❸❼
pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
 
        new Float:x, Float:y, Float:z;
        SetPlayerHealth(playerid, 0.0);
        DestroyVehicle(vehicleid);
        GetPlayerPos(playerid,x, y, z);
        CreateExplosion(x, y , z, 0, 10);
    }
    return 1;
}
Not working. There is no playerid in the parameters for the function.

If you only want yourself to blow up, you can just get into the car? You could try with the 'killerid' to blow up or go with a playerToPoint() check to see if your player is near the car. Getting the playerid itself, however, is not possible since OnVehicleDeath() does not have a parameter 'playerid'.

Greetings!

ps. Just adding 'playerid' in there is not going to work. It will just get id 0
Reply
#4

Quote:
Originally Posted by ikarus❶❸❸❼
pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
 
        new Float:x, Float:y, Float:z;
        SetPlayerHealth(playerid, 0.0);
        DestroyVehicle(vehicleid);
        GetPlayerPos(playerid,x, y, z);
        CreateExplosion(x, y , z, 0, 10);
    }
    return 1;
}
fail code
Reply
#5

pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
 for(new i = 0; i < MAX_PLAYERS; i++)
    {
       if(GetPlayerVehicleID(i) == vehicleid)
       {
        new Float:x, Float:y, Float:z;
        SetPlayerHealth(i, 0.0);
        DestroyVehicle(vehicleid);
        GetPlayerPos(i,x, y, z);
        CreateExplosion(x, y , z, 0, 10);
       }
    }
    return 1;
}
Untested.
Reply
#6

Quote:
Originally Posted by Teddy™
pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
 for(new i = 0; i < MAX_PLAYERS; i++)
    {
      if(GetPlayerVehicleID(i) == vehicleid)
      {
        new Float:x, Float:y, Float:z;
        SetPlayerHealth(i, 0.0);
        DestroyVehicle(vehicleid);
        GetPlayerPos(i,x, y, z);
        CreateExplosion(x, y , z, 0, 10);
      }
    }
    return 1;
}
Untested.
Hmm i wont bother with that code because loops makes all the players explode and die
Reply
#7

Read the code providen by Teddy carefully, it checks thru all players if they are driving the car that died, if yes, then explode the driver of the player. Never used onvehicledead but it should work
Reply
#8

Quote:
Originally Posted by CueЯvo
Read the code providen by Teddy carefully, it checks thru all players if they are driving the car that died, if yes, then explode the driver of the player. Never used onvehicledead but it should work
Ohh i thought it was my code ill check it after .
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)