SA-MP Forums Archive
Kill reason to player something.... ? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Kill reason to player something.... ? (/showthread.php?tid=78295)



Kill reason to player something.... ? - Divine - 18.05.2009

Yo guys...
I was wondering...
Can any one tell me how to do like this:

Divine Shoots a Newbie with ak47 ...
Newbie gets a personal message that he was show with ak47...
Newbie shoos Divine with deagle ...
Divine gets a personal message that he was killed with deagle...
killer name is not needed :P
...
well you get the point ^^ ... cus i dont wanna use the deathlist witch is ... ehhh.... the "f9" button list ^^ :P
...
P.S. ..
What does SetPlayerBadWeapons, or something like that do ? and how to use it ?
....
THNX in advance


Re: Kill reason to player something.... ? - OmeRinG - 18.05.2009

pawn Код:
//This goes in the bottom of the script
stock GetWeaponNameFromReason(reason) {
    new weapons[][] = {
        "Unarmed", "Brass Knuckles", "Golf Club","Nite Stick", "Knife", "Baseball Bat", "Shovel",
        "Pool Cue", "Katana", "Chainsaw", "Purple Dildo", "Small White Vibrator", "Large White Vibrator", "Silver Vibrator",
        "Flowers", "Cane", "Grenade", "Tear Gas", "Molotov Cocktail", "Vehicle Missile", "Hydra Flare", "Jetpack", "9mm",
        "Silenced 9mm", "Desert Eagle", "Shotgun", "Sawnoff Shotgun", "Combat Shotgun", "Micro SMG (Uzi)", "SMG (MP5)", "AK47", "M4",
        "Tec9", "Country Rifle", "Sniper Rifle", "Rocket Launcher", "Heatseeker rocket launcher", "Flamethrower", "Minigun", "Satchel Charge",
        "Detonator", "Spraycan", "Fire Extinguisher", "Camera", "Nightvision Goggles", "Infrared Vision", "Parachute", "Fake Pistol",
        "Vehicle", "Helicopter Blades", "Explosion", "Drowned", "Collision" };
    new wn[50];
    format(wn,sizeof(wn),"%s",weapons[reason]);
    return wn;
}
//This goes in OnPlayerDeath:
public OnPlayerDeath(playerid, killerid, reason)
{
    new string[100];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(killerid,name,sizeof(name));
    format(string,sizeof(string),"%s (ID: %d) has killed you with a %s.", name, killerid, GetWeaponNameFromReason(reason));
    SendClientMessage(playerid,0xff000000,string);
    return 1;
}
OK it's tested and it works great... say a big thanks for that because it wasn't premade I made it for you...


Re: Kill reason to player something.... ? - Weirdosport - 18.05.2009

What happens when the player commits suicide?


Re: Kill reason to player something.... ? - Divine - 19.05.2009

