[HELP] Variables arent counting -
DeadDon - 09.04.2012
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;
}
Re: [HELP] Variables arent counting -
Libra_PL - 09.04.2012
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.
Re: [HELP] Variables arent counting -
DeadDon - 09.04.2012
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?
Re: [HELP] Variables arent counting -
Cjgogo - 09.04.2012
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
Re: [HELP] Variables arent counting -
Libra_PL - 09.04.2012
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
Re: [HELP] Variables arent counting -
DeadDon - 09.04.2012
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....
Re: [HELP] Variables arent counting -
Cjgogo - 09.04.2012
DeadDon Libra wrote the code,and I know it doesn't make sense
Re: [HELP] Variables arent counting -
emokidx - 09.04.2012
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;
Re: [HELP] Variables arent counting -
DeadDon - 09.04.2012
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!
Re: [HELP] Variables arent counting -
DeadDon - 09.04.2012
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;
}