How to kick a player if he kills a player? -
[EDT]AmanSingh123 - 23.08.2011
hey..
how do i make a script that when ever a player kills another player he gets a automatic kick and also it send all a message in chat box saying player has been kicked because of death-match and stuff you know

help much appreciated..
Re: How to kick a player if he kills a player? -
Wesley221 - 23.08.2011
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
SendClientMessage(killerid, -1, "You have been kicked because you killed someone. ");
Kick(killerid);
return 1;
}
This is a quick example. Change it to the way you want
Re: How to kick a player if he kills a player? -
Tigerbeast11 - 23.08.2011
Put this under OnPlayerDeath:
pawn Code:
new string[256];
new name[24];
GetPlayerName(killerid,name,24);
format(string,256,"%s has been kicked from the server for: Killing someone",name);
SendClientMessageToAll(-1,string);
Kick(killerid);
Re: How to kick a player if he kills a player? -
Amit_B - 23.08.2011
Or with the message you asked (did you mean't to send it to everyone?):
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
new str[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(str, sizeof(str), " * %s has been kicked for killing someone", name);
SendClientMessageToAll(0xFF0000FF, str);
Kick(killerid);
return 1;
}
Edit: Sorry, just replied at the same time of the reply above :S
The code above is good, but it's recommended to decrease the cells count of the string.
Re: How to kick a player if he kills a player? -
[EDT]AmanSingh123 - 23.08.2011
1 bug, when i do /kill it says "has been kick for killing someone" :S
Re: How to kick a player if he kills a player? -
Tigerbeast11 - 23.08.2011
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID)
{
new str[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(str, sizeof(str), " * %s has been kicked for killing someone", name);
SendClientMessageToAll(0xFF0000FF, str);
Kick(killerid);
}
return 1;
}
Try that, I'm not sure though
Re: How to kick a player if he kills a player? -
[EDT]AmanSingh123 - 23.08.2011
bug again, /kill bug fixed

..
..but when i kill the messege displayed says the the guy killed name not the killers name
Re: How to kick a player if he kills a player? -
Wesley221 - 23.08.2011
Thats because you get your own name.
pawn Code:
GetPlayerName(killerid, name, sizeof(name));
You could have fixed it yourself i you just took a look at the code
Re: How to kick a player if he kills a player? -
[EDT]AmanSingh123 - 23.08.2011
oops didnt see that, silly mistake..
also found another bug, if a player punches me and then i do /kill he gets kicked :/
Re: How to kick a player if he kills a player? -
Pinguinn - 23.08.2011
Well I do have a fix for that, but then you can kill someone if you punch someting to death.
Does it bother if that happens?
Re: How to kick a player if he kills a player? -
[EDT]AmanSingh123 - 23.08.2011
Quote:
Originally Posted by Pinguinn
Well I do have a fix for that, but then you can kill someone if you punch someting to death.
Does it bother if that happens?
|
not at all, atleast they will get kick if they kill with guns
Re: How to kick a player if he kills a player? -
Pinguinn - 23.08.2011
I simply added a deathreason check. 0 = unarmed, '>' = anything above
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
if(reason > 0 && killerid != INVALID_PLAYER_ID)
{
new str[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(str, sizeof(str), " * %s has been kicked for killing someone", name);
SendClientMessageToAll(0xFF0000FF, str);
Kick(killerid);
}
return 1;
}
Re: How to kick a player if he kills a player? -
emokidx - 23.08.2011
what about to add " >= " instead of your " > " ?
simple
pawn Code:
if(reason >= 0 && killerid != // rest is same....
will that work?
Re: How to kick a player if he kills a player? -
Pinguinn - 23.08.2011
'>=' means equal and anything above
That means that reason '
0' also counts.
And reason '
0' = unarmed/fist
Re: How to kick a player if he kills a player? -
emokidx - 23.08.2011
so people will not be able to kill even with fists
isnt that what he wants?
EDIT: i very well know what that is used for
Re: How to kick a player if he kills a player? -
Pinguinn - 23.08.2011
Quote:
Originally Posted by emokidx111
so people will not be able to kill even with fists
isnt that what he wants?
EDIT: i very well know what that is used for
|
People might use /kill to get the other player kicked
Quote:
Originally Posted by [EDT]AmanSingh123
not at all, atleast they will get kick if they kill with guns 
|