28.01.2012, 12:22
Hi. I'm adding a lot of code into OnPlayerDeath but when I type /kill in game, im dying but codes are doesn't working :/ By the way I don't use GivePlayerMoney to anything. I made a special cash value for it and players can view their pocket cash with /stats, anyways code here. Any idea about this ?
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[killerid][pKills]+=1; //for stats
PlayerInfo[playerid][pDeaths]+=1; //for stats
new BonusCash = PlayerInfo[playerid][pCash]; // Special cash value, not about GivePlayerMoney.
PlayerInfo[killerid][pCash]+=BonusCash; //player's cash to killer
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash] = 0); // reset dead player's special cash value
INI_Close(File);
new Float:dX, Float:dY, Float:dZ; // cutscene
GetPlayerPos( playerid, dX, dY, dZ );
SetPlayerCameraPos(playerid,dX+8,dY,dZ+2);
SetPlayerCameraLookAt(playerid, dX, dY, dZ);
SendDeathMessage(killerid, playerid, reason);
new string[50];
new deadman[MAX_PLAYER_NAME];
GetPlayerName(playerid, deadman, sizeof(deadman));
format(string, sizeof(string), "You have killed %s", deadman);
GameTextForPlayer(killerid, string, 3000, 1);
new killerman[MAX_PLAYER_NAME];
GetPlayerName(killerid, killerman, sizeof(killerman));
format(string, sizeof(string), "You have been killed by %s", killerman);
GameTextForPlayer(playerid, string, 3000, 1);
return 1;
}