Fixing Errors - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Fixing Errors (
/showthread.php?tid=427281)
Fixing Errors -
Branzy - 01.04.2013
Код:
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.
Respuesta: Fixing Errors -
Parka - 01.04.2013
place above your gm
Re: Fixing Errors -
Branzy - 01.04.2013
Thanks
Re: Fixing Errors -
sniperwars - 01.04.2013
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: