31.07.2009, 16:51
Hi i made code that says when you kill someone "You have killed [NAME]" //right
And when somebody will kill you it will say "[Name] Has just killed you" //right
But when you type /kill (suicide). then it will say "[Yourname] has just killed you" //wrong
Lets say tturvas types /kill then it will say "tturvas has just killed you". //wrong
and the /kill command
Can somebody write code here so if player will type /kill than it will say "You have just killed yourself"
And when somebody will kill you it will say "[Name] Has just killed you" //right
But when you type /kill (suicide). then it will say "[Yourname] has just killed you" //wrong
Lets say tturvas types /kill then it will say "tturvas has just killed you". //wrong
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
new string[256];
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername,sizeof(playername));
//killer
GetPlayerName(playerid, playername,sizeof(playername));
format(string, sizeof(string), "You have killed %s", playername);
SendClientMessage(killerid,0xAA3333AA,string);
GivePlayerMoney(killerid,1000);
SetPlayerScore(killerid,1);
SetPlayerColor(killerid,red);
//victim
GetPlayerName(killerid, playername,sizeof(playername));
format(string, sizeof(string), "%s has just killed you", playername);
SendClientMessage(playerid,0xAA3333AA,string);
GivePlayerMoney(playerid,-1000);
SetPlayerScore(playerid,-1);
SetPlayerColor(playerid,ugly_yellow);
return 1;
}
Код:
if (strcmp("/kill", cmdtext, true, 10) == 0)
{
SetPlayerHealth(playerid,0);
return 1;
}

