SetPlayerScore
#1

Hello everyone, I am having trouble with the score setting, is that possible to make, that once a player uses a command, 20 of his OWN score, (score counts for kills at my gm) will be taken?

And another thing, is is it possible that once a player uses a command, his health will be saved, and once he disables it, it will return to his own? (At the period, his health will be 9999999).

Thanks in advance.
Reply
#2

Post your code please of the command and if you want it to take from the player score do this

pawn Код:
SetPlayerScore(playerid, GetPlayerScore(playerid) - 20);
Reply
#3

To remove their score:
pawn Код:
SetPlayerScore(playerid, GetPlayerScore(playerid) - 20);
To save their HP:
pawn Код:
new Float: HP[2]; // Global or something

// when they use the cmd:
GetPlayerHealth(playerid, HP[0]);
GetPlayerArmour(playerid, HP[1]);

SetPlayerHealth(playerid, 99999999);
// when you want to give their health back
SetPlayerHealth(playerid, HP[0]);
SetPlayerArmour(playerid, HP[1]);
Reply
#4

Quote:
Originally Posted by efrim123
Посмотреть сообщение
Post your code please of the command and if you want it to take from the player score do this

pawn Код:
SetPlayerScore(playerid, GetPlayerScore(playerid) - 20);
Quote:
Originally Posted by -Prodigy-
Посмотреть сообщение
To remove their score:
pawn Код:
SetPlayerScore(playerid, GetPlayerScore(playerid) - 20);
To save their HP:
pawn Код:
new Float: HP[2]; // Global or something

// when they use the cmd:
GetPlayerHealth(playerid, HP[0]);
GetPlayerArmour(playerid, HP[1]);

SetPlayerHealth(playerid, 99999999);
// when you want to give their health back
SetPlayerHealth(playerid, HP[0]);
SetPlayerArmour(playerid, HP[1]);
Thanks both , was really helpfull.
Reply
#5

or easy way is:
pawn Код:
new playerscore = GetPlayerScore(playerid);
SetPlayerScore(playerid, playerscore - 20);
Reply
#6

That's exactly the same as:
pawn Код:
SetPlayerScore(playerid, GetPlayerScore(playerid) - 20);
Though I think the method above is more efficient as it creates 1 less variable.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)