Fixing Errors
#1

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason); // Shows the kill in the killfeed/deathlog/death window

    if(killerid != INVALID_PLAYER_ID) // Valid killer, give cash+score
    {
        pScore[killerid]++;
        SetPlayerScore(killerid, pScore[killerid]);

        pCash[killerid] += 100;
        GivePlayerMoney(killerid, 100);
    }

    // Outside the check, handle stuff for playerid
    // if killerid was INVALID_PLAYER_ID the player killed themselves (i.e. falling)

    pDeaths[playerid]++;
    pCash[playerid] -= 100;
    pScore[playerid]--;
    SetPlayerScore(playerid, pScore[playerid]);
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid, pCash[playerid]);
    return 1;
}
Код:
C:\DOCUME~1\cla\Desktop\SAMP\SAMP03~1\GAMEMO~1\Malta.pwn(159) : error 017: undefined symbol "pScore"
C:\DOCUME~1\cla\Desktop\SAMP\SAMP03~1\GAMEMO~1\Malta.pwn(159) : warning 215: expression has no effect
C:\DOCUME~1\cla\Desktop\SAMP\SAMP03~1\GAMEMO~1\Malta.pwn(159) : error 001: expected token: ";", but found "]"
C:\DOCUME~1\cla\Desktop\SAMP\SAMP03~1\GAMEMO~1\Malta.pwn(159) : error 029: invalid expression, assumed zero
C:\DOCUME~1\cla\Desktop\SAMP\SAMP03~1\GAMEMO~1\Malta.pwn(159) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#2

place above your gm

pawn Код:
new pScore[MAX_PLAYERS];
Reply
#3

Thanks
Reply
#4

Would be more efficient to use enums instead of defining them as variables.

Something like this:

pawn Код:
enum pInfo
{
    pScore,
    pKills,
    pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Instead of using:

pawn Код:
new pScore[MAX_PLAYERS];
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)