Would this work?
pawn Код:
OnPlayerDeath(playerid, killerid, reason){
{
if (reason == minigun);
sendclientmessage(playerid, orange, "N00b pwned with minigun!");
}
{
if (reason == fist);
sendclientmessage(playerid, red, "OMF YOU NOOB");
You get what I mean ? ... but can any one help me with it ?
and what does Set Player Bad Weapons thingy do ? and how I use it ?



Re: Kill reason to player something.... ? - MenaceX^ - 19.05.2009

Quote:
Originally Posted by OmeRinG
pawn Код:
//This goes in the bottom of the script
stock GetWeaponNameFromReason(reason) {
    new weapons[][] = {
        "Unarmed", "Brass Knuckles", "Golf Club","Nite Stick", "Knife", "Baseball Bat", "Shovel",
        "Pool Cue", "Katana", "Chainsaw", "Purple Dildo", "Small White Vibrator", "Large White Vibrator", "Silver Vibrator",
        "Flowers", "Cane", "Grenade", "Tear Gas", "Molotov Cocktail", "Vehicle Missile", "Hydra Flare", "Jetpack", "9mm",
        "Silenced 9mm", "Desert Eagle", "Shotgun", "Sawnoff Shotgun", "Combat Shotgun", "Micro SMG (Uzi)", "SMG (MP5)", "AK47", "M4",
        "Tec9", "Country Rifle", "Sniper Rifle", "Rocket Launcher", "Heatseeker rocket launcher", "Flamethrower", "Minigun", "Satchel Charge",
        "Detonator", "Spraycan", "Fire Extinguisher", "Camera", "Nightvision Goggles", "Infrared Vision", "Parachute", "Fake Pistol",
        "Vehicle", "Helicopter Blades", "Explosion", "Drowned", "Collision" };
    new wn[50];
    format(wn,sizeof(wn),"%s",weapons[reason]);
    return wn;
}
//This goes in OnPlayerDeath:
public OnPlayerDeath(playerid, killerid, reason)
{
    new string[100];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(killerid,name,sizeof(name));
    format(string,sizeof(string),"%s (ID: %d) has killed you with a %s.", name, killerid, GetWeaponNameFromReason(reason));
    SendClientMessage(playerid,0xff000000,string);
    return 1;
}
OK it's tested and it works great... say a big thanks for that because it wasn't premade I made it for you...
So wasted..
pawn Код:
//In OnPlayerDeath callback.
new string[32];
GetWeaponName(reason,string,sizeof(string));
format(string,sizeof(string),"%d was killed by %d (weapon: %s)",playerid,killerid,string);
//Then send it to who ever you want..
SendClientMessageToAll(color,string); //for example.



Re: Kill reason to player something.... ? - Divine - 19.05.2009

ok thnx for help guys
I think I got it now


Re: Kill reason to player something.... ? - OmeRinG - 19.05.2009

Quote:
Originally Posted by MenaceX^
Quote:
Originally Posted by OmeRinG
pawn Код:
//This goes in the bottom of the script
stock GetWeaponNameFromReason(reason) {
    new weapons[][] = {
        "Unarmed", "Brass Knuckles", "Golf Club","Nite Stick", "Knife", "Baseball Bat", "Shovel",
        "Pool Cue", "Katana", "Chainsaw", "Purple Dildo", "Small White Vibrator", "Large White Vibrator", "Silver Vibrator",
        "Flowers", "Cane", "Grenade", "Tear Gas", "Molotov Cocktail", "Vehicle Missile", "Hydra Flare", "Jetpack", "9mm",
        "Silenced 9mm", "Desert Eagle", "Shotgun", "Sawnoff Shotgun", "Combat Shotgun", "Micro SMG (Uzi)", "SMG (MP5)", "AK47", "M4",
        "Tec9", "Country Rifle", "Sniper Rifle", "Rocket Launcher", "Heatseeker rocket launcher", "Flamethrower", "Minigun", "Satchel Charge",
        "Detonator", "Spraycan", "Fire Extinguisher", "Camera", "Nightvision Goggles", "Infrared Vision", "Parachute", "Fake Pistol",
        "Vehicle", "Helicopter Blades", "Explosion", "Drowned", "Collision" };
    new wn[50];
    format(wn,sizeof(wn),"%s",weapons[reason]);
    return wn;
}
//This goes in OnPlayerDeath:
public OnPlayerDeath(playerid, killerid, reason)
{
    new string[100];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(killerid,name,sizeof(name));
    format(string,sizeof(string),"%s (ID: %d) has killed you with a %s.", name, killerid, GetWeaponNameFromReason(reason));
    SendClientMessage(playerid,0xff000000,string);
    return 1;
}
OK it's tested and it works great... say a big thanks for that because it wasn't premade I made it for you...
So wasted..
pawn Код:
//In OnPlayerDeath callback.
new string[32];
GetWeaponName(reason,string,sizeof(string));
format(string,sizeof(string),"%d was killed by %d (weapon: %s)",playerid,killerid,string);
//Then send it to who ever you want..
SendClientMessageToAll(color,string); //for example.
OUCH :S
didn't know it existed...