SetPlayerKills and SetPlayerDeaths
#1

I can't save the kills and the deaths from the players.
I tried with the rBits but still get errors
pawn Код:
stock TogglePlayerIntro(playerid, toggle)
    return  Bit1_Set(PlayingIntro, playerid, toggle);
   
stock IsPlayingIntro(playerid)
    return  Bit1_Get(PlayingIntro, playerid);
   
stock GetPlayerDeaths(playerid)
    return Bit16_Get(Deaths, playerid);

stock GetPlayerKills(playerid)
    return Bit16_Get(Deaths, playerid);
   
stock SetPlayerDeaths(playerid, deaths)
    return Bit16_Set(Deaths, playerid, deaths);
   
stock SetPlayerKills(playerid, kills)
    return Bit16_Set(Deaths, playerid, kills);
   
stock IncreasePlayerDeaths(playerid)
    return Bit16_Set(Deaths, playerid, Bit16_Get(Deaths, playerid) + 1);
   
stock IncreasePlayerKills(playerid)
    return Bit16_Set(Kills, playerid, Bit16_Get(Kills, playerid) + 1);
   
stock SetWrongPasswords(playerid, passes)
    return Bit4_Set(WrongPassword, playerid, passes);
   
stock GetWrongPasswords(playerid)
    return Bit4_Get(WrongPassword, playerid);
   
stock WrongPasswordIncrease(playerid)
    return Bit4_Set(WrongPassword, playerid, Bit4_Get(WrongPassword, playerid) + 1);
   
stock GetPlayerVip(playerid)
    return Bit4_Get(Vip, playerid);

stock SetPlayerVip(playerid, vip)
    return Bit4_Set(Vip, playerid, vip);
   
stock GetPlayerLevel(playerid)
    return Bit4_Get(Admin, playerid);

stock SetPlayerLevel(playerid, level)
    return Bit4_Set(Admin, playerid, level);
   
stock SetLastON(playerid)
    LastON[playerid] = GetDate();

stock GetLastON(playerid)
    return LastON[playerid];
   
stock SetScore(playerid, score)
    return Score{playerid} = score;

stock GetScore(playerid)
    return Score{playerid};
   
stock SetMoney(playerid, money)
    return Money{playerid} = money;

stock GetMoney(playerid)
    return Money{playerid};
   
stock ToggleLogged(playerid, toggle)
    return Bit1_Set(Logged, playerid, toggle);
   
stock IsLogged(playerid)
    return Bit1_Get(Logged, playerid);
   
stock GetPlayerIntroPart(playerid)
    return Bit4_Get(pIntroPart, playerid);
   
stock SetPlayerIntroPart(playerid, part)
    return Bit4_Set(pIntroPart, playerid, part);
How can I save them?
Reply
#2

*DUH* Y_ini ?!

Tutorial on doing it
Reply
#3

I save the skin, color, score with Dini
Reply
#4

Then just add in the kills and deaths with the score, it ain't rocket science (I hope not anyway).

Oh and I got to wait 47 seconds, I fail.

Now it's twenty-five seconds!

Now it's ten!

Now it's three!
Reply
#5

Quote:
Originally Posted by Yamoo
Посмотреть сообщение
Then just add in the kills and deaths with the score, it ain't rocket science (I hope not anyway).
How, can you show me.
Reply
#6

With Dini, it shouldn't be hard.

Add this on your player info enum..

pawn Код:
pKills,
pDeaths
add this under OnPlayerDeath;

pawn Код:
PlayerInfo[killerid][pKills]++;  // This will add +1 kill when you kill someone.
PlayerInfo[playerid][pDeaths]++; // This will +1 death when you die.
I'm sure you'll know the rest.
Reply
#7

