new Celota = 270;
new Enota = 270;
SetTimerEx("EnotaDol", 1000, true, "i", playerid);
public EnotaDol()
{
Enota --;
return 1;
}
stock Procenti(playerid)
{
new string[128];
new Procent;
Procent = floatround((Enota / Celota)*100, floatround_round);
format(string, sizeof(string),"There is currently %d Enot, which is exactly %.0f% percent!",Enota,float(Procent));
SendClientMessage(playerid,-1,string);
}
CMD:procenti(playerid, params[])
{
Procenti(playerid);
return 1;
}
new Float:CurrentPercent = (Enota/Celota)*100
printf("%f%%",CurrentPercent);
(220/250)*100 = 88.00%
stock Procenti(playerid)
{
new string[128];
new Float:CurrentPercent = (Enota/Celota)*100;
printf("%f%%",CurrentPercent);
format(string, sizeof(string),"There is currently %d Enot, which is exactly %.0f% percent!",Enota,CurrentPercent);
SendClientMessage(playerid,-1,string);
}
Not working properly first time it shows 100% but other numbers are displayed still as 0..
So what I'm trying to do is to reduce 270 for 1 every 1 second and display this in percentage everytime.. Added your code but not working properly pawn Код:
|
(Enota/Celota)*100;
((Enota/Celota) *100);
new Float:Celota = 270.0;
new Float:Enota = 270.0;
stock Procenti(playerid)
{
new string[128];
new Procent = floatround(((Enota / Celota) * 100.0), floatround_round);
format(string, sizeof(string),"There is currently %f Enot, which is exactly %.0f% percent!",Enota,float(Procent));
SendClientMessage(playerid,-1,string);
}
stock Procenti(playerid)
{
new string[128];
new Float:CurrentPercent = floatround ((100 * Enota) / Celota);
printf("%f%%",CurrentPercent);
format(string, sizeof(string),"There is currently %d Enot, which is exactly %.0f% percent!",Enota, CurrentPercent);
SendClientMessage(playerid,-1,string);
}