Jump to content
  • 0

Ajutor Dealership


TymoPC

Question

Problema intalnita (descriere):Pe serverul meu de samp am dealership cu dialog si m-am apucat sa il fac intr-unul cu textdraw.

Am urmarit pe youtube un tutorial care iti explica exact cum sa faci un dealership cu textdraw ca mneah is mai incepator nu mult...

Toate is bune si frumoase inafar de functia cand cumperi(cand dai pe textdraw sa cumperi masina).Cumpar,zice ca masina a fost cumparata dar cand dau /pozitiemasina checkpointu il arata in alta parte unde nici macar nu e masina spawnata, iar masina care am cumparato apare la locu ei doar ca nu e ca si cum e personala e ca o masina normala,nu poti so inchizi nimic.

In baza de date MYSQL salveaza masina fara nici o problema, si ce e ciudat daca dau restart la server totul merge cum trebuie , /pozitiemasina imi pune checkpointu unde trebuie , masina care la inceput e o masina normala devine personala.
Ero(area / rile) / warning-(ul / urile): Nu sunt errori
Liniile de cod / sursa / script-ul(obligatoriu):

Asta este functia de cumparat masina:

Citat

function InsertCar1(playerid)
{
      if(GetPlayerCash(playerid) > DSModele[IDDS[playerid]][2])
    {
        if(PlayerData[playerid][pPcarkey] == 999)
        {
            new sendername[MAX_PLAYER_NAME];
            new string[512];
            new idd;
            mysql_query("SELECT * FROM `cars`");
            mysql_store_result();
            idd = mysql_num_rows()+1;
            mysql_free_result();
            format(string, sizeof(string), "%s",vehName[DSModele[IDDS[playerid]][1]-400]);
            strmid(CarData[idd][cDescription], string, 0, strlen(string), 255);
            GetPlayerName(playerid, sendername, sizeof(sendername));
            strmid(CarData[idd][cOwner], sendername, 0, strlen(sendername), 999);
            CarData[idd][cModel] = DSModele[IDDS[playerid]][1];
            CarData[idd][cValue] = DSModele[IDDS[playerid]][2];
            CarData[idd][cLocationx] = 300.7446+random(5);
            CarData[idd][cLocationy] = -1503.4188+random(5);
            CarData[idd][cLocationz] = 24.3286+random(1);
            CarData[idd][cOwned] = 1;
            CarData[idd][cKM] = 0;
            CreateVehicle(CarData[idd][cModel],CarData[idd][cLocationx],CarData[idd][cLocationy],CarData[idd][cLocationz],CarData[idd][cAngle],1,1,-1);
            format(string, sizeof(string),"INSERT INTO cars (id, Model) VALUES (%d, %d)",  idd, CarData[idd][cModel]);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Locationx='%f' WHERE id=%d", CarData[idd][cLocationx], idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Locationy='%f' WHERE id=%d", CarData[idd][cLocationy], idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Locationz='%f' WHERE id=%d", CarData[idd][cLocationz], idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Angle='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET SaLocationx='%f' WHERE id=%d", CarData[idd][cLocationx], idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET SaLocationy='%f' WHERE id=%d", CarData[idd][cLocationy], idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET SaLocationz='%f' WHERE id=%d", CarData[idd][cLocationz], idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET SaAngle='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET ColorOne='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET ColorTwo='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Description='%s' WHERE id=%d", CarData[idd][cDescription], idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Value='%d' WHERE id=%d", CarData[idd][cValue], idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET License='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Owned='1' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Owner='%s' WHERE id=%d", CarData[idd][cOwner], idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Lockk='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Exploded='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Num='SA-MP.RO' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Component00='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Component01='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Component02='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Component03='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Component04='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Component05='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Component06='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Component07='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Component08='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Component09='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Component10='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Component11='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Component12='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET Component13='0' WHERE id=%d", idd);
            mysql_query(string);
            format(string, sizeof(string), "UPDATE cars SET KM='0' WHERE id=%d", idd);
            mysql_query(string);
            SwitchKey[playerid] = 1;
            PlayerData[playerid][pPcarkey] = idd;
              format(string, sizeof(string), "UPDATE players SET Car='%d' WHERE id=%d", PlayerData[playerid][pPcarkey], PlayerData[playerid][pSQLID]);
            mysql_query(string);
            GivePlayerCash(playerid, - DSModele[IDDS[playerid]][2]);
            format(string,sizeof(string),"Ai cumparat un %s,scrie /pozitiemasina pentru al gasi.",vehName[DSModele[IDDS[playerid]][1]-400]);
            SendClientMessage(playerid,COLOR_WHITE,string);
        }
        else SendClientMessage(playerid, 0xFF0000FF, "Ai deja o masina personala!");
    }
}

Functia este pusa in OnPlayerClickTextdraw:

Citat

    if(clickedid == ButonCumpara[playerid])
    {
        InsertCar1(playerid);
        DestroyVehicle(IDmasina[playerid]);
        SetPlayerVirtualWorld(playerid,0);
        TogglePlayerControllable(playerid, 1);
        SetCameraBehindPlayer(playerid);
        TextDrawHideForPlayer(playerid,Linie[playerid]);
        TextDrawHideForPlayer(playerid,ButonInapoi[playerid]);
        TextDrawHideForPlayer(playerid,ButonUrmator[playerid]);
         TextDrawHideForPlayer(playerid,ButonCumpara[playerid]);
        TextDrawHideForPlayer(playerid,ButonTesteaza[playerid]);
        TextDrawHideForPlayer(playerid,ButonAnuleaza[playerid]);
        TextDrawHideForPlayer(playerid,DealerPret[playerid]);
        TextDrawHideForPlayer(playerid,DealerMasina[playerid]);
        CancelSelectTextDraw(playerid);
    }


Imagini / Video (optional): https://www.youtube.com/watch?v=zFuvIKGD648
Ati incercat sa rezolvati singur?: Am incertat timp de 2 zile sa rezolv, sa schimb, sa ma gandesc care e problema si tot lafel face.

Edited by TymoPC
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

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.