SA-MP Forums Archive
SetPlayerDrunkLevel percentage - 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)
+--- Thread: SetPlayerDrunkLevel percentage (/showthread.php?tid=455698)



SetPlayerDrunkLevel percentage - Drek - 02.08.2013

Hello,

I'd like to know if it is possible to make a percentage of total SetPlayerDrunkLevel.


Rather something like this:
Код:
SendClientMessage(WantAlcool[playerid], COLOR_WHITE, "%s to now %s gram (s) in the blood", sendername, SetPlayerDrunkLevel);
Thank you for answering future.


Re: SetPlayerDrunkLevel percentage - CaveDweller - 02.08.2013

The maximum drunk level is 50000, which makes 1% 500.

Here's a function to work out the percentage of maximum from the player's maximum drunk level:
pawn Код:
stock GetPlayerDrunkPercentage(playerid)
{
    return (GetPlayerDrunkLevel(playerid) / 50000) * 100;
}



Re : SetPlayerDrunkLevel percentage - Drek - 03.08.2013

Hello,

Thank you for this function, but uses it as well :

pawn Код:
SendClientMessage(WantAlcool[playerid], COLOR_WHITE, "%s to now %s gram (s) in the blood", sendername, GetPlayerDrunkPercentage(playerid));
Because when I use it in this way just a little warning and displays


Re: SetPlayerDrunkLevel percentage - Pottus - 03.08.2013

You should really read up this http://en.wikipedia.org/wiki/Blood_alcohol_content.
You will need to know your specific maximum not the absolute maximum.
Most people will lose the ability to function between 0.2 and 0.39 percent of alcohol (Passout etc)

Once you know all that then you'll need to decide what the maximum level would be in relation to percent of alcohol for example a max drunk level of 10,000 would say represent 0.40 percent BAL (A very dangerous level)

So we divide 0.40 / 10000 which gives us an intoxication level of 0.00004 percent per drunk level unit but you can really calculate this out how you want.


Re : SetPlayerDrunkLevel percentage - Drek - 03.08.2013

Thank you for these explanations.
I always have an error warning ..


Re : SetPlayerDrunkLevel percentage - Drek - 03.08.2013

UP...


Re: SetPlayerDrunkLevel percentage - Edix - 03.08.2013

What is the problem?
Show the error/warning


Re : SetPlayerDrunkLevel percentage - Drek - 03.08.2013

Hello

warning is :
Код:
C:\Users\packard bell\Desktop\San Andreas RP Dev\gamemodes\sarp.pwn(10301) : warning 202: number of arguments does not match definition
C:\Users\packard bell\Desktop\San Andreas RP Dev\gamemodes\sarp.pwn(10301) : warning 202: number of arguments does not match definition
ligne
pawn Код:
SendClientMessage(WantAlcool[playerid], COLOR_WHITE, "%s to now %s gram (s) in the blood", sendername, GetPlayerDrunkPercentage(playerid));



Re : SetPlayerDrunkLevel percentage - Drek - 04.08.2013

Hello,

The function does not work, it gives me a blank.
as its most prйsicement:
The player program in the blood.
So normally it is: The player to 10 grams in the blood, for example.