Score Update
#1

PHP Code:
public OnPlayerDeath(playeridkilleridreason)
{
    
SetPlayerArmour(playerid0);
    if(
killerid != INVALID_PLAYER_ID)
    {
        new 
level;
        
SendDeathMessage(killeridplayeridreason);
        
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
Reply
#2

Quote:
Originally Posted by Hadzaga
View Post
PHP Code:
public OnPlayerDeath(playeridkilleridreason)
{
    
SetPlayerArmour(playerid0);
    if(
killerid != INVALID_PLAYER_ID)
    {
        new 
level;
        
SendDeathMessage(killeridplayeridreason);
        
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]); 
Reply
#3

Yes but still when someone Dyes it resets his score ...
Reply
#4

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

I Have everything,OnPlayerDissconect i have saving system and i have forward and Public SavePlayer.OnGamemodeinit SetTimer("SavePlayer") but still refreshes on death ...
Reply
#6

PHP Code:
public OnPlayerDeath(playeridkilleridreason

    
SetPlayerArmour(playerid0); 
    if(
killerid != INVALID_PLAYER_ID
    { 
        new 
level
        
SendDeathMessage(killeridplayeridreason); 
        
PlayerInfo[killerid][pKills] ++; 
        
PlayerInfo[playerid][pDeaths] ++; 
        
trenutnokills[killerid] ++; 
           
trenutnodeaths[playerid] ++; 
        
SetPlayerScore(killeridGetPlayerScore(killerid)+1);
        
level GetPlayerScore(killerid); 
        
PlayerInfo[killerid][pLevel] = level
try this
Reply
#7

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)); 
Reply
#8

Quote:
Originally Posted by Sew_Sumi
View Post
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?
Reply
#9

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

PHP Code:
public OnPlayerDeath(playeridkilleridreason

    
SetPlayerArmour(playerid0); 
    if(
killerid != INVALID_PLAYER_ID
    { 
        new 
level
        
SendDeathMessage(killeridplayeridreason); 
        
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!
Reply
#11

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

Its working now,TY guys !!
Reply
#13

Quote:
Originally Posted by Sew_Sumi
View Post
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)