How to save score!?!?
#1

okay, so my script basically.When player kills other player the killers clan/team gets +1 point, how do i do that with variables and how do i save the clanpoints?
Reply
#2

Well, if i remember right, theres a rule that says somthing like.
Thread title most not be like "OMG HELP ME WITH THIS!" or "SOMETHING SOMETHING ??!?!?!"

But, do you use dini and what command proccesor?
Reply
#3

i use dini, command processor? come again?
Reply
#4

thank you agent obvious
Reply
#5

You have to use GetPlayerTeam and SetPlayerTeam, together your save score thing would be like:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason);
{
    if(GetPlayerTeam(playerid) != GetPlayerTeam(killerid)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(GetPlayerTeam(i) == GetPlayerTeam(killerid)
            {
                SetPlayerScore(i, GetPlayerScore(i)+1);
                return 1;
            }
        }
    }
}
Also use
pawn Код:
#include <dini>
(must download the include from DracoBlue)

pawn Код:
public OnPlayerDisconnect(playerid)
{
    dini_IntSet(playerid, "Score", GetPlayerScore(playerid);
    return 1;
}

public OnPlayerConnect(playerid);
{
    SetPlayerScore(playerid, dini_Int(playerid, "Score");
    return 1;
}
Not tested, but might work
Reply
#6

public OnPlayerDeath(playerid, killerid, reason)
{
new pTeam;
pTeam = gTeam[playerid];
new pname[MAX_PLAYER_NAME], kname[MAX_PLAYER_NAME];
new string1[127], string2[128];
GetPlayerName(killerid, kname, sizeof(kname));
GetPlayerName(playerid, pname, sizeof(pname));
format(string1, sizeof(string1),"%s Has killed %s (%s)", kname, pname, reason);
format(string2, sizeof(string2),"%s Earns 1 point (%s +1)",kname, pTeam);
SendClientMessageToAll(COLOR_RED, string1);
SendClientMessageToAll(COLOR_GREEN, string2);
SendDeathMessage(killerid, playerid, reason);
pInfo[pKills][killerid] = ++;
pInfo[pDeath][playerid] = ++;
cInfo[Clanpoints] = ++;
SavePlayer(playerid);
return 1;
}

This is another pice of code, but its giving me errors on the pInfo shit whats the prob it says expected ; but found ] etc
Reply
#7

Quote:
Originally Posted by Claude
Посмотреть сообщение
You have to use GetPlayerTeam and SetPlayerTeam, together your save score thing would be like:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason);
{
    if(GetPlayerTeam(playerid) != GetPlayerTeam(killerid)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(GetPlayerTeam(i) == GetPlayerTeam(killerid)
            {
                SetPlayerScore(i, GetPlayerScore(i)+1);
                return 1;
            }
        }
    }
}
Also use
pawn Код:
#include <dini>
(must download the include from DracoBlue)

pawn Код:
public OnPlayerDisconnect(playerid)
{
    dini_IntSet(playerid, "Score", GetPlayerScore(playerid);
    return 1;
}

public OnPlayerConnect(playerid);
{
    SetPlayerScore(playerid, dini_Int(playerid, "Score");
    return 1;
}
Not tested, but might work
1) does this save the CLANS SCORE, it looks like it just saves the players score :/
2) if it does save the CLANS SCORE, then can you explain what it does and how?
Reply
#8

Quote:
Originally Posted by Criss_Angel
Посмотреть сообщение
1) does this save the CLANS SCORE, it looks like it just saves the players score :/
2) if it does save the CLANS SCORE, then can you explain what it does and how?
There is and never exists a SetClanScore or SetTeamScore (told by Hiddos )
It works simply:

When you die, it checks the variables if the player is NOT in the killerid, if the player is in the killerid's team, it means he won't get any score because it is teamkill, when he is not then it checks if players are in the team of the killerid (MAX_PLAYERS defines to all players = 500), if they are, all players in that team gets a score up, the dini just saves it, if you don't got it and if you can't find it, you can use

pawn Код:
public OnPlayerDisconnect(playerid)
{
    SetPVarInt(playerid, "Score", GetPlayerScore(playerid));
    return 1;
}

public OnPlayerConnect(playerid)
{
    SetPlayerScore(playerid, GetPVarInt(playerid, "Score"));
    return 1;
}
---------------------------------------------------------------------------------------------------------------
Edit


MAX_PLAYERS defines to 500, and "i" defines to MAX_PLAYERS, means ALL players in the team, thats why it is SetPlayerScore, also normally its 'SetPlayerScore(playerid, score);' - but because "i" defines to MAX_PLAYERS it is 'SetPlayerScore(i, score);'
Reply
#9

NOOO.i dont want all the players to get the points!i just want a file with the team name which shows the total clan points!!!!
Reply
#10

Quote:
Originally Posted by Claude
Посмотреть сообщение
You have to use GetPlayerTeam and SetPlayerTeam, together your save score thing would be like:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason);
{
    if(GetPlayerTeam(playerid) != GetPlayerTeam(killerid)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(GetPlayerTeam(i) == GetPlayerTeam(killerid)
            {
                SetPlayerScore(i, GetPlayerScore(i)+1);
                return 1;
            }
        }
    }
}
Also use
pawn Код:
#include <dini>
(must download the include from DracoBlue)

pawn Код:
public OnPlayerDisconnect(playerid)
{
    dini_IntSet(playerid, "Score", GetPlayerScore(playerid);
    return 1;
}

public OnPlayerConnect(playerid);
{
    SetPlayerScore(playerid, dini_Int(playerid, "Score");
    return 1;
}
Not tested, but might work
Some of your code would not work, because.
When you use dini, its not dini_intset(playerid, "score", getplayersc...) its a string insted of playerid.
therefore,
format(string, sizeof(string), "path", parameters) before dini code, then it'll be 100% right
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)