SA-MP Forums Archive
a question - 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: a question (/showthread.php?tid=272725)



a question - Madsen - 29.07.2011

is there a way to detect how much a player gets for each stunt he makes because i want to make a command where you can see how much you have earned overall in stuntbonus. i do not think i can describe it better xD


Re: a question - JackBauer. - 29.07.2011

It's not possible by a specifiec function, since there isn't a callback or a function to detect it but,
If you don't spend your game money in any other way or you don't spend it for fast-food resturant/drinks mechines
you could just create another variable for oldcash and compare it to GetPlayerMony which means
the difference between the oldcash to the newcash is the stunt money.


Re: a question - Mean - 29.07.2011

pawn Код:
new
    oldmoney[ MAX_PLAYERS ]
    ,newmoney[ MAX_PLAYERS ]
;

public OnPlayerUpdate( playerid ) {
    newmoney[ playerid ] = GetPlayerMoney( playerid );
    if( oldmoney[ playerid ] != newmoney[ playerid ] ) {
        new
            difference = newmoney[ playerid ] - oldmoney[ playerid ]
            ,pName[ 24 ]
        ;
        GetPlayerName( playerid, pName, 24 );
        printf( "Player %s has just earned/lost $%d.", pName, difference );
    }
    oldmoney[ playerid ] = GetPlayerMoney( playerid );
    return 1;
}
Untested, this should detect when a player gets/looses some money.


Re: a question - Madsen - 29.07.2011

thank you both for your answer