problem with a script -
VanillaRain - 07.07.2015
Code:
public OnPlayerUpdate(playerid)
{
GetPlayerMoney(playerid);
if GetPlayerMoney(playerid) += 100;
{
GivePlayerMoney(playerid, -100);
return 1;
}
Code:
error 022: must be lvalue (non-constant)
what's wrong?
Re : problem with a script -
simo0000 - 07.07.2015
pawn Code:
public OnPlayerUpdate(playerid)
{
GetPlayerMoney(playerid);
if(GetPlayerMoney(playerid) > 100);
{
GivePlayerMoney(playerid, -100);
}
return 1;
}
try this
Re: Re : problem with a script -
VanillaRain - 07.07.2015
Quote:
Originally Posted by simo0000
pawn Code:
public OnPlayerUpdate(playerid) {
GetPlayerMoney(playerid); if(GetPlayerMoney(playerid) > 100); { GivePlayerMoney(playerid, -100); } return 1; }
try this
|
I would like to know if a player got + 100 he will get -100
Re: problem with a script -
VanillaRain - 08.07.2015
BUUUUUUUUUUUMP
Re: problem with a script -
dusk - 08.07.2015
Stop bumping.
A lot of things are wrong, what are you trying to achieve?
Re: problem with a script -
VanillaRain - 08.07.2015
Quote:
Originally Posted by dusk
Stop bumping.
A lot of things are wrong, what are you trying to achieve?
|
When people will start to consider me, I will start stopping bumping!
Anyway, I would like to know:
If PlayerMoney increased by 100, Them will be deducted by 100.
So if Player got 49765$ and suddenly he got 49865 they increased by 100, then -100.
Clear now?
Re: problem with a script -
dusk - 08.07.2015
Well I don't understand WHY you want it but this should work.
pawn Code:
public OnPlayerUpdate(playerid)
{
static PlayerMoney[ MAX_PLAYERS ];
if(!PlayerMoney[ playerid ])
PlayerMoney[ playerid ] = GetPlayerMoney(playerid);
else
{
if(GetPlayerMoney(playerid) - PlayerMoney[ playerid ] == 100)
{
GivePlayerMoney(playerid, -100);
}
PlayerMoney[ playerid ] = GetPlayerMoney(playerid);
}
}
Re: problem with a script -
Lynn - 08.07.2015
This is what you want.
However I do not suggest using OnPlayerUpdate...almost ever.
Loop it through a player timer, OnPlayerUpdate is ever 40miliseconds, it will cause significant lag as players join.
pawn Code:
public OnPlayerUpdate(playerid)
{
GetPlayerMoney(playerid);
if(GetPlayerMoney(playerid) >= 100); // Players money is equal or greater than 100
{
GivePlayerMoney(playerid, -100);
}
return 1;
}
Re: problem with a script -
VanillaRain - 08.07.2015
Quote:
Originally Posted by dusk
Well I don't understand WHY you want it but this should work.
pawn Code:
public OnPlayerUpdate(playerid) { static PlayerMoney[ MAX_PLAYERS ]; if(!PlayerMoney[ playerid ]) PlayerMoney[ playerid ] = GetPlayerMoney(playerid); else { if(GetPlayerMoney(playerid) - PlayerMoney[ playerid ] == 100) { GivePlayerMoney(playerid, -100); } PlayerMoney[ playerid ] = GetPlayerMoney(playerid); } }
|
THX! there is a way to send to a determined person a ClientMessage to inform how much he gained?
As if He doesn't get 100, 1000, 10000 (for example), then sendclientmessage to a certain nickname with
"Player XYZ gained VALUE"
This would be awesome for me
Re: problem with a script -
Lynn - 08.07.2015
The code by dusk will only work if it equals 100, not above.
Also, it's not Adding money, it's subtracting. So anytime it equals 100, it'll drop to 0 almost instantly.