Bug with score
#1

Hello guys l have a little problem with score when a player kills a player score is on zero it changes olney when l or some other admin sets it.
How to fix this pls help!!
Reply
#2

if it changes on death, post your death code.
Reply
#3

show me the public that say OnPlayerDeath(playerid, killerid, reason)
Reply
#4

public OnPlayerDeath(playerid, killerid, reason)
{
new msg[128],reasonMsg[32], pname[MAX_PLAYER_NAME], string[128], deathreason[20];
SendDeathMessage(killerid,playerid,reason);
GameTextForPlayer(playerid,"~r~~h~OWNED",10000,1);
GetPlayerName(playerid, pname, sizeof(pname));
GetWeaponName(reason, deathreason, 20);
new pstring[128]; //player message
new killer[MAX_PLAYER_NAME];
GetPlayerName(killerid, killer, sizeof(killer));

if(InDM[playerid]==1) InDM[playerid]=0;
SetPlayerWorldBounds(playerid,20000.0000,-20000.0000,20000.0000,-20000.0000);
Reply
#5

This should work:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new msg[128],reasonMsg[32], pname[MAX_PLAYER_NAME], string[128], deathreason[20];
SendDeathMessage(killerid,playerid,reason);
GameTextForPlayer(playerid,"~r~~h~OWNED",10000,1);
GetPlayerName(playerid, pname, sizeof(pname));
GetWeaponName(reason, deathreason, 20);
new pstring[128]; //player message
new killer[MAX_PLAYER_NAME];
GetPlayerName(killerid, killer, sizeof(killer));
if(killerid != INVALID_PLAYER_ID) return SetPlayerScore(killerid, GetPlayerScore(killerid) + 1); //you can change the 1 to any number that will be added to the score!

if(InDM[playerid]==1) InDM[playerid]=0;
SetPlayerWorldBounds(playerid,20000.0000,-20000.0000,20000.0000,-20000.0000);
return 1;
}
Reply
#6

ok it just shows me one warning:
warning 217: loose indentation
Reply
#7

Use this now.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new msg[128],reasonMsg[32], pname[MAX_PLAYER_NAME], string[128], deathreason[20];
    SendDeathMessage(killerid,playerid,reason);
    GameTextForPlayer(playerid,"~r~~h~OWNED",10000,1);
    GetPlayerName(playerid, pname, sizeof(pname));
    GetWeaponName(reason, deathreason, 20);
    new pstring[128]; //player message
    new killer[MAX_PLAYER_NAME];
    GetPlayerName(killerid, killer, sizeof(killer));
    if(killerid != INVALID_PLAYER_ID) return SetPlayerScore(killerid, GetPlayerScore(killerid) + 1); //you can change the 1 to any number that will be added to the score!
    if(InDM[playerid]==1) return InDM[playerid]=0;
    SetPlayerWorldBounds(playerid,20000.0000,-20000.0000,20000.0000,-20000.0000);
    return 1;
}

If this doesnt work for you then give us the line where the warning comes.
Reply
#8

Put this under all #includes

Код:
#pragma tabsize 0
rep me if i have helped
Reply
#9

oops sorry. here it is

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new msg[128],reasonMsg[32], pname[MAX_PLAYER_NAME], string[128], deathreason[20];
    SendDeathMessage(killerid,playerid,reason);
    GameTextForPlayer(playerid,"~r~~h~OWNED",10000,1);
    GetPlayerName(playerid, pname, sizeof(pname));
    GetWeaponName(reason, deathreason, 20);
    new pstring[128]; //player message
    new killer[MAX_PLAYER_NAME];
    GetPlayerName(killerid, killer, sizeof(killer));
    if(killerid != INVALID_PLAYER_ID) return SetPlayerScore(killerid, GetPlayerScore(killerid) + 1); //you can change the 1 to any number that will be added to the score!

    if(InDM[playerid]==1) InDM[playerid]=0;
    SetPlayerWorldBounds(playerid,20000.0000,-20000.0000,20000.0000,-20000.0000);
    return 1;
}
Reply
#10

OMG!!!! now anything isnt working lol!!!
Reply
#11

hmm do you have msn or skype?
Reply
#12

l have skype and xfire.
skype=spikes.megaskype
xfire=spike180297
Reply
#13

Код:
if(killerid != INVALID_PLAYER_ID) { SetPlayerScore(killerid, GetPlayerScore(killerid)+1); }
add this at the end of OnPlayerDeath, and don't use return XXXX inside a public function like OnPlayerDeath if you're a beginner at scripting.
Reply
#14

accept me
Reply
#15

i did xD
Reply
#16

OK all problem fixed thanks for all your help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)