Player Variables
#1

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);
   
    GivePlayerMoney(killerid, 5000);
    GivePlayerMoney(playerid, -500);
    SetPlayerScore(killerid, GetPlayerScore(playerid) +1);
    SetPlayerColor(playerid, COLOR_GREY);

    PlayerInfo[killerid][pCash] = GetPlayerMoney(killerid) +5000;
    PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid) -500;
    PlayerInfo[killerid][pScore] = GetPlayerScore(killerid) +1;
    PlayerInfo[killerid][pKills] = PlayerInfo[killerid][pKills]+1;
    PlayerInfo[playerid][pDeaths] = PlayerInfo[playerid][pDeaths]+1;

    return 1;
}
this doesnt save the variabels, pleae can someone tell me whats wrong?
Reply
#2

Try this:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid != INVALID_PLAYER_ID)
    {
        SendDeathMessage(killerid, playerid, reason);
       
        GivePlayerMoney(killerid, 5000);
        GivePlayerMoney(playerid, -500);
        SetPlayerScore(killerid, GetPlayerScore(playerid) +1);
        SetPlayerColor(playerid, COLOR_GREY);

        PlayerInfo[killerid][pCash] = GetPlayerMoney(killerid) +5000;
        PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid) -500;
        PlayerInfo[killerid][pScore] = GetPlayerScore(killerid) +1;
        PlayerInfo[killerid][pKills] = PlayerInfo[killerid][pKills]+1;
        PlayerInfo[playerid][pDeaths] = PlayerInfo[playerid][pDeaths]+1;
    }
    return 1;
}
Reply
#3

same..
the money is 0 even if i do /kill..
Reply
#4

In the code provided above you must be killed by someone to work.

Try this one:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{

    GivePlayerMoney(playerid, -500);
    SetPlayerColor(playerid, COLOR_GREY);
    PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid) -500;
    PlayerInfo[playerid][pDeaths] = PlayerInfo[playerid][pDeaths]+1;
    if(killerid != INVALID_PLAYER_ID)
    {
        SendDeathMessage(killerid, playerid, reason);
        GivePlayerMoney(killerid, 5000);
        SetPlayerScore(killerid, GetPlayerScore(playerid) +1);
        PlayerInfo[killerid][pCash] = GetPlayerMoney(killerid) +5000;
        PlayerInfo[killerid][pScore] = GetPlayerScore(killerid) +1;
        PlayerInfo[killerid][pKills] = PlayerInfo[killerid][pKills]+1;

    }
    return 1;
}
Reply
#5

ohk thnx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)