[pomoc] Health problem

Započeo shadow22, Decembar 14, 2010, 23:46:03 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 2 gostiju pregledaju ovu temu.

Ovako...napravih ja menu u dialogu...i odo jest....sve oke sve radi...ali mi ne želi health stati na 100% nego ide preko 100% !
Kako da zaustavim health na 100%??

evo skripte:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
   new sendername[MAX_PLAYER_NAME];
new string[128];
new Float:health;
GetPlayerHealth(playerid, health);
if(response)
{
     if(dialogid == Dialog_burgmenu)
     {
       switch(listitem)
       {
           case 0:
           {
               if(GetPlayerMoney(playerid) < 5) return SendClientMessage(playerid, COLOR_GRAD4, "Nemas dovoljno novaca!");
               GivePlayerMoney(playerid, -5);
               SetPlayerHealth(playerid, health + 20);
               SendClientMessage(playerid,0x00FF0AFF,"Pojeo si hamburger!");
               ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0,1,1,0,1);
           }
           case 1:
           {
               if(GetPlayerMoney(playerid) < 20) return SendClientMessage(playerid, COLOR_GRAD4, "Nemas dovoljno novaca!");
               GivePlayerMoney(playerid, -20);
               SetPlayerHealth(playerid, health + 80);
               SendClientMessage(playerid,0x00FF0AFF,"Pojeo si kebab!");
               ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0,1,1,0,1);
           }
           case 2:
           {
if(GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid, COLOR_GRAD4, "Nemas dovoljno novaca!");
               GivePlayerMoney(playerid, -10);
               SetPlayerHealth(playerid, health + 40);
               SendClientMessage(playerid,0x00FF0AFF,"Pojeo si domace kobase!");
               ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0,1,1,0,1);
           }
           case 3:
           {
               if(GetPlayerMoney(playerid) < 15) return SendClientMessage(playerid, COLOR_GRAD4, "Nemas dovoljno novaca!");
               GivePlayerMoney(playerid, -15);
               SetPlayerHealth(playerid, health + 50);
               SendClientMessage(playerid,0x00FF0AFF,"Pojeo si burek!");
               ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0,1,1,0,1);
           }
           case 4:
           {
               if(GetPlayerMoney(playerid) < 4) return SendClientMessage(playerid, COLOR_GRAD4, "Nemas dovoljno novaca!");
               GivePlayerMoney(playerid, -4);
               SetPlayerHealth(playerid, health + 30);
               SendClientMessage(playerid,0x00FF0AFF,"Popio si Pan Pivo!");
               SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_BEER);

           }
  }
       }
Poslednja Izmena: Decembar 15, 2010, 07:30:05 PRE PODNE od shadow22

Zar nije jednostavnije ovako
SetPlayerHealth(playerid,30);
Cyb3r
           Roleplay
                        In progress by: tWix

Forum: Klik
IP: 62.75.247.14:9545

Citat: tWix poslato Decembar 14, 2010, 23:53:16 POSLE PODNE
Zar nije jednostavnije ovako
SetPlayerHealth(playerid,30);

misliš umjesto SetPlayerHealth(playerid + 20); ?
Poslednja Izmena: Decembar 14, 2010, 23:57:24 POSLE PODNE od shadow22

Aha...
Ovo SetPlayerHealth(playerid,30);   umesto SetPlayerHealth(playerid, health + 20);
Poslednja Izmena: Decembar 15, 2010, 00:01:39 PRE PODNE od tWix
Cyb3r
           Roleplay
                        In progress by: tWix

Forum: Klik
IP: 62.75.247.14:9545

Hvala ti probat ću! :)

EDIT: Ne raste sad health... ???
Poslednja Izmena: Decembar 15, 2010, 00:09:40 PRE PODNE od shadow22

Koji mod koristis?
Cyb3r
           Roleplay
                        In progress by: tWix

Forum: Klik
IP: 62.75.247.14:9545

Ma nule sam počeo...i sad mi tu baca probleme...nisam prije testo...

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new string[128];
new ime[MAX_PLAYER_NAME];
GetPlayerName(playerid, ime, sizeof(ime));
new Float:zivot;
GetPlayerHealth(playerid, zivot);
   if(dialogid == Dialog_burgmenu)
      {
        switch(listitem)
        {
            case 0:
            {
  format(string, sizeof(string), "%s je pojeo Hamburger!", ime);
  SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  GivePlayerMoney(playerid,-5);
    SetPlayerHealth(playerid, zivot + 45.0);
  ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0,1,1,0,1);
}
        case 1:
{
format(string, sizeof(string), "%s je pojeo kebab!", ime);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
GivePlayerMoney(playerid,-3);
   SetPlayerHealth(playerid, zivot + 45.0);
ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0,1,1,0,1);
}
case 2:
  {
  format(string, sizeof(string), "%s je pojeo domace kobasice!", ime);
  SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  GivePlayerMoney(playerid,-4);
  SetPlayerHealth(playerid, zivot + 45.0);
        ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0,1,1,0,1);
    }
     case 3:
    {
    format(string, sizeof(string), "%s je pojeo Burek!", ime);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    GivePlayerMoney(playerid,-2);
    SetPlayerHealth(playerid, zivot + 20.0);
        ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0,1,1,0,1);
      }
}
return 1;
        }


