20.05.2016, 15:59
i create condition for hunger update every 5 second . but text just cange if value 100 and <0 this my code.
how to check range for example 1 to 10 = a, 11 to 20 = b, etc?
PHP Code:
if (PlayerInfo[playerid][pHunger] >91 && PlayerInfo[playerid][pHunger] <150 )
{
PlayerTextDrawSetString(playerid, tampilan[playerid][10], "IIIIIIIIII"); //tdies
}
if (PlayerInfo[playerid][pHunger] >81 && PlayerInfo[playerid][pHunger] <90 )
{
PlayerTextDrawSetString(playerid, tampilan[playerid][10], "IIIIIIIII"); //tdies
}
if (PlayerInfo[playerid][pHunger] >71 && PlayerInfo[playerid][pHunger] <80 )
{
PlayerTextDrawSetString(playerid, tampilan[playerid][10], "IIIIIIII"); //tdies
}
if (PlayerInfo[playerid][pHunger] >61 && PlayerInfo[playerid][pHunger] <70 )
{
PlayerTextDrawSetString(playerid, tampilan[playerid][10], "IIIIIII"); //tdies
}
if (PlayerInfo[playerid][pHunger] >51 && PlayerInfo[playerid][pHunger] <60 )
{
PlayerTextDrawSetString(playerid, tampilan[playerid][10], "IIIIII"); //tdies
}
if (PlayerInfo[playerid][pHunger] >41 && PlayerInfo[playerid][pHunger] <50 )
{
PlayerTextDrawSetString(playerid, tampilan[playerid][10], "IIIII"); //tdies
}
if (PlayerInfo[playerid][pHunger] >31 && PlayerInfo[playerid][pHunger] <40 )
{
PlayerTextDrawSetString(playerid, tampilan[playerid][10], "IIII"); //tdies
}
if (PlayerInfo[playerid][pHunger] >21 && PlayerInfo[playerid][pHunger] <30 )
{
PlayerTextDrawSetString(playerid, tampilan[playerid][10], "III"); //tdies
}
if (PlayerInfo[playerid][pHunger] >11 && PlayerInfo[playerid][pHunger] <20 )
{
PlayerTextDrawSetString(playerid, tampilan[playerid][10], "II"); //tdies
}
if (PlayerInfo[playerid][pHunger] >1 && PlayerInfo[playerid][pHunger] <10 )
{
PlayerTextDrawSetString(playerid, tampilan[playerid][10], "I"); //tdies
}