I use this, now I am confused
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new file[128], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
//save the name of your folder in scriptfiles
    format(file, sizeof(file), "\\Save\\%s.ini", pname);
    if(!dini_Exists(file))
        dini_Create(file);
    dini_IntSet(file, "skin", GetPlayerSkin(playerid));
    dini_IntSet(file, "score", GetPlayerScore(playerid));
    dini_IntSet(file, "color", GetPlayerColor(playerid));
    KillTimer(timer);
    return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) {                   //Checks if the player that just spawned is an NPC.
        new npcname[MAX_PLAYER_NAME];
//Getting the NPC's name.
        GetPlayerName(playerid, npcname, sizeof(npcname));
                                                  //Checking if the NPC's name is Taxi_Driver
        if(!strcmp(npcname, "Taxi_Driver", true)) {
//Putting the NPC into the vehicle we created for it.
            PutPlayerInVehicle(playerid, Taxi_DriverVehicle, 0);
            SetPlayerSkin(playerid,141);
            SetPlayerColor(playerid,COLOR_YELLOW);
        }
                                                  //Checking if the NPC's name is Harry_Potter
        if(!strcmp(npcname, "Harry_Potter", true)) {
//Putting the NPC into the vehicle we created for it.
            PutPlayerInVehicle(playerid, Harry_PotterVehicle, 0);
            SetPlayerSkin(playerid,147);
            SetPlayerColor(playerid,COLOR_WHITE);
        }
        return 1;
    }
    SetPlayerInterior(playerid,0);
    SetPlayerRandomSpawn(playerid);
    GivePlayerWeapon(playerid, 24, 999);
    GivePlayerWeapon(playerid, 26, 999);
    GivePlayerWeapon(playerid, 21, 999);
    GivePlayerMoney(playerid, 50000);
    new file[128], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(file, sizeof(file), "\\Save\\%s.ini", pname);
    if(dini_Exists(file)) {
        SetTimerEx("SpawnSave", 10, false, "d", playerid);
    }
    return 1;
}
pawn Код:
forward SpawnSave(playerid);
public SpawnSave(playerid)
{
    new file[128], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(file, sizeof(file), "\\Save\\%s.ini", pname);
    SetPlayerSkin(playerid, dini_Int(file, "skin"));
    SetPlayerScore(playerid, dini_Int(file, "score"));
    SetPlayerColor(playerid, dini_Int(file, "color"));
    return 1;
}
So where to put it
Reply
#8

Reply
#9

pawn Код:
enum PLAYER_DATA
{
    Kills,
    Deaths,
}
new pDATA[ MAX_PLAYERS ][ PLAYER_DATA ];

public OnPlayerDisconnect(playerid, reason)
{
    new file[128], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(file, sizeof(file), "\\Save\\%s.ini", pname);
    if(!dini_Exists(file))
        dini_Create(file);
    dini_IntSet(file, "skin", GetPlayerSkin(playerid));
    dini_IntSet(file, "score", GetPlayerScore(playerid));
    dini_IntSet(file, "color", GetPlayerColor(playerid));
    dini_IntSet(file, "Kills", pDATA[ playerid ][ Kills ]);
    dini_IntSet(file, "Deaths", pDATA[ playerid ][ Deaths ]);
    KillTimer(timer);
    return 1;
}
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
    {                
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname));
        if(!strcmp(npcname, "Taxi_Driver", true))
        {
            PutPlayerInVehicle(playerid, Taxi_DriverVehicle, 0);
            SetPlayerSkin(playerid,141);
            SetPlayerColor(playerid,COLOR_YELLOW);
        }                                                
        if(!strcmp(npcname, "Harry_Potter", true))
        {
            PutPlayerInVehicle(playerid, Harry_PotterVehicle, 0);
            SetPlayerSkin(playerid,147);
            SetPlayerColor(playerid,COLOR_WHITE);
        }
        return 1;
    }
    SetPlayerInterior(playerid,0);
    SetPlayerRandomSpawn(playerid);
    GivePlayerWeapon(playerid, 24, 999);
    GivePlayerWeapon(playerid, 26, 999);
    GivePlayerWeapon(playerid, 21, 999);
    GivePlayerMoney(playerid, 50000);
    new file[128], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(file, sizeof(file), "\\Save\\%s.ini", pname);
    if(dini_Exists(file))
    {
        SetTimerEx("SpawnSave", 10, false, "d", playerid);
    }
    return 1;
}
forward SpawnSave(playerid);
public SpawnSave(playerid)
{
    new file[128], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(file, sizeof(file), "\\Save\\%s.ini", pname);
    SetPlayerSkin(playerid, dini_Int(file, "skin"));
    SetPlayerScore(playerid, dini_Int(file, "score"));
    SetPlayerColor(playerid, dini_Int(file, "color"));
    dini_Int(file, "Kills", pDATA[ playerid ][ Kills ]);
    dini_Int(file, "Deaths", pDATA[ playerid ][ Deaths ]);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    if( killerid != INVALID_PLAYER_ID )
    {
        pDATA[ killerid ][ Kills ] ++;
    }
    pDATA[ playerid ][ Deaths ] ++;
    return 1;
}
Reply
#10

Thank you. It compile it but i got 2 warnings
pawn Код:
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(6944) : warning 202: number of arguments does not match definition
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(6945) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Warnings.
At these
pawn Код:
dini_Int(file, "Kills", pDATA[ playerid ][ Kills ]);
    dini_Int(file, "Deaths", pDATA[ playerid ][ Deaths ]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)