Check if player gained something
#1

Is there any Includes that checks:
1. If player recieved money
2. If player recieved wanted level
3. If player is running [SOLVED]

These includes must not use much of memory.
Thanks!
Reply
#2

for the last one you can use

pawn Код:
new animlib[32], animtmp[32];
GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animtmp,32);

if(!strcmp(animtmp, "run_civi",true))//so the player is running
Reply
#3

Thanks! For other questions waiting answers
Reply
#4

You could create a timer which runs every second or so.
In this timer, you get the player's money and wanted level and store those values somewhere.
As the timer runs again after a second, you get the money and wanted level again and check it against the previous values.
By storing the values when they have increased, you make sure you only get the message once.

pawn Код:
enum PlayerData
{
    Money, WantedLevel
}
new pData[MAX_PLAYERS][PlayerData];


SetTimer("Timer1", 1000, true);


forward Timer1();
public Timer1()
{
    new pMoney, Wanted;

    for (new playerid; playerid < MAX_PLAYERS; playerid++)
    {
        pMoney = GetPlayerMoney(playerid);
        Wanted = GetPlayerWantedLevel(playerid);

        if (pMoney > pData[playerid][Money])
        {
            pData[playerid][Money] = pMoney;
            SendClientMessage(playerid, 0xFFFFFFFF, "You've earned money");
        }
        if (Wanted > pData[playerid][WantedLevel])
        {
            pData[playerid][WantedLevel] = Wanted;
            SendClientMessage(playerid, 0xFFFFFFFF, "Your wanted level has increased");
        }
    }
}
Something like this is small and can be used for such things.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)