15.10.2010, 10:47
How do I make player loose money and score when he teamkill. This is my Teams code.
and so
as you can see, i've set to get 1 score for killing an enemy, how can I make loose score for killing teammate, because SetPlayerTeam is bugged sometimes ?
pawn Код:
public OnPlayerSpawn(playerid)
{
if(gTeam[playerid] == TEAM_ARMY) {
SetPlayerInterior(playerid, 0);
SPP(playerid, 1553.3546, -1675.4446, 16.1953);
GPW(playerid, 26, 100);
GPW(playerid, 29, 500);
GPW(playerid, 30, 300);
SetPlayerTeam(playerid, 0);
SetPlayerColor(playerid, COLOR_BLUE);
}
if(gTeam[playerid] == TEAM_LSPD) {
SetPlayerInterior(playerid, 0);
SPP(playerid, 116.6943, 1933.8201, 18.9704);
GPW(playerid, 27, 100);
GPW(playerid, 31, 300);
GPW(playerid, 35, 2);
SetPlayerTeam(playerid, 1);
SetPlayerColor(playerid, COLOR_GREY);
} // etc etc
pawn Код:
SetPlayerTeamFromClass(playerid, classid)
{
if(classid == 0)
{
gTeam[playerid] = TEAM_ARMY;
GameTextForPlayer(playerid,"Los Santos Police Department",999999,6);
}
else if(classid == 1)
{
gTeam[playerid] = TEAM_LSPD;
GameTextForPlayer(playerid,"Army",999999,6);
}
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
//This is actually OnPlayerKill
SetPlayerDrunkLevel(playerid, 0);
SCM(killerid,COLOR_GREEN, "You have killed someone, you got +$1000 and 1 Score!");// You can replace "someone" with string
GPM(killerid,1000);
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
// This is actually OnPlayerDeath
SCM(playerid,COLOR_BRIGHTRED, "You died, you lost $500");
GPM(playerid,-500);
PlayerInfo[playerid][AdminLevel] = 0;
if(killerid == INVALID_PLAYER_ID)
{
SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
}
else
{
SendDeathMessage(killerid,playerid,reason);
}
SCM(playerid, COLOR_YELLOW, "You got PWNED");
}