Jump to content
  • 0

Problema DespawnVehicle


Gabby

Question

Salut, masinile personale nefolosite nu primesc despawn. 

Cod vechi:

function DespawnVehicle(carid) {
    new dbid = FindSpawnID(carid);
    if(CarInfo[dbid][Spawned] != 0) DestroyPlayerCar(dbid);
    printf("Vehicle %d despawned. [db: %d]", carid, dbid);
    return 1;
}

 

Am modificat cum am gasit intr-un topic dar nu functioneaza:

function DespawnVehicle(carid) {
    new dbid = FindSpawnID(carid);
    if(VehicleHaveDriver(dbid)) {
    VehicleTimer[dbid] = SetTimerEx("DespawnVehicle", 60000*20, 0, "d", dbid);// aici se reseteaza timer-ul pentru a nu ramane masina pe server
    return 1;
    }
    if(CarInfo[dbid][Spawned] != 0) DestroyPlayerCar(dbid);
    printf("Vehicle %d despawned. [db: %d]", carid, dbid);
    return 1;
}

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

arata functia DestroyPlayerCar

 

Citat
Link to comment
Share on other sites

  • 0
Acum 13 ore, SherKan a spus:

arata functia DestroyPlayerCar

 

stock DestroyPlayerCar(dbid) {
    if(CarInfo[dbid][Spawned] == 0) return 1;

    VehicleOwned[CarInfo[dbid][Spawned]] = 0;
    VehicleSQL[CarInfo[dbid][Spawned]] = 0;
        
    new Float: Pos[3];
    GetVehiclePos(CarInfo[dbid][Spawned], Pos[0], Pos[1], Pos[2]);
    if(CarInfo[dbid][cNeon] > 0) {
        DestroyDynamicObject(neon[0][CarInfo[dbid][Spawned]]);
        DestroyDynamicObject(neon[1][CarInfo[dbid][Spawned]]);
        neon[0][CarInfo[dbid][Spawned]] = 0;
        neon[1][CarInfo[dbid][Spawned]] = 0;    
    }
    if(strlen(CarInfo[dbid][cText]) >= 3) DestroyDynamicObject(nameobject[CarInfo[dbid][Spawned]]);
    CarInfo[dbid][cFuel] = Gas[CarInfo[dbid][Spawned]];
    new query[256];
    format(query, sizeof(query), "UPDATE `cars` SET `Fuel`='%d' WHERE `ID`='%d'", CarInfo[dbid][cFuel], dbid);
    mysql_query(SQL, query);
    
    CarInfo[dbid][cLastPos][0] = Pos[0];
    CarInfo[dbid][cLastPos][1] = Pos[1];
    CarInfo[dbid][cLastPos][2] = Pos[2];    
        
    DestroyVehicle(CarInfo[dbid][Spawned]);
    CarInfo[dbid][Spawned] = 0;
    new string[180];
    mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Spawned='%d' WHERE ID=%d", CarInfo[dbid][Spawned], dbid);
    mysql_tquery(SQL, string, "", "");
    return 1;
}

Edited by Gabby
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.