save amount -
Vy - 09.05.2020
Hello! Is there any way to save the amount of damage to a player variable?
I've tried this form but it doesn't work:
PHP Code:
public OnPlayerTakeDamage(playerid, issuerid,Float: amount, weaponid)
{
if (issuerid != INVALID_PLAYER_ID)
{
PlayerInfo[playerid][TotalDMG] = ++amount;
}
return 1;
}
I need save all the damage one does to another player for a top, but this shows the error:
PHP Code:
C:\Users\thef\Escritorio\SERVER\gamemodes\game.pwn(849) : warning 213: tag mismatch: expected tag none ("_"), but found "Float"
Thanks!
Re: save amount -
Calisthenics - 09.05.2020
`TotalDMG` should have
Float: tag
pawn Code:
PlayerInfo[playerid][TotalDMG] += amount;
// is equivalent to
PlayerInfo[playerid][TotalDMG] = PlayerInfo[playerid][TotalDMG] + amount;
Re: save amount -
Vy - 09.05.2020
Quote:
Originally Posted by Calisthenics
`TotalDMG` should have Float: tag
pawn Code:
PlayerInfo[playerid][TotalDMG] += amount; // is equivalent to PlayerInfo[playerid][TotalDMG] = PlayerInfo[playerid][TotalDMG] + amount;
|
Thank you very much! I also have another problem. I have a PlayerText that indicates the fps, ping and packetloss for each player. The problem is that if I connect and then someone connects, that someone doesn't show up but I do. Even if the other one is id 0 and I'm 1.
PHP Code:
new PlayerText:Textdraw0[MAX_PLAYERS];
stock in OnPlayerConnect:
PHP Code:
stock PlayerTextdrawing(playerid)
{
Textdraw0[playerid] = CreatePlayerTextDraw(playerid, 540.000000, 0.000000, "FPS:000 Ping:000 PL:0.00");
PlayerTextDrawBackgroundColor(playerid, Textdraw0[playerid], 255);
PlayerTextDrawFont(playerid, Textdraw0[playerid], 1);
PlayerTextDrawLetterSize(playerid, Textdraw0[playerid], 0.219999, 1.100000);
PlayerTextDrawColor(playerid, Textdraw0[playerid], -1);
PlayerTextDrawSetOutline(playerid, Textdraw0[playerid], 0);
PlayerTextDrawSetProportional(playerid, Textdraw0[playerid], 1);
PlayerTextDrawSetShadow(playerid, Textdraw0[playerid], 0);
}
And the showtextdraw in the teams:
PHP Code:
PlayerTextDrawShow(playerid, Textdraw0[playerid]);
OnPlayerUpdate:
PHP Code:
new str[25];
format(str, sizeof(str), "FPS:%d Ping:%d PL:%.2f", GetPlayerFPS(playerid), GetPlayerPing(playerid), NetStats_PacketLossPercent(playerid));
PlayerTextDrawSetString(playerid, Textdraw0[playerid], str);
Why?
Re: save amount -
Calisthenics - 09.05.2020
Quote:
Originally Posted by Vy
The problem is that if I connect and then someone connects, that someone doesn't show up but I do. Even if the other one is id 0 and I'm 1.
|
What do you mean it does not show up? The player-textdraw? Are you sure `PlayerTextDrawShow` is executed correctly when choosing a team?
Re: save amount -
Vy - 09.05.2020
Quote:
Originally Posted by Calisthenics
What do you mean it does not show up? The player-textdraw? Are you sure `PlayerTextDrawShow` is executed correctly when choosing a team?
|
Yes. I think the problem is the format of the textdraw. I have put the PlayerTextDrawshow in the OnPlayerConnect and work perfect for me but for the other no. I have 2 playertextdraws, the dmg and the fps. The dmg shows perfectly and the mates too but the textdraw fps no. Idk why
Re: save amount -
Calisthenics - 09.05.2020
If it is not shown at all, the formatting should not be the problem. You can try set textdraw string and re-show it.
Re: save amount -
Vy - 09.05.2020
Quote:
Originally Posted by Calisthenics
If it is not shown at all, the formatting should not be the problem. You can try set textdraw string and re-show it.
|
Fixed. It was the position of the textdraw. In Y:0 it didn't work but yes when I put in 5
Thanks.
Re: save amount -
Vy - 09.05.2020
Sorry for repost! I have other problem.
In the top, the damage is reversed. If I have 150 damage and Carl 40, he gets my 150 damages and I get his 40.
PHP Code:
format(message, sizeof (message), "#%d %s(%d) with %d Kills and %.0f total dmg", i + 1, player_name, top_kills[i][1], top_kills[i][0], PlayerInfo[i][TotalDMG]);
In the OnPlayerTakeDamage i save only the issuerid
Re: save amount -
Calisthenics - 09.05.2020
Do you sort `top_kills` array? Can you post the code?
Re: save amount -
Vy - 09.05.2020
Quote:
Originally Posted by Calisthenics
Do you sort `top_kills` array? Can you post the code?
|
i fixed that, thanks anyway