Adding score to killer and deducting score to killee
#1

Umm, how? Is this correct?

pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killer, killee, weapon);
    GivePlayerScore(killer, +1);
    GivePlayerScore(killee, -1);
    return 1;
}
Reply
#2

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;
}
Reply
#3

Quote:
Originally Posted by Dubya
View Post
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;
}
Reply
#4

Quote:
Originally Posted by LarzI
View Post
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.
Reply
#5

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.
.__.
Reply
#6

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;
}
Reply
#7

Quote:
Originally Posted by Dubya
View Post
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.
Reply
#8

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)