SA-MP Forums Archive
pvar problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: pvar problem (/showthread.php?tid=191234)



pvar problem - karmancho - 18.11.2010

Код:
stock GivePlayerCash(playerid, money)
{
	SetPVarInt(playerid, "Moneyp", +=money);  // 346 line
	ResetMoneyBar(playerid);
	UpdateMoneyBar(playerid,GetPVarInt(playerid, "Moneyp"));
	return GetPVarInt(playerid, "Moneyp");
}
when i compile i get this

(346) : error 029: invalid expression, assumed zero
(346) : warning 215: expression has no effect
(346) : error 001: expected token: ";", but found ")"
(346) : error 029: invalid expression, assumed zero
(346) : fatal error 107: too many error messages on one line


Re: pvar problem - JaTochNietDan - 18.11.2010

That won't work, as the function does not know what to add the "money" value on to. You can do the following instead:

pawn Код:
stock GivePlayerCash(playerid, money)
{
    SetPVarInt(playerid, "Moneyp", GetPVarInt(playerid,"Moneyp") + money);  // 346 line
    ResetMoneyBar(playerid);
    UpdateMoneyBar(playerid,GetPVarInt(playerid, "Moneyp"));
    return GetPVarInt(playerid, "Moneyp");
}



Re: pvar problem - karmancho - 18.11.2010

NICE works thanks alot!