I suck at OnPlayerDeath :D
#1

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...
Reply
#2

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.
Reply
#3

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

pawn Код:
<
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
pawn Код:
>
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
Reply
#4

Код:
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.
Reply
#5

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.

Reply
#6

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;
Reply
#7

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.
Reply
#8

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)