save amount
#1

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(playeridissuerid,Floatamountweaponid)
{
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 213tag mismatchexpected tag none ("_"), but found "Float" 
Thanks!
Reply
#2

`TotalDMG` should have Float: tag
pawn Code:
PlayerInfo[playerid][TotalDMG] += amount;
// is equivalent to
PlayerInfo[playerid][TotalDMG] = PlayerInfo[playerid][TotalDMG] + amount;
Reply
#3

Quote:
Originally Posted by Calisthenics
View Post
`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(playerid540.0000000.000000"FPS:000 Ping:000 PL:0.00");
    
PlayerTextDrawBackgroundColor(playeridTextdraw0[playerid], 255);
    
PlayerTextDrawFont(playeridTextdraw0[playerid], 1);
    
PlayerTextDrawLetterSize(playeridTextdraw0[playerid], 0.2199991.100000);
    
PlayerTextDrawColor(playeridTextdraw0[playerid], -1);
    
PlayerTextDrawSetOutline(playeridTextdraw0[playerid], 0);
    
PlayerTextDrawSetProportional(playeridTextdraw0[playerid], 1);
    
PlayerTextDrawSetShadow(playeridTextdraw0[playerid], 0);

And the showtextdraw in the teams:

PHP Code:
PlayerTextDrawShow(playeridTextdraw0[playerid]); 
OnPlayerUpdate:

PHP Code:
    new str[25];
    
format(strsizeof(str), "FPS:%d Ping:%d PL:%.2f"GetPlayerFPS(playerid), GetPlayerPing(playerid), NetStats_PacketLossPercent(playerid));
    
PlayerTextDrawSetString(playeridTextdraw0[playerid], str); 
Why?
Reply
#4

Quote:
Originally Posted by Vy
View Post
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?
Reply
#5

Quote:
Originally Posted by Calisthenics
View Post
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
Reply
#6

If it is not shown at all, the formatting should not be the problem. You can try set textdraw string and re-show it.
Reply
#7

Quote:
Originally Posted by Calisthenics
View Post
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.
Reply
#8

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(messagesizeof (message), "#%d %s(%d) with %d Kills and %.0f total dmg"1player_nametop_kills[i][1], top_kills[i][0], PlayerInfo[i][TotalDMG]); 
In the OnPlayerTakeDamage i save only the issuerid
Reply
#9

Do you sort `top_kills` array? Can you post the code?
Reply
#10

Quote:
Originally Posted by Calisthenics
View Post
Do you sort `top_kills` array? Can you post the code?
i fixed that, thanks anyway
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)