Kills/Deaths Problem -
geerdinho8 - 21.01.2012
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
pInfo[killerid][Kills]++;
pInfo[playerid][Deaths]++;
if(pInfo[killerid][VIP] > 0)
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
}
return 1;
}
But the Killerid his Kills don't go 1+
And the playerid his Deaths dont go +1
Re: Kills/Deaths Problem -
mineralo - 21.01.2012
can you show your pInfo?
Re: Kills/Deaths Problem -
Bogdan1992 - 21.01.2012
nvm...show us your enum
Re: Kills/Deaths Problem -
Amel_PAtomAXx - 21.01.2012
try:
pawn Код:
pInfo[killerid][Kills] +=1;
pInfo[playerid][Deaths] +=1;
Re: Kills/Deaths Problem -
geerdinho8 - 21.01.2012
pawn Код:
enum iDetails {
Pass,
Cash,
Score,
Admin,
Kills,
Deaths,
VIP,
Muted
};
@Patomaxx, not working
Re: Kills/Deaths Problem -
Amel_PAtomAXx - 21.01.2012
Quote:
Originally Posted by geerdinho8
But the Killerid his Kills don't go 1+
And the playerid his Deaths dont go +1
|
How you testing it ? Saving in file or using /stats to see ?
Problem is not here. If you got /stats cmd, paste it here.
Re: Kills/Deaths Problem -
Jefff - 21.01.2012
You must add
if(0 <= killerid <= MAX_PLAYERS-1)
or
if(killerid != INVALID_PLAYER_ID)
then stats killerid ++ because if player dies /kill or explode killerid == 65565 so Your pInfo[65565 max is MAX_PLAYERS][Kills] will crash
Re: Kills/Deaths Problem -
MP2 - 21.01.2012
What Jefff tried to say was:
You need to check whether killerid is valid before you set an array using it, otherwise it will crash/stop.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID) // Valid killer
{
pInfo[killerid][Kills]++;
if(pInfo[killerid][VIP] > 0) SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
}
pInfo[playerid][Deaths]++;
return 1;
}
Re: Kills/Deaths Problem -
Gh05t_ - 22.01.2012
Quote:
Originally Posted by Amel_PAtomAXx
try:
pawn Код:
pInfo[killerid][Kills] +=1; pInfo[playerid][Deaths] +=1;
|
pawn Код:
main()
{
new a, b;
a++;
b+=1;
printf("%d",a);
printf("%d",b);
}
Re: Kills/Deaths Problem -
DarkScripter - 22.01.2012
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(IsPlayerConnected(playerid) || IsPlayerConnected(killerid))
{
pInfo[killerid][Kills]++;
pInfo[playerid][Deaths]++;
if(pInfo[killerid][VIP] > 0)
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
}
}
return 1;
}
and check's others filterscripts.