Jump to content
  • 0

Problema comanda


Mark S.

Question

Problemă întâlnită (descriere): Am creat comanda /setkm si nu merge.
Ero(area / rile) / warning-(ul / urile): nu am
Liniile de cod / sursa / script-ul:

if(strcmp(cmd, "/setkm", true) == 0)
    {
         new car = GetPlayerVehicleID(playerid);
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp) && PlayerInfo[playerid][pAdmin] >= 3)
        {
            SendClientMessage(playerid, COLOR_GREY, "/setodo [km]");
            return 1;
        }
        if(IsPlayerInAnyVehicle(playerid))
        {
            new dammount;
            dammount = strval(tmp);
            CarInfo[idx][KM] -= dammount;
              CarInfo[idx][KM] += dammount;
             SendClientMessage(playerid, COLOR_GREY, "Changed");
           }
        else
        {
            SendCl

Imagini / Video (optional):
Aţi încercat să rezolvaţi singur?: da am incercat asa

 

PS: Adrian_Petre daca ma poti ajuta tu cum ai facut la topicul cu km

Edited by Selby
Adaugat tag-ul pawn!
Link to comment
Share on other sites

22 answers to this question

Recommended Posts

Este bine?

 

if(strcmp(cmd, "/setkm", true) == 0)
    {
     
        //new car = GetPlayerVehicleID(playerid);
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp) && PlayerInfo[playerid][pAdmin] >= 3)
        {
            SendClientMessage(playerid, COLOR_GREY, "/setkm [km]");
            return 1;
        }
        if(IsPlayerInAnyVehicle(playerid))
        {
            new dammount;
            dammount = strval(tmp);
            CarInfo[idx][KM] += dammount;
              SendClientMessage(playerid, COLOR_GREY, "change

");
           }
        else
        {
            SendClientMessage(playerid, COLOR_GRAD1, "   Nu esti in masina!");
            return 1;
        }
      }

 

 

sau sterg // de la   //new car = GetPlayerVehicleID(playerid);  si pun  CarInfo[car][KM] += dammount;

Edited by Selby
Link to comment
Share on other sites

CarInfo[car][KM] += dammount;

 

 

 

    if(strcmp(cmd, "/setkm", true) == 0)
    {
       // VehicleKM[idx] = dini_Int(file,"KM");
        new car = GetPlayerVehicleID(playerid);
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp) && PlayerInfo[playerid][pAdmin] >= 3)
        {
            SendClientMessage(playerid, COLOR_GREY, "/setkm [km]");
            return 1;
        }
        if(IsPlayerInAnyVehicle(playerid))
        {
            new dammount;
            dammount = strval(tmp);
            CarInfo[car][KM] += dammount;
              SendClientMessage(playerid, COLOR_GREY, "Chanfed");
           }
        else
        {
            SendClientMessage(playerid, COLOR_GRAD1, "   Nu esti in masina!");
            return 1;
        }
      }

 

 

 

Nu merge

Edited by Selby
Link to comment
Share on other sites

nu actualizeaza in joc si da din fisier adica daca modific in 120km sa aiba 120km si cand dau restart

 

zice "change"  dar tot atatia km am, e ceva gresit la comanda, pentru ca este facuta de mine...

Edited by Selby
Link to comment
Share on other sites

la

public onplayerupdate

 

if(IsPlayerInAnyVehicle(playerid))
    {
        if (playerState == PLAYER_STATE_DRIVER)
         {
            if(IsAnOwnableCar(newcar))
            {
                format(string, sizeof(string), "~b~km:~w~ %.2f Km", VehicleKM[LastCar[playerid]]);//afisam cati kilometrii are parcursi
                TextDrawSetString(Textdraw69[playerid], string);
              }
              else
              {
                    format(string, sizeof(string), "~b~km:~w~ max Km");//afisam cati kilometrii are parcursi
                    TextDrawSetString(Textdraw69[playerid], string);
            }
        }
      }

Link to comment
Share on other sites

CarInfo la masini personale

 

La public ProportionalUpdate(update,idx)

 

 

