SA-MP Forums Archive
Bug with score - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Bug with score (/showthread.php?tid=343213)



Bug with score - Spike Cena - 16.05.2012

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!!


AW: Bug with score - EthanR - 16.05.2012

if it changes on death, post your death code.


Re: Bug with score - Kirollos - 16.05.2012

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


Re: Bug with score - Spike Cena - 16.05.2012

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);


Re: Bug with score - Kirollos - 16.05.2012

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;
}



Re: Bug with score - Spike Cena - 16.05.2012

ok it just shows me one warning:
warning 217: loose indentation


Re: Bug with score - Ballu Miaa - 16.05.2012

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.


Re: Bug with score - MichaelProPlayer - 16.05.2012

Put this under all #includes

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


Re: Bug with score - Kirollos - 16.05.2012

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;
}



Re: Bug with score - Spike Cena - 16.05.2012

OMG!!!! now anything isnt working lol!!!


Re: Bug with score - Kirollos - 16.05.2012

hmm do you have msn or skype?


Re: Bug with score - Spike Cena - 16.05.2012

l have skype and xfire.
skype=spikes.megaskype
xfire=spike180297


AW: Bug with score - EthanR - 16.05.2012

Код:
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.


Re: Bug with score - Kirollos - 16.05.2012

accept me


Re: Bug with score - Spike Cena - 16.05.2012

i did xD


Re: Bug with score - Spike Cena - 16.05.2012

OK all problem fixed thanks for all your help