SA-MP Forums Archive
Carbomb system help. - 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: Carbomb system help. (/showthread.php?tid=606669)



Carbomb system help. - Ritzy2K - 07.05.2016

I've made a carbomb system, it works fine but the issue is whenever the player dies through carbomb. The death reason is explosion, how do I show the death reason as carbomb and show the killer ID as the player who bombed him?


Re: Carbomb system help. - jamesbond007 - 07.05.2016

pawn Код:
//OnPlayerDeath
if(killerid == INVALID_PLAYER_ID)
{
    if(reason == 51) // explosion
    {
        //format(str,sizeof(str),"%d died from a carbomb set off by %d", playerid, carbomber[vehicleid]);
        //SendClientMessageToAll(-1, str);
        return 1;
    }
}
something like that i suppose, depending how u implemented the carbomb system u need to save the player id who set it


u probably cant use GetPlayerVehicleID when the player has died already so maybe set it every time he enters a vehicle


Re: Carbomb system help. - Dayrion - 07.05.2016

Quote:
Originally Posted by jamesbond007
Посмотреть сообщение
pawn Код:
//OnPlayerDeath
if(killerid == INVALID_PLAYER_ID)
{
    if(reason == 51) // explosion
    {
        //format(str,sizeof(str),"%d died from a carbomb set off by %d", playerid, carbomber[vehicleid]);
        //SendClientMessageToAll(-1, str);
        return 1;
    }
}
something like that i suppose, depending how u implemented the carbomb system u need to save the player id who set it


u probably cant use GetVehicleID when the player has died already so maybe set it every time he enters a vehicle
I don't think that's he wants and when you die by explosion in a car the reason is ID 54 (tested).

Anyway, you need to stock the playerid who planted the bomb in the vehicle.
PHP код:
    if(killerid == INVALID_PLAYER_ID)
    {
        if(
reason == 54// explosion
        
{
            
SendDeathMessage(playerPlantedBombplayerid51);
            return 
1;
        }
    } 
This is working for 1 bomb.


Re: Carbomb system help. - jamesbond007 - 08.05.2016

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
I don't think that's he wants and when you die by explosion in a car the reason is ID 54 (tested).

Anyway, you need to stock the playerid who planted the bomb in the vehicle.
PHP код:
    if(killerid == INVALID_PLAYER_ID)
    {
        if(
reason == 54// explosion
        
{
            
SendDeathMessage(playerPlantedBombplayerid51);
            return 
1;
        }
    } 
This is working for 1 bomb.
well i just looked it up on wiki .. https://sampwiki.blast.hk/wiki/Weapons

says explosion is 51 .. either its a typo or something is wrong


Re: Carbomb system help. - Logic_ - 08.05.2016

Its easy.

PHP код:
//OnPlayerDeath 
if(killerid != INVALID_PLAYER_ID)
{
    if(
reason == 51// explosion
    
{
        if(
/*use a variable that stores the vehicle id that is bombed*/)
        {
            if(
/*use a variable to detect the person who attached the car bomb*/)
            {
                
//format the message
                //send it
                //etc stuff below and beyond 
            
}
        }
    }
    return 
1;