15.07.2012, 08:48
Hello,
Take a look at this code:
I went ingame and typed /test, and now see the results:
As you see it returns the old drunk level. I will create an easy workaround, but it's not the way it should be.
Another example; At some time I set the drunk level to 2000, then a timer to add +1000 each 30 seconds. Using GetPlayerDrunkLevel in the timer will return 0. I know it decreases, but not THAT hard
Jochem
Take a look at this code:
pawn Код:
if(!strcmp(cmdtext,"/test",true))
{
new currentLevel = GetPlayerDrunkLevel(playerid),newLevel = currentLevel + 1000,afterLevel;
SetPlayerDrunkLevel(playerid, newLevel);
afterLevel = GetPlayerDrunkLevel(playerid);
format(string,128,"Old level: %d, new level: %d, re-fetched: %d",currentLevel,newLevel,afterLevel);
SendClientMessage(playerid,-1,string);
}
Код:
[10:56:24] Old level: 0, new level: 1000, re-fetched: 0 [10:56:28] Old level: 850, new level: 1850, re-fetched: 850 [10:56:29] Old level: 1848, new level: 2848, re-fetched: 1848 [10:56:29] Old level: 2828, new level: 3828, re-fetched: 2828
Another example; At some time I set the drunk level to 2000, then a timer to add +1000 each 30 seconds. Using GetPlayerDrunkLevel in the timer will return 0. I know it decreases, but not THAT hard
Jochem