I suck at OnPlayerDeath :D -
coole210 - 08.08.2009
pawn Код:
if(Hitman[killerid] && Mayor[playerid])
{
if(GetPlayerMoney(playerid < 500)) return 1;
GivePlayerMoney(playerid,-500);
GivePlayerMoney(killerid,500);
ShitInfo[killerid][pWanted] = 1;
SendClientMessage(killerid,TEAM_POLICE_COLOR,"[ ! ] [ POLICE ] You are now wanted for 'KILLED A PLAYER'");
SetPlayerColor(killerid,c_r);
}
Okay thats my code but when i kill the mayor and he has more than 500 dollars it doesnt do anything...
Re: I suck at OnPlayerDeath :D -
Chrham_2 - 08.08.2009
That is because you have this line:
if(GetPlayerMoney(playerid < 500)) return 1;
it checks if Mayor has $500,
but that means if it is over $500,
then it is aborted.
So just simply delete that line, and make him
in debt.
Re: I suck at OnPlayerDeath :D -
Burridge - 08.08.2009
You want it so if he has over 500 it does it? Then change the
pawn Код:
if(GetPlayerMoney(playerid < 500)) return 1;
to
pawn Код:
if(GetPlayerMoney(playerid > 500)) return 1;
As you can see what you had done was use
Which means "Less than" So you were doing Less than 500 which means if he had more than 500 it wasen't doing what you wanted it to do. So what i've done is put a
Instead, which means more than, so if he has mroe than 500, the function calls.
EDIT:
Diden't see the guy above had posted, you could use his method aswell. :P
Re: I suck at OnPlayerDeath :D -
XPlatform - 08.08.2009
Код:
if(GetPlayerMoney(playerid) > 500) return 1;
GetPlayerMoney returns the player money without using a referenced parameter, so you should compare the returned value to a value outside the function's brackets.
Re: I suck at OnPlayerDeath :D -
Burridge - 08.08.2009
Quote:
Originally Posted by CodeMatrix
Код:
if(GetPlayerMoney(playerid) > 500) return 1;
GetPlayerMoney returns the player money without using a referenced parameter, so you should compare the returned value to a value outside the function's brackets.
|
You're missing the extra bracket,
Код:
if(GetPlayerMoney(playerid) > 500)) return 1;
Remember playerid also has a bracket, so it needs that extra one at the end, or it won't work.
Re: I suck at OnPlayerDeath :D -
XPlatform - 08.08.2009
Quote:
Originally Posted by Burridge
Quote:
Originally Posted by CodeMatrix
Код:
if(GetPlayerMoney(playerid) > 500) return 1;
GetPlayerMoney returns the player money without using a referenced parameter, so you should compare the returned value to a value outside the function's brackets.
|
You're missing the extra bracket,
Код:
if(GetPlayerMoney(playerid) > 500)) return 1;
Remember playerid also has a bracket, so it needs that extra one at the end, or it won't work.
|
..? 2 opening brackets, 2 closing brackets... it's correct
Код:
if(GetPlayerMoney(playerid) > 500) return 1;
Re: I suck at OnPlayerDeath :D -
Burridge - 08.08.2009
Quote:
Originally Posted by CodeMatrix
Quote:
Originally Posted by Burridge
Quote:
Originally Posted by CodeMatrix
Код:
if(GetPlayerMoney(playerid) > 500) return 1;
GetPlayerMoney returns the player money without using a referenced parameter, so you should compare the returned value to a value outside the function's brackets.
|
You're missing the extra bracket,
Код:
if(GetPlayerMoney(playerid) > 500)) return 1;
Remember playerid also has a bracket, so it needs that extra one at the end, or it won't work.
|
..? 2 opening brackets, 2 closing brackets... it's correct
Код:
if(GetPlayerMoney(playerid) > 500) return 1;
|
Ohh, I see what you did. Sorry.
Re: I suck at OnPlayerDeath :D -
XPlatform - 08.08.2009