SA-MP Forums Archive
Food Dialog - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Food Dialog (/showthread.php?tid=152386)



Food Dialog - Anthony_Brassi - 04.06.2010

pawn Код:
if(listitem == 3)
              {
              if(PlayerInfo[playerid][pCash] < 251) return SendClientMessage(playerid,COLOR_GREY," Not Enough Cash!");
                 new Float:Health;
                 GetPlayerHealth(playerid,Health);
         if (Health > 81) return SendClientMessage(playerid, COLOR_GREY, " You can't buy anymore You'll get fat!!");
                 SetPlayerHealth(playerid,Health+20);
         PlayerInfo[playerid][pCash] -= 250;
         GivePlayerCash(playerid,-250);
    }
It Doesn't work In-game, any suggestions?


Re: Food Dialog - ViruZZzZ_ChiLLL - 04.06.2010

pawn Код:
if(listitem == 3)
 {
 if(PlayerInfo[playerid][pCash] < 251) return SendClientMessage(playerid,COLOR_GREY," Not Enough Cash!");
 if (Health > 81) return SendClientMessage(playerid, COLOR_GREY, " You can't buy anymore You'll get fat!!");
 new Float:Health;
 GetPlayerHealth(playerid,Health);
 SetPlayerHealth(playerid,Health+20);
 PlayerInfo[playerid][pCash] -= 250;
 GivePlayerCash(playerid,-250);
 }



Re: Food Dialog - Anthony_Brassi - 04.06.2010

Quote:
Originally Posted by ViruZZzZ_ChiLLL
pawn Код:
if(listitem == 3)
 {
 if(PlayerInfo[playerid][pCash] < 251) return SendClientMessage(playerid,COLOR_GREY," Not Enough Cash!");
 if (Health > 81) return SendClientMessage(playerid, COLOR_GREY, " You can't buy anymore You'll get fat!!");
 new Float:Health;
 GetPlayerHealth(playerid,Health);
 SetPlayerHealth(playerid,Health+20);
 PlayerInfo[playerid][pCash] -= 250;
 GivePlayerCash(playerid,-250);
 }
lawl that will work?
i thought getplayerhealth had to be before if(health)

EDIT: Thanks for fast reply

BUT, I was right =/ error 017: undefined symbol "Health"


Re: Food Dialog - ViruZZzZ_ChiLLL - 04.06.2010

Then put the new Float:Health on top of the others.
Then test it if it works


Re: Food Dialog - Anthony_Brassi - 04.06.2010

Quote:
Originally Posted by ViruZZzZ_ChiLLL
Then put the new Float:Health on top of the others.
Then test it if it works
Nope, and i also putting getplayerhealth under float(On Top of others)


Re: Food Dialog - PotH3Ad - 04.06.2010

pawn Код:
if(listitem == 3)
{
    if(PlayerInfo[playerid][pCash] < 251) return SendClientMessage(playerid,COLOR_GREY, "Not Enough Cash!");
    new Float:Health;
    GetPlayerHealth(playerid, Health);
    floatround(Health);
    if(Health > 81) return SendClientMessage(playerid, COLOR_GREY, " You can't buy anymore You'll get fat!!");
    SetPlayerHealth(playerid, Health+20);
    PlayerInfo[playerid][pCash] -= 250;
    GivePlayerCash(playerid, -250);
}



Re: Food Dialog - Anthony_Brassi - 04.06.2010

Quote:
Originally Posted by PotH3Ad
pawn Код:
if(listitem == 3)
{
    if(PlayerInfo[playerid][pCash] < 251) return SendClientMessage(playerid,COLOR_GREY, "Not Enough Cash!");
    new Float:Health;
    GetPlayerHealth(playerid, Health);
    floatround(Health);
    if(Health > 81) return SendClientMessage(playerid, COLOR_GREY, " You can't buy anymore You'll get fat!!");
    SetPlayerHealth(playerid, Health+20);
    PlayerInfo[playerid][pCash] -= 250;
    GivePlayerCash(playerid, -250);
}
lawl what in the world does floatround do, anyways ill try it


Re: Food Dialog - PotH3Ad - 04.06.2010

SA-MP Wiki: Floatround - Round a floating point number to an integer value.


Re: Food Dialog - Anthony_Brassi - 04.06.2010

Quote:
Originally Posted by PotH3Ad
SA-MP Wiki: Floatround - Round a floating point number to an integer value.
It didn't work, this is weird because I've done this before

pawn Код:
if(dialogid == 3)
    {
        if(response)
        {
            if(listitem == 0)
            {
      if(PlayerInfo[playerid][pCash] > 9999)
      {
      new Float:Armour;
            GetPlayerArmour(playerid,Armour);
      if(Armour > 0) return SendClientMessage(playerid, COLOR_GREY, " You can't buy more then 100 Armor!");
        SetPlayerArmour(playerid,Armour+100);
            PlayerInfo[playerid][pCash] -= 10000;
            GivePlayerCash(playerid, -10000);
                }
                else
              {
                SendClientMessage(playerid, COLOR_GREY, " Not enough cash for that !");
              }



Re: Food Dialog - PotH3Ad - 04.06.2010

Well, what happens when you select the health list item in-game, does it send you a message or simply not do anything at all?