Problem sa trafikom

Započeo Xladen, Januar 18, 2018, 18:42:16 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Detaljan opis problema: Kada otvorim dialog i kupim nesto nista ne dobijem i ne skida mi novac.
Dio skripte:
CMD:
[pawn]
CMD:trafika(playerid, params[])
{

    if(UlogovanProvera[playerid] == 0) return Ulogovan(playerid);
    if(IsPlayerInAnyVehicle( playerid )) return SCM(playerid,-1,""CRVENA"[GRESKA] "BELA"Moras biti van vozila!");
    if(IsPlayerInRangeOfPoint(playerid, 2.0, -2540.9431, 2292.0476, 4.9844) || IsPlayerInRangeOfPoint(playerid, 2.0, -2278.4382, 2312.0273, 4.9659) || IsPlayerInRangeOfPoint(playerid, 2.0, -2565.6521, 2469.9983, 19.4087) || IsPlayerInRangeOfPoint(playerid, 2.0, -1472.1143, 2642.0332, 55.8359) || IsPlayerInRangeOfPoint(playerid, 2.0, -1525.1388, 2544.7451, 55.8359))
   SPD(playerid, DIALOG_TRAFIKA, DIALOG_STYLE_LIST, ""BELA"Trafika", ""HZELENA"- "BELA"Dopuna (20$)\n"HZELENA"- "BELA"Dopuna (50$)\n"HZELENA"- "BELA"Dopuna (100$)\n"HZELENA"- "BELA"Sok (10$)\n"HZELENA"- "BELA"Cigare (20$)\n"HZELENA"- "BELA"Upaljac (10$)\n"HZELENA"- "BELA"Cokoladica (10$)\n"HZELENA"- "BELA"Mp3 (100$)\n", "Odaberi", "Izlaz");
    else return SCM(playerid,-1,""CRVENA"[GRESKA] "BELA"Nisi kod trafike!");
   return 1;
}[/pawn]


[pawn]
    if(dialogid == DIALOG_TRAFIKA)
   {
      if(!response) return 1;
      if(FirmaInfo[KioskKupovina[playerid]][fProizvodi] <= 0) return SCM(playerid,-1,""ZPLAVA"[Trafika]: "BELA"Nemamo vise proizvoda!");
      FirmaInfo[KioskKupovina[playerid]][fProizvodi]--;
      switch(listitem)
      {
         case 0:
         {
            if(PlayerInfo[playerid][pMobilni] == 0) return SCM(playerid,-1, ""HZELENA"[BE:RPBE:RP] "SIVA"Nemate mobilni telefon!");
               if(PlayerInfo[playerid][pNovacDzep] < 20) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Nemate dovoljno novca 20$!");
                SCM(playerid,-1,""ZUTA"[INFO] "SIVA"Kupili ste 20 kredita za 20$!");
            PlayerInfo[playerid][pMobKredit] += 20;
            g_NovacMinus(playerid,20);
            FirmaNovac(KioskKupovina[playerid],20);
            SavePlayer(playerid);
         }
         case 1:
         {
            if(PlayerInfo[playerid][pMobilni] == 0) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Nemate mobilni telefon!");
               if(PlayerInfo[playerid][pNovacDzep] < 50) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Nemate dovoljno novca 50$!");
                SCM(playerid,-1,""ZUTA"[INFO] "SIVA"Kupili ste 50 kredita za 50$!");
            PlayerInfo[playerid][pMobKredit] += 50;
            g_NovacMinus(playerid,50);
            FirmaNovac(KioskKupovina[playerid],50);
            SavePlayer(playerid);
         }
         case 2:
         {
             if(PlayerInfo[playerid][pMobilni] == 0) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Nemate mobilni telefon!");
               if(PlayerInfo[playerid][pNovacDzep] < 100) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Nemate dovoljno novca 100$!");
                SCM(playerid,-1,""ZUTA"[INFO] "SIVA"Kupili ste 100 kredita za 100$!");
            PlayerInfo[playerid][pMobKredit] += 100;
            g_NovacMinus(playerid,100);
            FirmaNovac(KioskKupovina[playerid],100);
            SavePlayer(playerid);
         }
         case 3:
         {
               if(PlayerInfo[playerid][pNovacDzep] < 10) return SCM(playerid,-1, ""HZELENA"[BE]"SIVA"Nemate dovoljno novca 10$!");
                SCM(playerid,-1,""ZUTA"[INFO] "SIVA"Kupili ste sok za 10$!");
                SetPlayerSpecialAction( playerid, SPECIAL_ACTION_DRINK_SPRUNK);
            g_NovacMinus(playerid,10);
            FirmaNovac(KioskKupovina[playerid],10);
         }
         case 4:
         {
            if(PlayerInfo[playerid][pCigare] != 0) return SCMF(playerid,-1,""HZELENA"[BE] "SIVA"Vec imas %d cigara prvo ih popusi!",PlayerInfo[playerid][pCigare]);
               if(PlayerInfo[playerid][pNovacDzep] < 20) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Nemate dovoljno novca 20$!");
                SCM(playerid,-1,""ZUTA"[INFO] "SIVA"Kupili ste cigare | Sada mozete zapliti cigaru (/zapalicigaru | /ugasicigaru)!");
            PlayerInfo[playerid][pCigare] = 20;
            g_NovacMinus(playerid,20);
            FirmaNovac(KioskKupovina[playerid],20);
            SavePlayer(playerid);
         }
         case 5:
         {
            if(PlayerInfo[playerid][pUpaljac] == 1) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Vec posedujes upaljac!");
               if(PlayerInfo[playerid][pNovacDzep] < 10) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Nemate dovoljno novca 10$!");
                SCM(playerid,-1,""ZUTA"[INFO] "SIVA"Kupili ste upaljac za 10$!");
            PlayerInfo[playerid][pUpaljac] = 10;
            g_NovacMinus(playerid,10);
            FirmaNovac(KioskKupovina[playerid],10);
            SavePlayer(playerid);
         }
         case 6:
         {
             new string[128];
             if(PlayerInfo[playerid][pNovacDzep] < 10) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Nemate dovoljno novca 10$!");
             new Float:hp, Float:nhp; GetPlayerHealth(playerid, hp);
            nhp = floatadd(hp, 10.0); g_SetPlayerHealth(playerid, nhp);
            if(nhp > 99.0) g_SetPlayerHealth(playerid, 99.0);
            if(nhp >= 99.0) return SCM(playerid,-1,"[BE] "HZELENA"Niste gladni!");
            format(string, sizeof(string), "* %s jede cokoladicu.", GetName(playerid));
             ProxDetector(15.0, playerid, string, PROX,PROX,PROX,PROX,PROX);
             OnePlayAnim(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0);
             g_NovacMinus(playerid,10);
            FirmaNovac(KioskKupovina[playerid],10);
         }
         case 7:
         {
            if(PlayerInfo[playerid][pMp3] == 1) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Vec posedujes mp3!");
               if(PlayerInfo[playerid][pNovacDzep] < 100) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Nemate dovoljno novca 50$!");
                SCM(playerid,-1,""ZUTA"[INFO] "SIVA"Kupili ste mp3 za 100$ | koriscenje : /mp3 !");
            PlayerInfo[playerid][pMp3] = 1;
            g_NovacMinus(playerid,100);
            FirmaNovac(KioskKupovina[playerid],100);
            SavePlayer(playerid);
         }
      }
   }[/pawn]
