Script: HOw player is dead -
SworDDicK - 04.10.2010
Hello I need script thats says to admins how player is dead like:
Will_Cyrustis killed James_Ding with mp5
and
Will_Cyrustis killed by him self with : /kill , falldown
and
Raul_Serrano made driveby on James_Ding
PLS i need this
Re: Script: HOw player is dead -
Sascha - 04.10.2010
do it like:
Код:
OnPlayerDeath(playerid, killerid, reason)
{
new string[200], name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name)); GetPlayerName(killerid, name2, sizeof(name2));
if(reason == 0){
format(string, sizeof(string), "%s Killed %s with Fists", name2, name);
AdminMsg(string); //YOU NEED TO DEFINE THE ADMIN MESSAGE FIRST / REPLACE THIS WITH YOUR ADMINMSG CODE
}
else if(reason == 1){
format(string, sizeof(string), "%s Killed %s with Brass Knuckles", name2, name);
AdminMsg(string);
}else if(reason == 2){
.........
}
etc.
You can get the reason here:
https://sampwiki.blast.hk/wiki/Weapons
(the ID is = the reason)
Re: Script: HOw player is dead -
SworDDicK - 04.10.2010
How you mean
}
else if(reason == 1){
format(string, sizeof(string), "%s Killed %s with Brass Knuckles", name2, name);
AdminMsg(string);
}
else if(reason == 49){
format(string, sizeof(string), "%s Made DB to %s ", name2, name);
AdminMsg(string);
}
else if(reason == 2
{
format(string, sizeof(string), "%s Killed %s with Micro SMG", name2, name);
AdminMsg(string);
I don't understand
AdminMsg(string); //YOU NEED TO DEFINE THE ADMIN MESSAGE FIRST / REPLACE THIS WITH YOUR ADMINMSG CODE
Re: Script: HOw player is dead -
Claude - 04.10.2010
Sascha @ That way is WAY to complicated, it can be done with a few lines:
pawn Код:
new weap[20], string[128], killer, player;
GetWeaponName(reason, weap, sizeof weap);
GetPlayerName(playerid, player, sizeof player);
GetPlayerName(killerid, killer, sizeof killer);
if(killerid != INVALID_PLAYER_ID)
{
format(string, sizeof string, "%s(%d) has killed %s(%d) %s", killer, killerid, player, playerid, weap);
AdminMsg(string);
}
else
{
format(string, sizeof string, "%s(%d) died", player, playerid);
AdminMsg(string);
}
Change "AdminMsg" to the function where it sends a message to admins, the rest you have to do, bugs are easy to fix
Re: Script: HOw player is dead -
SworDDicK - 04.10.2010
AdminMsg I want to send them like
SAY:
Re: Script: HOw player is dead -
Sascha - 04.10.2010
Quote:
Originally Posted by Claude
Sascha @ That way is WAY to complicated, it can be done with a few lines:
pawn Код:
new weap[20], string[128], killer, player; GetWeaponName(reason, weap, sizeof weap); GetPlayerName(playerid, player, sizeof player); GetPlayerName(killerid, killer, sizeof killer); if(killerid != INVALID_PLAYER_ID) { format(string, sizeof string, "%s(%d) has killed %s(%d) %s", killer, killerid, player, playerid, weap); AdminMsg(string); } else { format(string, sizeof string, "%s(%d) died", player, playerid); AdminMsg(string); }
Change "AdminMsg" to the function where it sends a message to admins, the rest you have to do, bugs are easy to fix
|
Well I just didn't know aabout the "GetWeaponName", but nice to see this exists
...
Well sure in this case your methods is ways easier...
@SworDDick:
Код:
forward AdminMsg(text[]);
public AdminMsg(text[])
{
for(new i=0; i<MAX_PLAYERS; i++)
if(IsPlayerConnected(i)){
if(YOURADMINCODE >= THE MIN. LEVEL OF THE PLAYER TO SEE THE MSG){
SendClientMessage(i, YOURCOLORCODE, text[]);
}
}
return 1;
}
and then just that what claude wrote