[HELP] Variables arent counting
#1

I am using my own gamemode made from scratch.
On "OnPlayerDeath" function, none of the variables does not count.
I would like when killer gets killed he gets one more "pDeath" variable and the killer gets one more "pKill" variable.
If the guy kills himself, he gets one more "pDeath" variable. I scripted variables it does not work.
Or any other variable I could put does not count. Please help, this is my "OnPlayerDeath" function:

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
     if(killerid != INVALID_PLAYER_ID) // Valid killer
     {
        PlayerInfo[playerid][pDeaths] ++ ;
        LooseWeapons(playerid);
        PlayerInfo[killerid][pKills] ++;
     }
     if(killerid == INVALID_PLAYER_ID) // Invalid killer
     {
        PlayerInfo[playerid][pDeaths] ++ ;
        LooseWeapons(playerid);
     }
     return 1;
}
Reply
#2

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
     if(playerid != INVALID_PLAYER_ID) // Valid killer
     {
        PlayerInfo[playerid][pDeaths] ++ ;
        LooseWeapons(playerid);
        PlayerInfo[killerid][pKills] ++;
     }
     if(playerid == INVALID_PLAYER_ID) // Invalid killer
     {
        PlayerInfo[playerid][pDeaths] ++ ;
        LooseWeapons(playerid);
     }
     return 1;
}
Try that.
Reply
#3

Quote:
Originally Posted by Libra_PL
Посмотреть сообщение
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
     if(playerid != INVALID_PLAYER_ID) // Valid killer
     {
        PlayerInfo[playerid][pDeaths] ++ ;
        LooseWeapons(playerid);
        PlayerInfo[killerid][pKills] ++;
     }
     if(playerid == INVALID_PLAYER_ID) // Invalid killer
     {
        PlayerInfo[playerid][pDeaths] ++ ;
        LooseWeapons(playerid);
     }
     return 1;
}
Try that.

What did you actually change?
Reply
#4

She changed killerid with playerid,did you know scirpteers must pay attention to every small detail,anyway,if that doesn't work show us enum data
Reply
#5

Well, changed killerid to playerid where is "if". This public is for OnPlayerDeath, not OnPlayerKill (which doesn't exists).

EDIT: Cjjogo was faster, damn 60 seconds before posting again :P
Reply
#6

Quote:
Originally Posted by Cjgogo
Посмотреть сообщение
She changed killerid with playerid,did you know scirpteers must pay attention to every small detail,anyway,if that doesn't work show us enum data
But that what you wrote does not make any sense... I will try now.

That mean that nobody died... If playerid is INVALID_PLAYER_ID....
Reply
#7

DeadDon Libra wrote the code,and I know it doesn't make sense
Reply
#8

i am not really sure, but the space between the enum and the "++" maybe makes some difference?
idk if it will work but try
pawn Код:
PlayerInfo[killerid][pKills]/*the space here*/ ++;
or just replace with
pawn Код:
PlayerInfo[killerid][pKills] = PlayerInfo[killerid][pKills] + 1;
Reply
#9

Libra, I have tried what you wrote, it counts but only the pDeath variable, not pKills...
I have tried killing another player, that player got pDeath + but I did not get pKills + ... HELP!
Reply
#10

I wrote a command and when I test it, it works, but how come on OnPlayerDeath does not?
Код:
if (strcmp("/onemorekill", cmdtext, true, 10) == 0)
	{
    	PlayerInfo[playerid][pKills] ++;
		return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)