20.12.2010, 12:06
Hi all,i need to detect if player has more 15 kills.
Like:
if kills > 15
free armour/health bla bla.
Thanks.
Like:
if kills > 15
free armour/health bla bla.
Thanks.
new kill[MAX_PLAYERS]; // top
public OnPlayerDeath(playerid, reason)
{
kill[killerid]++;
}
public OnPlayerStateChange(playerid, oldstate, newstate)
{
if(kill[playerid] > 15)
{
// ... functions here
}
return 1;
}
SetPlayerScore(killerid,(GetPlayerScore(killerid))+1);
Thanks,i've a question.
I use custom made registration system and OnPlayerDeath i've this: pawn Код:
If i add your code,this will affect the code above or not? |
SetPlayerScore(killerid,(GetPlayerScore(killerid))+1);
public OnPlayerDeath(playerid, killerid, reason)
{
// I would also add this, so the score is spree, not the total kills:
// SetPlayerScore(playerid, 0)
if( killerid != INVALID_PLAYER_ID )
{
SetPlayerScore(killerid,(GetPlayerScore(killerid))+1);
if( GetPlayerScore(killerid) == 15 )
//OR the following, to give armor to player for each kill, when 15 kills are reached
// if( GetPlayerScore(killerid) >= 15 )
{
SetPlayerArmour(killerid,GetPlayerArmour(killerid) + 10);
// OR!
SetPlayerArmour(killerid, 100);
}
}
return 1;
}