SetPlayerScore on OnPlayerDeath +REP
#1

So I want it so that when John kills Larry, Larry -2 score because he died. I already know how to +2 score for John. I just need to know how to minus score from the dead player.
Reply
#2

You wanna save his score into a variable

pawn Код:
public OnPlayerDeath(playerid, killerid, reason) {

playerVariables[playerid][pScore] -= 2;//Minus dead persons score
playerVariables[killerid][pScore] += 2; //Killers score.
Simple as that.
Reply
#3

Put on your way OnPlayerDeath

pawn Код:
SetPlayerScore(killerid, GetPlayerScore(killerid) + 2);
SetPlayerScore(playerid, GetPlayerScore(playerid) - 2);
Reply
#4

Here are the errors now:

Код:
C:\Users\Edward\Desktop\CnR1.1\gamemodes\freeroam.pwn(2108) : error 017: undefined symbol "playerVariables"
C:\Users\Edward\Desktop\CnR1.1\gamemodes\freeroam.pwn(2108) : warning 215: expression has no effect
C:\Users\Edward\Desktop\CnR1.1\gamemodes\freeroam.pwn(2108) : error 001: expected token: ";", but found "]"
C:\Users\Edward\Desktop\CnR1.1\gamemodes\freeroam.pwn(2108) : error 029: invalid expression, assumed zero
C:\Users\Edward\Desktop\CnR1.1\gamemodes\freeroam.pwn(2108) : fatal error 107: too many error messages on one line
Btw, I'm using ZCMD
Reply
#5

Use my way and try to compile
Reply
#6

Use Funerals way, his will work for nubs.
Reply
#7

@.FuneraL. - Works perfectly! +rep thanks so much!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)