Neke slike/video za lakse dobivanje pomoci(neobavezno):

[pawn]g_NovacMinus(playerid,100);[/pawn]

Zameni sa ovim

[pawn]g_NovacMinus(playerid, 100);[/pawn]

Tj. sta da uradis probaj da odvojis ovde kod playerid,100 da odvojis playerid, 100 Probaj tako
Hejtanje u krvi!

Citat: Belic poslato Januar 19, 2018, 11:39:59 PRE PODNE
[pawn]g_NovacMinus(playerid,100);[/pawn]

Zameni sa ovim

[pawn]g_NovacMinus(playerid, 100);[/pawn]

Tj. sta da uradis probaj da odvojis ovde kod playerid,100 da odvojis playerid, 100 Probaj tako
Molim te cuti...

Facebook - Klik




samo kod trafike ti je tako ili kod svega gdje koristić g_novacMinus?

Nisam siguran ali probaj ovako

if(dialogid == DIALOG_TRAFIKA)
{
if(response)
  {
if(FirmaInfo[KioskKupovina[playerid]][fProizvodi] <= 0) return SCM(playerid,-1,""ZPLAVA"[Trafika]: "BELA"Nemamo vise proizvoda!");
FirmaInfo[KioskKupovina[playerid]][fProizvodi]--;
switch(listitem)
{
case 0:
{
if(PlayerInfo[playerid][pMobilni] == 0) return SCM(playerid,-1, ""HZELENA"[BE:RPBE:RP] "SIVA"Nemate mobilni telefon!");
    if(PlayerInfo[playerid][pNovacDzep] < 20) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Nemate dovoljno novca 20$!");
                SCM(playerid,-1,""ZUTA"[INFO] "SIVA"Kupili ste 20 kredita za 20$!");
PlayerInfo[playerid][pMobKredit] += 20;
g_NovacMinus(playerid,20);
FirmaNovac(KioskKupovina[playerid],20);
SavePlayer(playerid);
}
case 1:
{
if(PlayerInfo[playerid][pMobilni] == 0) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Nemate mobilni telefon!");
    if(PlayerInfo[playerid][pNovacDzep] < 50) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Nemate dovoljno novca 50$!");
                SCM(playerid,-1,""ZUTA"[INFO] "SIVA"Kupili ste 50 kredita za 50$!");
PlayerInfo[playerid][pMobKredit] += 50;
g_NovacMinus(playerid,50);
FirmaNovac(KioskKupovina[playerid],50);
SavePlayer(playerid);
}
case 2:
{
    if(PlayerInfo[playerid][pMobilni] == 0) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Nemate mobilni telefon!");
    if(PlayerInfo[playerid][pNovacDzep] < 100) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Nemate dovoljno novca 100$!");
                SCM(playerid,-1,""ZUTA"[INFO] "SIVA"Kupili ste 100 kredita za 100$!");
PlayerInfo[playerid][pMobKredit] += 100;
g_NovacMinus(playerid,100);
FirmaNovac(KioskKupovina[playerid],100);
SavePlayer(playerid);
}
case 3:
{
    if(PlayerInfo[playerid][pNovacDzep] < 10) return SCM(playerid,-1, ""HZELENA"[BE]"SIVA"Nemate dovoljno novca 10$!");
                SCM(playerid,-1,""ZUTA"[INFO] "SIVA"Kupili ste sok za 10$!");
                SetPlayerSpecialAction( playerid, SPECIAL_ACTION_DRINK_SPRUNK);
g_NovacMinus(playerid,10);
FirmaNovac(KioskKupovina[playerid],10);
}
case 4:
{
if(PlayerInfo[playerid][pCigare] != 0) return SCMF(playerid,-1,""HZELENA"[BE] "SIVA"Vec imas %d cigara prvo ih popusi!",PlayerInfo[playerid][pCigare]);
    if(PlayerInfo[playerid][pNovacDzep] < 20) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Nemate dovoljno novca 20$!");
                SCM(playerid,-1,""ZUTA"[INFO] "SIVA"Kupili ste cigare | Sada mozete zapliti cigaru (/zapalicigaru | /ugasicigaru)!");
PlayerInfo[playerid][pCigare] = 20;
g_NovacMinus(playerid,20);
FirmaNovac(KioskKupovina[playerid],20);
SavePlayer(playerid);
}
case 5:
{
if(PlayerInfo[playerid][pUpaljac] == 1) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Vec posedujes upaljac!");
    if(PlayerInfo[playerid][pNovacDzep] < 10) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Nemate dovoljno novca 10$!");
                SCM(playerid,-1,""ZUTA"[INFO] "SIVA"Kupili ste upaljac za 10$!");
PlayerInfo[playerid][pUpaljac] = 10;
g_NovacMinus(playerid,10);
FirmaNovac(KioskKupovina[playerid],10);
SavePlayer(playerid);
}
case 6:
{
    new string[128];
    if(PlayerInfo[playerid][pNovacDzep] < 10) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Nemate dovoljno novca 10$!");
    new Float:hp, Float:nhp; GetPlayerHealth(playerid, hp);
nhp = floatadd(hp, 10.0); g_SetPlayerHealth(playerid, nhp);
if(nhp > 99.0) g_SetPlayerHealth(playerid, 99.0);
if(nhp >= 99.0) return SCM(playerid,-1,"[BE] "HZELENA"Niste gladni!");
format(string, sizeof(string), "* %s jede cokoladicu.", GetName(playerid));
    ProxDetector(15.0, playerid, string, PROX,PROX,PROX,PROX,PROX);
    OnePlayAnim(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0);
    g_NovacMinus(playerid,10);
FirmaNovac(KioskKupovina[playerid],10);
}
case 7:
{
if(PlayerInfo[playerid][pMp3] == 1) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Vec posedujes mp3!");
    if(PlayerInfo[playerid][pNovacDzep] < 100) return SCM(playerid,-1, ""HZELENA"[BE] "SIVA"Nemate dovoljno novca 50$!");
                SCM(playerid,-1,""ZUTA"[INFO] "SIVA"Kupili ste mp3 za 100$ | koriscenje : /mp3 !");
PlayerInfo[playerid][pMp3] = 1;
g_NovacMinus(playerid,100);
FirmaNovac(KioskKupovina[playerid],100);
SavePlayer(playerid);
}
}
}
}

