Szerző Téma: Bank parancs probléma  (Megtekintve 470 alkalommal)

Nem elérhető KrisT

  • 106
    • Profil megtekintése
Bank parancs probléma
« Dátum: 2014. Augusztus 27. - 12:19:34 »
0 Show voters
Sziasztok! Egy bank parancsot csináltam, és úgy akartam, hogy /bank [betesz/kivesz] [összeg]
De mikor beirom: /bank betesz X(egy összeget), akkor kiirja a használatát. Szerintem biztos az if(sscanf-nál rontottam el valamit, de nemtudom hogyan javitsam, mert ilyet még nem csináltam. Leirnátok helyesen a parancsot kérlek, és elmondanátok, mi volt vele a baj?
 

CMD:bank(playerid, params[])
{
if(IsPlayerConnected(playerid) && Belepve[playerid] == 1)
{
        new penzmennyiseg;
        if(IsPlayerInRangeOfPoint(playerid,2,1462.2986,-1010.1807,26.8438))
    {
        if(!strcmp(params, \"betesz\", true))
        {
            if(sscanf(params,\"i\",penzmennyiseg)) return MSG(playerid,COLOR_LIGHTRED,\"Használata: /bank betesz [összeg]\");
      {
          if(JatekosInfo[playerid][Penz] >> 0)
          {
              new uzenet[128];
            JatekosInfo[playerid][Penz] -= penzmennyiseg;
            JatekosInfo[playerid][bank] += penzmennyiseg;
              TextDrawShowForPlayer(playerid,infovonal[playerid]);
              format(uzenet,sizeof(uzenet),\"Sikeresen betettél a bankba %d Forintot!\",penzmennyiseg);
              MSG(playerid,COLOR_LIGHTRED,\"uzenet\");
            new szoveg[128];
            format(szoveg,sizeof(szoveg),\"Bank: %d | Szint: %d | Adminszint: %d\",JatekosInfo[playerid][bank],JatekosInfo[playerid][szint], JatekosInfo[playerid] [AdminSzint]);
            TextDrawSetString(infovonal[playerid],szoveg);
            TextDrawShowForPlayer(playerid, Box[playerid]);
            TextDrawShowForPlayer(playerid, Ft[playerid]);
         }
         else MSG(playerid,COLOR_LIGHTRED,\"Mégis, mit szeretnél betenni a bankba? o.O\");
      }
    }
    else if(!strcmp(params, \"kivesz\", true))
    {
            if(sscanf(params,\"i\",penzmennyiseg)) return MSG(playerid,COLOR_LIGHTRED,\"Használata: /bank kivesz [összeg]\");
      {
          if(JatekosInfo[playerid][bank] >> 0)
          {
              new uzenet[128];
            JatekosInfo[playerid][Penz] += penzmennyiseg;
            JatekosInfo[playerid][bank] -= penzmennyiseg;
              TextDrawShowForPlayer(playerid,infovonal[playerid]);
              format(uzenet,sizeof(uzenet),\"Sikeresen kivettél a bankból %d Forintot!\",penzmennyiseg);
              MSG(playerid,COLOR_LIGHTRED,\"uzenet\");
            new szoveg[128];
            format(szoveg,sizeof(szoveg),\"Bank: %d | Szint: %d | Adminszint: %d\",JatekosInfo[playerid][bank],JatekosInfo[playerid][szint], JatekosInfo[playerid] [AdminSzint]);
            TextDrawSetString(infovonal[playerid],szoveg);
            TextDrawShowForPlayer(playerid, Box[playerid]);
            TextDrawShowForPlayer(playerid, Ft[playerid]);
         }
         else MSG(playerid,COLOR_LIGHTRED,\"Mégis, mit szeretnél kivenni a bankból? o.O\");
      }
   }
   else SendClientMessage(playerid, COLOR_LIGHTGREEN, \"/bank [betesz/kivesz] [összeg]\");
}
else MSG(playerid,COLOR_LIGHTRED,\"Nem vagy a Bank bejárata elõtt!\");
}
else MSG(playerid,COLOR_LIGHTRED,\"Nem vagy bejelentkezve!\");
return 1;
}

 
[mod]Javítottam helyetted a nem létezõ

taget

tagre![/mod]
« Utoljára szerkesztve: 2014. Augusztus 27. - 16:54:35 írta Dfoglalo »

Bank parancs probléma
« Válasz #1 Dátum: 2014. Augusztus 27. - 12:29:18 »
0 Show voters
if(sscanf...) után elég a return, nem kell alá {.
Próbáld így:
 

CMD:bank(playerid, params[])
{
        if(IsPlayerConnected(playerid) && Belepve[playerid] == 1)
        {
        new penzmennyiseg;
        if(IsPlayerInRangeOfPoint(playerid,2,1462.2986,-1010.1807,26.8438))
            {
                if(!strcmp(params, \"betesz\", true))
                {
                                if(sscanf(params,\"i\",penzmennyiseg)) return MSG(playerid,COLOR_LIGHTRED,\"Használata: /bank betesz [összeg]\");
                                    if(JatekosInfo[playerid][Penz] >> 0)
                                    {
                                        new uzenet[128];
                                                JatekosInfo[playerid][Penz] -= penzmennyiseg;
                                                JatekosInfo[playerid][bank] += penzmennyiseg;
                                                TextDrawShowForPlayer(playerid,infovonal[playerid]);
                                                format(uzenet,sizeof(uzenet),\"Sikeresen betettél a bankba %d Forintot!\",penzmennyiseg);
                                                MSG(playerid,COLOR_LIGHTRED,\"uzenet\");
                                                new szoveg[128];
                                                format(szoveg,sizeof(szoveg),\"Bank: %d | Szint: %d | Adminszint: %d\",JatekosInfo[playerid][bank],JatekosInfo[playerid][szint], JatekosInfo[playerid] [AdminSzint]);
                                                TextDrawSetString(infovonal[playerid],szoveg);
                                                TextDrawShowForPlayer(playerid, Box[playerid]);
                                                TextDrawShowForPlayer(playerid, Ft[playerid]);
                                        }
                                        else MSG(playerid,COLOR_LIGHTRED,\"Mégis, mit szeretnél betenni a bankba? o.O\");
                        }
                        else if(!strcmp(params, \"kivesz\", true))
                        {
                                if(sscanf(params,\"i\",penzmennyiseg)) return MSG(playerid,COLOR_LIGHTRED,\"Használata: /bank kivesz [összeg]\");
                                    if(JatekosInfo[playerid][bank] >> 0)
                                    {
                                        new uzenet[128];
                                                JatekosInfo[playerid][Penz] += penzmennyiseg;
                                                JatekosInfo[playerid][bank] -= penzmennyiseg;
                                                TextDrawShowForPlayer(playerid,infovonal[playerid]);
                                                format(uzenet,sizeof(uzenet),\"Sikeresen kivettél a bankból %d Forintot!\",penzmennyiseg);
                                                MSG(playerid,COLOR_LIGHTRED,\"uzenet\");
                                                new szoveg[128];
                                                format(szoveg,sizeof(szoveg),\"Bank: %d | Szint: %d | Adminszint: %d\",JatekosInfo[playerid][bank],JatekosInfo[playerid][szint], JatekosInfo[playerid] [AdminSzint]);
                                                TextDrawSetString(infovonal[playerid],szoveg);
                                                TextDrawShowForPlayer(playerid, Box[playerid]);
                                                TextDrawShowForPlayer(playerid, Ft[playerid]);
                                        }
                                        else MSG(playerid,COLOR_LIGHTRED,\"Mégis, mit szeretnél kivenni a bankból? o.O\");
                        }
                        else SendClientMessage(playerid, COLOR_LIGHTGREEN, \"/bank [betesz/kivesz] [összeg]\");
                }
                else MSG(playerid,COLOR_LIGHTRED,\"Nem vagy a Bank bejárata elõtt!\");
        }
        else MSG(playerid,COLOR_LIGHTRED,\"Nem vagy bejelentkezve!\");
        return 1;
}

 
[mod]Javítottam helyetted a

taget

tagre![/mod]
« Utoljára szerkesztve: 2014. Augusztus 27. - 16:54:51 írta Dfoglalo »

Nem elérhető KrisT

  • 106
    • Profil megtekintése
Bank parancs probléma
« Válasz #2 Dátum: 2014. Augusztus 27. - 17:21:31 »
0 Show voters
Ismét a megoldókulcsot M4A1 -nek köszönhetem!
A helyes:
 
CMD:bank(playerid, params[])
{
if(Belepve[playerid])
{
new penzmennyiseg, param1[128];
if(IsPlayerInRangeOfPoint(playerid,2,1462.2986,-1010.1807,26.8438))
{
   if(sscanf(params, \"s[7]i\", param1, penzmennyiseg)) return SendClientMessage(playerid, COLOR_LIGHTRED, \"Használata: /bank <Betesz/Kivesz> [összeg]\"), 1;
   else
   {
      if(!strcmp(param1, \"betesz\", true))
      {
         if(JatekosInfo[playerid][Penz] > 0)
         {
            new uzenet[128];
            JatekosInfo[playerid][Penz] -= penzmennyiseg;
            JatekosInfo[playerid][bank] += penzmennyiseg;
            TextDrawShowForPlayer(playerid,infovonal[playerid]);
            format(uzenet,sizeof(uzenet),\"Sikeresen betettél a bankba %d Forintot!\",penzmennyiseg);
            MSG(playerid,COLOR_LIGHTRED,\"uzenet\");
            new szoveg[128];
            format(szoveg,sizeof(szoveg),\"Bank: %d | Szint: %d | Adminszint: %d\",JatekosInfo[playerid][bank],JatekosInfo[playerid][szint], JatekosInfo[playerid] [AdminSzint]);
            TextDrawSetString(infovonal[playerid],szoveg);
            TextDrawShowForPlayer(playerid, Box[playerid]);
            TextDrawShowForPlayer(playerid, Ft[playerid]);
         }
         else MSG(playerid,COLOR_LIGHTRED,\"Mégis, mit szeretnél betenni a bankba? o.O\");
      }
      else if(!strcmp(param1, \"kivesz\", true))
      {
         if(JatekosInfo[playerid][bank] > 0)
         {
            new uzenet[128];
            JatekosInfo[playerid][Penz] += penzmennyiseg;
            JatekosInfo[playerid][bank] -= penzmennyiseg;
            TextDrawShowForPlayer(playerid,infovonal[playerid]);
            format(uzenet,sizeof(uzenet),\"Sikeresen kivettél a bankból %d Forintot!\",penzmennyiseg);
            MSG(playerid,COLOR_LIGHTRED,\"uzenet\");
            new szoveg[128];
            format(szoveg,sizeof(szoveg),\"Bank: %d | Szint: %d | Adminszint: %d\",JatekosInfo[playerid][bank],JatekosInfo[playerid][szint], JatekosInfo[playerid] [AdminSzint]);
            TextDrawSetString(infovonal[playerid],szoveg);
            TextDrawShowForPlayer(playerid, Box[playerid]);
            TextDrawShowForPlayer(playerid, Ft[playerid]);
         }
         else MSG(playerid,COLOR_LIGHTRED,\"Mégis, mit szeretnél kivenni a bankból? o.O\");
      }
      else SendClientMessage(playerid, COLOR_LIGHTGREEN, \"/bank [betesz/kivesz] [összeg]\");
   }
}
else MSG(playerid,COLOR_LIGHTRED,\"Nem vagy a Bank bejárata elõtt!\");
}
else MSG(playerid,COLOR_LIGHTRED,\"Nem vagy bejelentkezve!\");
return 1;
}
 

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal