[URGENT]Help me guys! -
Zhoom - 21.01.2012
Help me guys, it doesn't works if the players has died by falling. It works only if the players has been killed. So this is the script:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, killerid);
if(gTeam[playerid] == TEAM_RED) RedCount--;
if(gTeam[playerid] == TEAM_GREEN) GreenCount--;
PlayerInfo[playerid][Latezor] = 1;
new tmp[256];
new tmp2[256];
format(tmp, sizeof(tmp), "~r~%d", RedCount);
TextDrawSetString(Text:Textdraw13, tmp);
format(tmp2, sizeof(tmp2), "~g~%d", GreenCount);
TextDrawSetString(Text:Textdraw14, tmp2);
return 1;
}
Is there any possible way to make it works?
Thanks!
Re: [URGENT]Help me guys! -
wildcookie007 - 21.01.2012
If I understand your problem right, try these things:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new tmp[256];
new tmp2[256];
if(gTeam[playerid] == TEAM_RED) { RedCount--;
format(tmp, sizeof(tmp), "~r~%d", RedCount);
TextDrawSetString(Text:Textdraw13, tmp);
}
if(gTeam[playerid] == TEAM_GREEN) { GreenCount--;
format(tmp2, sizeof(tmp2), "~g~%d", GreenCount);
TextDrawSetString(Text:Textdraw14, tmp2);
}
if(killerid != INVALID_PLAYER_ID) {
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, killerid);
PlayerInfo[playerid][Latezor] = 1;
}
return 1;
}
Fixed your bug of spectating invalid player id, and I guess the falling thing should work. If it doesn't, after closing bracket of if(killerid != INVALID_PLAYER_ID) add else { code of count-- and textdrawstring.
EDIT: Also, if you want to spectate random player when player died himself, use a loop and then spectateplayer
Re: [URGENT]Help me guys! -
Zhoom - 21.01.2012
oh thanks for that!
But my main problem is when I fell and died, the textdraw doesnt changes.. but when my friend has killed me, it changes(-1). help me with this thing please
Re: [URGENT]Help me guys! -
Universal - 21.01.2012
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new
str[7];
if(gTeam[playerid] == TEAM_RED)
{
RedCount--;
format(str, sizeof(str), "~r~%d", RedCount);
TextDrawSetString(Textdraw13, str);
}
else if(gTeam[playerid] == TEAM_GREEN)
{
GreenCount--;
format(str, sizeof(str), "~g~%d", GreenCount);
TextDrawSetString(Textdraw14, str);
}
if(killerid != INVALID_PLAYER_ID)
{
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, killerid);
PlayerInfo[playerid][Latezor] = 1;
}
return 1;
}
Try this.
Re: [URGENT]Help me guys! -
Zhoom - 21.01.2012
WOW! IT WORKS! Thank you very much!
+REP BOTH OF YOU