Facebook - Klik



Citat: Belic poslato Januar 19, 2018, 11:39:59 PRE PODNE
[pawn]g_NovacMinus(playerid,100);[/pawn]

Zameni sa ovim

[pawn]g_NovacMinus(playerid, 100);[/pawn]

Tj. sta da uradis probaj da odvojis ovde kod playerid,100 da odvojis playerid, 100 Probaj tako
Kakve to veze ma?
Oduvek sam se pitao:
"Zbog cega se ljudi toliko brinu jedni za druge?",
"Zasto ljudi daju sve od sebe da usrece neku osobu?"

Najjednostavnije receno brinu se jer vole tu osobu celim svojim srcem,
daju sve od sebe da je usrece zbog toga sto ne zele da je ikada vide tuznom ili rasplakanom.
#xsarnaaparatima..


I dalje ne radi.Pokusao sam Shomi to sto si mi poslao
Kada pokusam da kupim u konzoli ispise ovo:
[debug] Run time error 4: "Array index out of bounds"
[debug]  Accessing element at negative index -1
[debug] AMX backtrace:
[debug] #0 001e1cd0 in ?? (0, 222, 1, 5, 22570212) from Exin.amx
[debug] #1 0000ad84 in public OnDialogResponse (0, 222, 1, 5, 22570212) from Exin.amx
Poslednja Izmena: Januar 19, 2018, 18:57:57 POSLE PODNE od Xladen