Score Update -
Hadzaga - 14.06.2018
PHP Code:
public OnPlayerDeath(playerid, killerid, reason)
{
SetPlayerArmour(playerid, 0);
if(killerid != INVALID_PLAYER_ID)
{
new level;
SendDeathMessage(killerid, playerid, reason);
PlayerInfo[killerid][pKills] ++;
PlayerInfo[playerid][pDeaths] ++;
trenutnokills[killerid] ++;
trenutnodeaths[playerid] ++;
level = SetPlayerScore(killerid,(GetPlayerScore(killerid))+1);
PlayerInfo[killerid][pLevel] = level;
SetPlayerScore(playerid,PlayerInfo[playerid][pLevel]);
When i kill someone it puts me +1 score but it resets score of playerid(guy i killed).How can i save that score and when i join server i need to have that score,and dont reset PLAYERID score
Re: Score Update -
Livity - 14.06.2018
Quote:
Originally Posted by Hadzaga
PHP Code:
public OnPlayerDeath(playerid, killerid, reason)
{
SetPlayerArmour(playerid, 0);
if(killerid != INVALID_PLAYER_ID)
{
new level;
SendDeathMessage(killerid, playerid, reason);
PlayerInfo[killerid][pKills] ++;
PlayerInfo[playerid][pDeaths] ++;
trenutnokills[killerid] ++;
trenutnodeaths[playerid] ++;
level = SetPlayerScore(killerid,(GetPlayerScore(killerid))+1);
PlayerInfo[killerid][pLevel] = level;
SetPlayerScore(playerid,PlayerInfo[playerid][pLevel]);
When i kill someone it puts me +1 score but it resets score of playerid(guy i killed).How can i save that score and when i join server i need to have that score,and dont reset PLAYERID score
|
Remove this line its not needed, since you didn't even trouble the person who died score at all.
PHP Code:
SetPlayerScore(playerid,PlayerInfo[playerid][pLevel]);
Re: Score Update -
Hadzaga - 14.06.2018
Yes but still when someone Dyes it resets his score ...
Re: Score Update -
BiGuy - 14.06.2018
Quote:
Originally Posted by Hadzaga
Yes but still when someone Dyes it resets his score ...
|
maybe because PlayerInfo[playerid][pLevel] equals 0 you dont need this SetPlayerScore(playerid,PlayerInfo[playerid][pLevel]); remove it
and you need to have a saving system to store player scores
Re: Score Update -
Hadzaga - 14.06.2018
I Have everything,OnPlayerDissconect i have saving system and i have forward and Public SavePlayer.OnGamemodeinit SetTimer("SavePlayer") but still refreshes on death ...
Re: Score Update -
Exhibit - 14.06.2018
PHP Code:
public OnPlayerDeath(playerid, killerid, reason)
{
SetPlayerArmour(playerid, 0);
if(killerid != INVALID_PLAYER_ID)
{
new level;
SendDeathMessage(killerid, playerid, reason);
PlayerInfo[killerid][pKills] ++;
PlayerInfo[playerid][pDeaths] ++;
trenutnokills[killerid] ++;
trenutnodeaths[playerid] ++;
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
level = GetPlayerScore(killerid);
PlayerInfo[killerid][pLevel] = level;
try this
Re: Score Update -
Sew_Sumi - 14.06.2018
Why do people throw up suggestions without asking what variables actually are for??? This seems like a sure way to ruin someones work, and make things harder to fix...
PHP Code:
level = SetPlayerScore(killerid,(GetPlayerScore(killerid))+1);
You've got that...
Try this...
PHP Code:
level = SetPlayerScore(killerid,(GetPlayerScore(killerid)+1));
Re: Score Update -
BiGuy - 14.06.2018
Quote:
Originally Posted by Sew_Sumi
Why do people throw up suggestions without asking what variables actually are for??? This seems like a sure way to ruin someones work, and make things harder to fix...
PHP Code:
level = SetPlayerScore(killerid,(GetPlayerScore(killerid))+1);
You've got that...
Try this...
PHP Code:
level = SetPlayerScore(killerid,(GetPlayerScore(killerid)+1));
|
what does this have to do with the killed player scores being reset to 0?
Re: Score Update -
AmigaBlizzard - 14.06.2018
https://sampwiki.blast.hk/wiki/SetPlayerScore
The return value of SetPlayerScore is 1 for success and 0 for failure.
So you're setting "level" to 0 or 1 based on success or failure of using SetPlayerScore, but I don't think that's what you want.
Code:
level = SetPlayerScore(killerid,(GetPlayerScore(killerid))+1); // Should return 1 if killerid is an online player
PlayerInfo[killerid][pLevel] = level;
Re: Score Update -
Stefcaaaa - 14.06.2018
PHP Code:
public OnPlayerDeath(playerid, killerid, reason)
{
SetPlayerArmour(playerid, 0);
if(killerid != INVALID_PLAYER_ID)
{
new level;
SendDeathMessage(killerid, playerid, reason);
PlayerInfo[killerid][pKills] ++;
PlayerInfo[playerid][pDeaths] ++;
trenutnokills[killerid] ++;
trenutnodeaths[playerid] ++;
level = GetPlayerScore(playerid)++; // You must use GetPlayerScore not SetPlayerScore!
PlayerInfo[killerid][pLevel] = level;
SetPlayerScore(playerid,PlayerInfo[playerid][pLevel]);
}
This is what you need!
Re: Score Update -
Sew_Sumi - 14.06.2018
Quote:
Originally Posted by BiGuy
what does this have to do with the killed player scores being reset to 0?
|
Did you actually try it at all, or are you only trying the random pastes that everyone throws up?
After all, did you try it, and did you try everything else?
If the calculation is wrong, and you've made it incorrect, then would that not mean the calculation wouldn't work and therefore, you won't receive a good output?
But hey, just let me know if you're interested in actual work on your issue, or whether you're preferential to those who simply throw up a repost of your code without any mentioning of what they did, and simply posting to get a rep... Then I'll know not to pay attention to your threads in the furture.
If the calculation could be at fault, then how would you even think this wouldn't have an effect on your issue?
If you want help, you actually try it... If you don't want help, then I'll add you to the ignore list.
Re: Score Update -
Hadzaga - 14.06.2018
Its working now,TY guys !!
Re: Score Update -
BiGuy - 14.06.2018
Quote:
Originally Posted by Sew_Sumi
Did you actually try it at all, or are you only trying the random pastes that everyone throws up?
After all, did you try it, and did you try everything else?
If the calculation is wrong, and you've made it incorrect, then would that not mean the calculation wouldn't work and therefore, you won't receive a good output?
But hey, just let me know if you're interested in actual work on your issue, or whether you're preferential to those who simply throw up a repost of your code without any mentioning of what they did, and simply posting to get a rep... Then I'll know not to pay attention to your threads in the furture.
If the calculation could be at fault, then how would you even think this wouldn't have an effect on your issue?
If you want help, you actually try it... If you don't want help, then I'll add you to the ignore list.
|
its not my topic i am not the one asking for help i asked you a simple question this calculation is for killerid:
Code:
level = SetPlayerScore(killerid,(GetPlayerScore(killerid))+1);
PlayerInfo[killerid][pLevel] = level;
SetPlayerScore(playerid,PlayerInfo[playerid][pLevel]);
Hadzaga said dead players score resets to 0 i thought this line may be the problem:
Code:
SetPlayerScore(playerid,PlayerInfo[playerid][pLevel]);
but you asked him to change this level = SetPlayerScore(killerid,(GetPlayerScore(killerid)) +1); thats why i asked you what does killerid has to do with playerid score being reseted