OnPlayerDeath help - 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: OnPlayerDeath help (
/showthread.php?tid=414744)
OnPlayerDeath help -
McFellow - 10.02.2013
Hello,
I want to make like if I kill some one that I will get 1score and I will get money
This is what I made(I copied it from wiki)
pawn Код:
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
{
Player[killerid][pScore]++;
SetPlayerScore(killerid, pScore[killerid]); //Error line 2058
pMoney[killerid] += 100;
GivePlayerCash(killerid, 100);
}
// Outside the check, handle stuff for playerid
// if killerid was INVALID_PLAYER_ID the player killed themselves (i.e. falling)
pDeaths[playerid]++;
pMoney[playerid] -= 10;
pScore[playerid]++;
SetPlayerScore(playerid, pScore[playerid]);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, pMoney[playerid]);
return 1;
}
and this are the errors
Код:
(2058) : error 028: invalid subscript (not an array or too many subscripts): "pScore"
(2058) : warning 215: expression has no effect
(2058) : error 001: expected token: ";", but found "]"
(2058) : error 029: invalid expression, assumed zero
(2058) : fatal error 107: too many error messages on one line
Re: OnPlayerDeath help - Patrick - 10.02.2013
make sure you have the global variable of pScore
or a new stock
Re: OnPlayerDeath help -
McFellow - 10.02.2013
Now I get
Код:
(84) : error 021: symbol already defined: "pScore"
(1983) : error 033: array must be indexed (variable "pScore")
(2056) : error 033: array must be indexed (variable "pScore")
(2059) : error 028: invalid subscript (not an array or too many subscripts): "pMoney"
(2059) : warning 215: expression has no effect
(2059) : error 001: expected token: ";", but found "]"
(2059) : error 029: invalid expression, assumed zero
(2059) : fatal error 107: too many error messages on one line
Re: OnPlayerDeath help -
MP2 - 10.02.2013
Player[playerid][pScore]
Not
pScore[playerid]
Re: OnPlayerDeath help -
McFellow - 10.02.2013
Now I got
Код:
(2055) : warning 215: expression has no effect
(2056) : error 028: invalid subscript (not an array or too many subscripts): "pScore"
(2056) : warning 215: expression has no effect
(2056) : error 001: expected token: ";", but found "]"
(2056) : error 029: invalid expression, assumed zero
(2056) : fatal error 107: too many error messages on one line
Lines:
pawn Код:
Player[killerid][pScore]; // line 2055
SetPlayerScore(killerid, pScore[killerid]); // line 2056