public ProportionalUpdate(update,idx)
{
    new file[64];
    if(update == 1)
    {
            format(file, sizeof(file),"LARP/Vehicles/%d.ini",idx);
               dini_IntSet(file,"Model",CarInfo[idx][cModel]);
            dini_FloatSet(file,"KM",VehicleKM[idx]);
            dini_FloatSet(file,"Gas",CarInfo[idx][cGas]);
            dini_FloatSet(file,"Location_X",CarInfo[idx][cLocationx]);
            dini_FloatSet(file,"Location_Y",CarInfo[idx][cLocationy]);
            dini_FloatSet(file,"Location_Z",CarInfo[idx][cLocationz]);
            dini_FloatSet(file,"Angle",CarInfo[idx][cAngle]);
            dini_IntSet(file,"Color_1",CarInfo[idx][cColorOne]);
            dini_IntSet(file,"Color_2",CarInfo[idx][cColorTwo]);
            dini_Set(file,"Owner",CarInfo[idx][cOwner]);
            dini_Set(file,"Plate",CarInfo[idx][cPlate]);
            dini_IntSet(file,"ID",CarInfo[idx][cID]);
            dini_IntSet(file,"Owned",CarInfo[idx][cOwned]);
            dini_IntSet(file,"Locked",CarInfo[idx][cLock]);
            dini_IntSet(file,"Paintjob",CarInfo[idx][cPaintjob]);
            dini_IntSet(file,"VirtualWorld",CarInfo[idx][cVirWorld]);
            dini_IntSet(file,"Unused",CarInfo[idx][cUnused]);
            dini_IntSet(file,"Component0",CarInfo[idx][cComponent0]);
            dini_IntSet(file,"Component1",CarInfo[idx][cComponent1]);
            dini_IntSet(file,"Component2",CarInfo[idx][cComponent2]);
            dini_IntSet(file,"Component3",CarInfo[idx][cComponent3]);
            etc...........

Edited by Selby
Link to comment
Share on other sites

adica la

if(IsPlayerInAnyVehicle(playerid))
  {
    if (playerState == PLAYER_STATE_DRIVER)
   {
      if(IsAnOwnableCar(newcar))
      {

   
        format(string, sizeof(string), "~b~km:~w~ %.2f Km", VehicleKM[LastCar[playerid]]);//afisam cati kilometrii are parcursi
        TextDrawSetString(Textdraw69[playerid], string);
      }
      else
      {
        format(string, sizeof(string), "~b~km:~w~ max Km");//afisam cati kilometrii are parcursi
      TextDrawSetString(Textdraw69[playerid], string);
      }
    }
  }

 

sa pun asa

 

if(IsPlayerInAnyVehicle(playerid))
  {
    if (playerState == PLAYER_STATE_DRIVER)
   {
      if(IsAnOwnableCar(newcar))
      {

ProportionalUpdate(1, idx);
        format(string, sizeof(string), "~b~km:~w~ %.2f Km", VehicleKM[LastCar[playerid]]);//afisam cati kilometrii are parcursi
        TextDrawSetString(Textdraw69[playerid], string);
      }
      else
      {
        format(string, sizeof(string), "~b~km:~w~ max Km");//afisam cati kilometrii are parcursi
      TextDrawSetString(Textdraw69[playerid], string);
      }
    }
  }

Edited by Selby
Link to comment
Share on other sites

   
    if(strcmp(cmd, "/setkm", true) == 0)
    {
        ProportionalUpdate(1, idx);
        new car = GetPlayerVehicleID(playerid);
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp) && PlayerInfo[playerid][pAdmin] >= 3)
        {
            SendClientMessage(playerid, COLOR_GREY, "/setkm [km]");
            return 1;
        }
        if(IsPlayerInAnyVehicle(playerid))
        {
            new dammount;
            dammount = strval(tmp);
            CarInfo[car][KM] += dammount;
              SendClientMessage(playerid, COLOR_GREY, "Changed");
           }
        else
        {
            SendClientMessage(playerid, COLOR_GRAD1, "   Nu esti in masina!");
            return 1;
        }

      }

nu merge

Edited by Selby
Link to comment
Share on other sites

if(strcmp(cmd, "/setkm", true) == 0)
    {
        new car = GetPlayerVehicleID(playerid);
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp) && PlayerInfo[playerid][pAdmin] >= 3)
        {
            SendClientMessage(playerid, COLOR_GREY, "/setkm [km]");
            return 1;
        }
        if(IsPlayerInAnyVehicle(playerid))
        {
            new dammount;
            dammount = strval(tmp);
              VehicleKM[car] += dammount;
              SendClientMessage(playerid, COLOR_GREY, "Changed");
              ProportionalUpdate(1, idx);
           }
        else
        {
       	 SendClientMessage(playerid, COLOR_GRAD1, "   Nu esti in masina!");
       	 return 1;
        }
   

   
nu merge

Am rezolvat am facut asa:

if(strcmp(cmd, "/setkm", true) == 0)
      {
        new car = GetPlayerVehicleID(playerid);
        tmp = strtok(cmdtext, idx);
          if(!strlen(tmp) && PlayerInfo[playerid][pAdmin] >= 3)
          {
   	       SendClientMessage(playerid, COLOR_GREY, "/setkm [km]");
   	       return 1;
   	 }
        if(IsPlayerInAnyVehicle(playerid))
       	 {
       	       new dammount;
       	       dammount = strval(tmp);
       	       VehicleKM[car] = dammount;
       	       SendClientMessage(playerid, COLOR_GREY, "Changed");
                ProportionalUpdate(1, idx);
          	 }
       	 else
       	 {
       	       SendClientMessage(playerid, COLOR_GRAD1, " Nu esti in masina!");
                return 1;
            }
    }

Edited by WopsS
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.