SetPlayerKills and SetPlayerDeaths
#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


Messages In This Thread
SetPlayerKills and SetPlayerDeaths - by Kostas' - 14.10.2011, 12:18
Re: SetPlayerKills and SetPlayerDeaths - by sleepysnowflake - 14.10.2011, 12:22
Re: SetPlayerKills and SetPlayerDeaths - by Kostas' - 14.10.2011, 12:54
Re: SetPlayerKills and SetPlayerDeaths - by Yamoo - 14.10.2011, 14:29
Re: SetPlayerKills and SetPlayerDeaths - by Kostas' - 14.10.2011, 14:38
Re: SetPlayerKills and SetPlayerDeaths - by Yamoo - 14.10.2011, 14:50
Re: SetPlayerKills and SetPlayerDeaths - by Kostas' - 14.10.2011, 15:23
Re: SetPlayerKills and SetPlayerDeaths - by Kostas' - 14.10.2011, 16:24
Re: SetPlayerKills and SetPlayerDeaths - by SmiT - 14.10.2011, 16:30
Re: SetPlayerKills and SetPlayerDeaths - by Kostas' - 14.10.2011, 16:38

Forum Jump:


Users browsing this thread: 1 Guest(s)