Itd. Slozi ti tebi dalje
Cyb3r
           Roleplay
                        In progress by: tWix

Forum: Klik
IP: 62.75.247.14:9545

ni dalje ne Å¡ljaka...ovaj kod mi uopće ne radi  ???


EDIT: Zna li itko pomoći????:'(
Poslednja Izmena: Decembar 15, 2010, 07:32:03 PRE PODNE od shadow22

Kako neradi ako je dobro, sta ti izbaci? Error, warning?
Aequam memento rebus in arduis servare mentem.

Citat: tWix poslato Decembar 15, 2010, 00:00:12 PRE PODNE
Aha...
Ovo SetPlayerHealth(playerid,30);   umesto SetPlayerHealth(playerid, health + 20);

Pričaš gluposti -.-'



Napravi ovako:


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new sendername[MAX_PLAYER_NAME];
new string[128];
new Float:health;
GetPlayerHealth(playerid, health);
if(response)
{
      if(dialogid == Dialog_burgmenu)
      {
        switch(listitem)
        {
            case 0:
            {
                if(GetPlayerMoney(playerid) < 5) return SendClientMessage(playerid, COLOR_GRAD4, "Nemas dovoljno novaca!");
                GivePlayerMoney(playerid, -5);
if(health+20 >= 100)
{
SetPlayerHealth(playerid,100);
SendClientMessage(playerid,0x00FF0AFF,"Pojeo si hamburger!");
                ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0,1,1,0,1);
return 1;
}
                SetPlayerHealth(playerid, health + 20);
                SendClientMessage(playerid,0x00FF0AFF,"Pojeo si hamburger!");
                ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0,1,1,0,1);
            }
            case 1:
            {
                if(GetPlayerMoney(playerid) < 20) return SendClientMessage(playerid, COLOR_GRAD4, "Nemas dovoljno novaca!");
                GivePlayerMoney(playerid, -20);
if(health+80 >= 100)
{
SetPlayerHealth(playerid,100);
SendClientMessage(playerid,0x00FF0AFF,"Pojeo si kebab!");
                ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0,1,1,0,1);
return 1;
}
                SetPlayerHealth(playerid, health + 80);
                SendClientMessage(playerid,0x00FF0AFF,"Pojeo si kebab!");
                ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0,1,1,0,1);
            }
            case 2:
            {
if(GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid, COLOR_GRAD4, "Nemas dovoljno novaca!");
                GivePlayerMoney(playerid, -10);
if(health+40 >= 100)
{
SetPlayerHealth(playerid,100);
SetPlayerHealth(playerid, health + 40);
                SendClientMessage(playerid,0x00FF0AFF,"Pojeo si domace kobase!");
return 1;
}
                SetPlayerHealth(playerid, health + 40);
                SendClientMessage(playerid,0x00FF0AFF,"Pojeo si domace kobase!");
                ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0,1,1,0,1);
            }
            case 3:
            {
                if(GetPlayerMoney(playerid) < 15) return SendClientMessage(playerid, COLOR_GRAD4, "Nemas dovoljno novaca!");
                GivePlayerMoney(playerid, -15);
if(health+50 >= 100)
{
SetPlayerHealth(playerid,100);
SendClientMessage(playerid,0x00FF0AFF,"Pojeo si burek!");
                ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0,1,1,0,1);
return 1;
}
                SetPlayerHealth(playerid, health + 50);
                SendClientMessage(playerid,0x00FF0AFF,"Pojeo si burek!");
                ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0,1,1,0,1);
            }
            case 4:
            {
                if(GetPlayerMoney(playerid) < 4) return SendClientMessage(playerid, COLOR_GRAD4, "Nemas dovoljno novaca!");
                GivePlayerMoney(playerid, -4);
if(health+30 >= 100)
{
SetPlayerHealth(playerid,100);
SendClientMessage(playerid,0x00FF0AFF,"Popio si Pan Pivo!");
                SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_BEER);
return 1;
}
                SetPlayerHealth(playerid, health + 30);
                SendClientMessage(playerid,0x00FF0AFF,"Popio si Pan Pivo!");
                SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_BEER);

            }
  }
        }