Problem when a player dies in a vehicle (+1 REP)
#1

I am trying to create a derby gamemode but I have some errors that I can't fix! I want if a player kills another player and both are in a vehicle the killer will hear some sound and will recieve a client message. Any help please? I tried to create something but unluckily doesn't work.

PHP код:
public OnVehicleDeath(vehicleidkillerid)
{
    new 
pVictim[MAX_PLAYER_NAME];
       
GetPlayerName(vehicleid,pVictim,sizeof(pVictim));
        
PlayerPlaySound(killerid11490.00.00.0);
    
DestroyVehicle(vehicleid);
    return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    
SendClientMessage(killerid, -1"{FF6000}[Congratulations]:{FFFFFF} You killed someone!");
    
GameTextForPlayer(playerid"~r~ DEAD!",20003);
        
PlayerPlaySound(killerid11490.00.00.0);
    return 
1;

And don't forget the REP!
Reply
#2

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsPlayerInAnyVehicle(playerid) && IsPlayerInAnyVehicle(killerid)
    {
    	SendClientMessage(killerid, -1, "{FF6000}[Congratulations]:{FFFFFF} You killed someone!");
    	GameTextForPlayer(playerid, "~r~ DEAD!",2000, 3);
        PlayerPlaySound(killerid, 1149, 0.0, 0.0, 0.0);
    }
    return true;
}
Reply
#3

PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    if(
IsPlayerInAnyVehicle(playerid) && IsPlayerInAnyVehicle(killerid))
    {
        
SendClientMessage(killerid, -1"{FF6000}[Congratulations]:{FFFFFF} You killed someone!");
        
GameTextForPlayer(playerid"~r~ DEAD!",20003);
        
PlayerPlaySound(killerid11490.00.00.0);
    }
    return 
1;

@BloodyRP
i just fixed few problems with your code
Reply
#4

Quote:
Originally Posted by xTURBOx
Посмотреть сообщение
PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    if(
IsPlayerInAnyVehicle(playerid) && IsPlayerInAnyVehicle(killerid))
    {
        
SendClientMessage(killerid, -1"{FF6000}[Congratulations]:{FFFFFF} You killed someone!");
        
GameTextForPlayer(playerid"~r~ DEAD!",20003);
        
PlayerPlaySound(killerid11490.00.00.0);
    }
    return 
1;

@BloodyRP
i just fixed few problems with your code
oh, forgot "any" xD, thanks.
Reply
#5

If you want that both are in vehicle, just add a conditional statement which checks both are in vehicle before sending them messages and gametext?
Reply
#6

Quote:
Originally Posted by BloodyRP
Посмотреть сообщение
oh, forgot "any" xD, thanks.
@BloodyRP

I want when I kill someone with drive-by. And exploding his car not killing him.
Reply
#7

Quote:
Originally Posted by ChristolisTV
Посмотреть сообщение
@BloodyRP

I want when I kill someone with drive-by. And exploding his car not killing him.
Quote:
Originally Posted by ChristolisTV
Посмотреть сообщение
I want if a player kills another player and both are in a vehicle the killer will hear some sound and will recieve a client message
Cant understand how u want to kill drive-by when both in a vehicles, but okay:

PHP код:
public OnPlayerDeath(playerid,killerid,reason)
{
    if(
killerid != INVALID_PLAYER_ID)
    {
        if(
GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
        {
            
SendClientMessage(killerid, -1"{FF6000}[Congratulations]:{FFFFFF} You killed someone!");
            
GameTextForPlayer(playerid"~r~ DEAD!",20003);
            
PlayerPlaySound(killerid11490.00.00.0);
            if(
IsPlayerInAnyVehicle(playerid)) DestroyVehicle(GetPlayerVehicleID(playerid));
        }
    }
    return 
true;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)