View Full Version : Check if player gained something

03/10/2011, 04:43 PM
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.

03/10/2011, 04:50 PM
for the last one you can use

new animlib[32], animtmp[32];
GetAnimationName(GetPlayerAnimationIndex(playerid) ,animlib,32,animtmp,32);

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

03/10/2011, 04:56 PM
Thanks! For other questions waiting answers

03/10/2011, 06:10 PM
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.

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.