[Pomoc]/ticket bug

Započeo [BURPG] Wistaa, Decembar 11, 2011, 00:56:13 PRE PODNE

prethodna tema - sledeća tema

0 članova i 2 gostiju pregledaju ovu temu.

Evo ovako Editujem: Raven's Roleplay

Opis problema: Npr sada si policajac i kazes frendu ajde napravi novi profil ja cu ti pisati kazne i kasnije podijelimo.To rade ovako npr igrac ima 500$ a on njemu pise  /ticket [id] 50000 ovaj ode u minus a ovaj dobiva pare tako onda ovaj poslije udje na svoj pravi profil podijele pare i tako zaradjuju

Dio skripte:

       }
   if(strcmp(cmd, "/ticket", true) == 0)
   {
       if(IsPlayerConnected(playerid))
       {
           if(gTeam[playerid] != 2)
         {
             SendClientMessage(playerid, COLOR_GREY, "** Niste Policajac!");
             return 1;
         }
         if(PlayerInfo[playerid][pDBanned] == 1)
         {
             SendClientMessage(playerid, COLOR_GREY, "** Ti si suspendovan sa policijske duznosti!");
             return 1;
         }
           if(PlayerInfo[playerid][pDuty] != 1 && PlayerInfo[playerid][pMember] == 1)
         {
             SendClientMessage(playerid, COLOR_GREY, "** Nisi na duznosti!");
             return 1;
         }
          tmp = strtok(cmdtext, idx);
         if(!strlen(tmp))
         {
            SendClientMessage(playerid, COLOR_GRAD2, "KUCAJ: /ticket [playerid/DioImena] [cijena] [razlog]");
            return 1;
         }
         giveplayerid = ReturnUser(tmp);
           tmp = strtok(cmdtext, idx);
         if(!strlen(tmp))
         {
            SendClientMessage(playerid, COLOR_GRAD2, "KUCAJ: /ticket [playerid/DioImena] [cijena] [razlog]");
            return 1;
         }
         moneys = strval(tmp);
         if(moneys < 1 || moneys > 99999) { SendClientMessage(playerid, COLOR_GREY, "   Kazna ne moze biti veca od 1 i veca od 99999 !"); return 1; }
         if(IsPlayerConnected(giveplayerid))
         {
             if(giveplayerid != INVALID_PLAYER_ID)
             {
                 if (ProxDetectorS(8.0, playerid, giveplayerid))
               {
                   GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));

                  new length = strlen(cmdtext);
                  while ((idx < length) && (cmdtext[idx] <= ' '))
                  {
                     idx++;
                  }
                  new offset = idx;
                  new result[128];
                  while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                  {
                     result[idx - offset] = cmdtext[idx];
                     idx++;
                  }
                  result[idx - offset] = EOS;
                  if(!strlen(result))
                  {
                     SendClientMessage(playerid, COLOR_GRAD2, "KUCAJ: /ticket [playerid/DioImena] [cijena] [razlog]");
                     return 1;
                  }
                  format(string, sizeof(string), "* Dao si %s Kaznu koja kosta $%d, razlog: %s", giveplayer, moneys, (result));
                  SendClientMessage(playerid, COLOR_WHITE, string);
                  format(string, sizeof(string), "* Policajac %s ti je dao kaznu koja kosta $%d, razlog: %s", sendername, moneys, (result));
                  SendClientMessage(giveplayerid, COLOR_WHITE, string);
                  SendClientMessage(giveplayerid, COLOR_WHITE, "* Kucaj /accept ticket, da je prihvatis.");
                  TicketOffer[giveplayerid] = playerid;
                  TicketMoney[giveplayerid] = moneys;
                  return 1;
               }
               else
               {
                  SendClientMessage(playerid, COLOR_GREY, "** Taj igrac nije blizu Vas !");
                  return 1;
               }
            }
         }
         else
         {
             SendClientMessage(playerid, COLOR_GREY, "** Taj igrac nije aktivan !");
             return 1;
         }
      }
      return 1;

A evo kada je ovaj prihvati:

}
         else if(strcmp(x_job,"ticket",true) == 0)
         {
             if(TicketOffer[playerid] < 999)
             {
                 if(IsPlayerConnected(TicketOffer[playerid]))
                 {
                     if (ProxDetectorS(5.0, playerid, TicketOffer[playerid]))
                  {
                          GetPlayerName(TicketOffer[playerid], giveplayer, sizeof(giveplayer));

                     format(string, sizeof(string), "* You have paid the Ticket of $%d to Officer %s.", TicketMoney[playerid], giveplayer);
                     SendClientMessage(playerid, COLOR_WHITE, string);
                     format(string, sizeof(string), "* %s has paid your Ticket of $%d.", sendername, TicketMoney[playerid]);
                     SendClientMessage(TicketOffer[playerid], COLOR_WHITE, string);
                     SafeGivePlayerMoney(playerid, - TicketMoney[playerid]);
                     SafeGivePlayerMoney(TicketOffer[playerid], TicketMoney[playerid]);
                     TicketOffer[playerid] = 999;
                     TicketMoney[playerid] = 0;
                     return 1;
                  }
                  else
                  {
                      SendClientMessage(playerid, COLOR_GREY, "   The Officer is not near you !");
                      return 1;
                  }
                 }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   No-one offered you a Ticket !");
                return 1;
            }

Ovaj dio nisam preveo i mrsko mi je
Poslednja Izmena: Decembar 11, 2011, 00:58:01 PRE PODNE od SEJFO




Balkan Ulice RPG opis servera: Click



-Tutorial za mijesanje ID-ova na vozilima: Click

Nadji ovaj deo

moneys = strval(tmp);
if(moneys < 1 || moneys > 99999) { SendClientMessage(playerid, COLOR_GREY, "   Kazna ne moze biti veca od 1 i veca od 99999 !"); return 1; }

i ispod dodaj

if(moneys > GetPlayerMoney(giveplayerid))
{
SendClientMessage(playerid, COLOR_WHITE, "Igrac nema dovoljno novca");
return 1;
}


Poslednja Izmena: Decembar 11, 2011, 01:32:23 PRE PODNE od [BR]Maki187

[quote author=
Maki187 link=topic=34361.msg256694#msg256694 date=1323563499]
Nadji ovaj deo

moneys = strval(tmp);
if(moneys < 1 || moneys > 99999) { SendClientMessage(playerid, COLOR_GREY, "   Kazna ne moze biti veca od 1 i veca od 99999 !"); return 1; }

i ispod dodaj

if(moneys > GetPlayerMoney(giveplayerid))
{
SendClientMessage(playerid, COLOR_WHITE, "Igrac nema dovoljno novca");
return 1;
}



[/quote]

To sam pokusavao,ni to ne radi nego sam stavio ovako:

                                                        for(new i = 0; i < MAX_PLAYERS; i++)
                     if (GetPlayerMoney(playerid) < TicketMoney)
                     {
                        format(string, sizeof(string), "* Nemas $%d da platis kaznu.", TransportValue);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        return 1;

Ali hvala ti koji si pokusao pomoci...




Balkan Ulice RPG opis servera: Click



-Tutorial za mijesanje ID-ova na vozilima: Click