Adding score to killer and deducting score to killee -
LeeXian99 - 25.03.2013
Umm, how? Is this correct?
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killer, killee, weapon);
GivePlayerScore(killer, +1);
GivePlayerScore(killee, -1);
return 1;
}
Re: Adding score to killer and deducting score to killee -
Dubya - 25.03.2013
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
new killee = playerid;
new killer = killerid;
new weapon = GetPlayerWeapon(killer);
SendDeathMessage(killer, killee, weapon);
GivePlayerScore(killer, GetPlayerScore(killer)+1);
GivePlayerScore(killee, GetPlayerScore(killee)-1);
return 1;
}
Re: Adding score to killer and deducting score to killee -
LarzI - 25.03.2013
Quote:
Originally Posted by Dubya
pawn Code:
public OnPlayerDeath(playerid, killerid, reason) { new killee = playerid; new killer = killerid; new weapon = GetPlayerWeapon(killer); SendDeathMessage(killer, killee, weapon); GivePlayerScore(killer, GetPlayerScore(killer)+1); GivePlayerScore(killee, GetPlayerScore(killee)-1); return 1; }
|
Why are you declaring new variables? This is a waste of speed and memory.
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, weapon);
GivePlayerScore(killerid, GetPlayerScore(killerid)+1);
GivePlayerScore(playerid, GetPlayerScore(playerid)-1);
return 1;
}
Re: Adding score to killer and deducting score to killee -
Dubya - 25.03.2013
Quote:
Originally Posted by LarzI
Why are you declaring new variables? This is a waste of speed and memory.
pawn Code:
public OnPlayerDeath(playerid, killerid, reason) { SendDeathMessage(killerid, playerid, weapon); GivePlayerScore(killerid, GetPlayerScore(killerid)+1); GivePlayerScore(playerid, GetPlayerScore(playerid)-1); return 1; }
|
I was declaring 2 new variables as the way LeeXian99 had his GivePlayerScore setup as. Just to make it so he could use it like that without having to use the playerid, and killerid.
Re: Adding score to killer and deducting score to killee -
LeeXian99 - 25.03.2013
Code:
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(4518) : error 017: undefined symbol "GivePlayerScore"
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(4519) : error 017: undefined symbol "GivePlayerScore"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Errors.
.__.
Re: Adding score to killer and deducting score to killee -
Dubya - 25.03.2013
Whoops. Try this:
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, GetPlayerWeapon(killerid));
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
SetPlayerScore(playerid, GetPlayerScore(playerid)-1);
return 1;
}
Re: Adding score to killer and deducting score to killee -
LeeXian99 - 25.03.2013
Quote:
Originally Posted by Dubya
Whoops. Try this:
pawn Code:
public OnPlayerDeath(playerid, killerid, reason) { SendDeathMessage(killerid, playerid, GetPlayerWeapon(killerid)); SetPlayerScore(killerid, GetPlayerScore(killerid)+1); SetPlayerScore(playerid, GetPlayerScore(playerid)-1); return 1; }
|
Oh yeah, it's cool. <3 Thanks.
Re: Adding score to killer and deducting score to killee -
Avi Raj - 25.03.2013
Code:
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, GetPlayerWeapon(killerid));
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
SendClientMessage(killerid,0x00FFFFFF,"Good Job, You Got 1 Score For Killing a Player");
SetPlayerScore(playerid, GetPlayerScore(playerid)-1);
SendClientMessage(killerid,0xAA3333AA,"You have Got -1 Score for getting killed By a Player");
return 1;
}
It have client message too which will be sent to both Killer and Player.