SA-MP Forums Archive
Help with Destroying spawned vehicle! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with Destroying spawned vehicle! (/showthread.php?tid=79881)



Help with Destroying spawned vehicle! - yugokoral - 31.05.2009

How can i destroy vehicle here; after vehicle is not in use 60 seconds and if car exploded that it not respawn

Here is code:
pawn Код:
dcmd_v(playerid, params[])
{
    new
        idx,
        iString[ 128 ];
   
    if ( gPlayerStatus[ playerid ] != 0 )
    {
        format              ( iString, 128, "[ERROR]: You are already using \"%s\".", aSelNames[ gPlayerStatus[ playerid ] - 1 ] );
        SendClientMessage   ( playerid, COLOR_RED, iString );
       
        return true;
    }
   
    if ( params[ 0 ] == '\0' )  // Same effect as a !strlen check.
        return SendClientMessage( playerid, COLOR_RED, "[USAGE]: /v MODELID/NAME" );

    //***************
    // Fix by Mike! *
    //***************
   
    idx = GetVehicleModelIDFromName( params );

    if( idx == -1 )
    {
        idx = strval(iString);

        if ( idx < MIN_VEHI_ID || idx > MAX_VEHI_ID )
            return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid MODELID/NAME");
    }

    new
        Float:x,
        Float:y,
        Float:z,
        Float:a;

    GetPlayerPos(playerid, x, y, z);
    GetXYInFrontOfPlayer(playerid, x, y, VEHI_DIS);
    GetPlayerFacingAngle(playerid, a);

    curPlayerVehM[playerid] = idx;

    curPlayerVehI[playerid] = CreateVehicle(idx, x, y, z + 2.0, a + 90.0, -1, -1, 5000);
    LinkVehicleToInterior(curPlayerVehI[playerid], GetPlayerInterior(playerid));

    curServerVehP[curPlayerVehI[playerid]][spawn]   = true;
    curServerVehP[curPlayerVehI[playerid]][vmodel]  = idx;
    curServerVehP[curPlayerVehI[playerid]][vInt]  = GetPlayerInterior(playerid);

    format(iString, 128, "[SUCCESS]: Spawned a \"%s\" (MODELID: %d, VEHICLEID: %d)", aVehicleNames[idx - MIN_VEHI_ID], idx, curPlayerVehI[playerid]);

    SendClientMessage(playerid, COLOR_GREEN, iString);

    return true;
}

thanks for help


Re: Help with Destroying spawned vehicle! - yugokoral - 01.06.2009

SORRY for double post! Anybody know to solve this

thank you


Re: Help with Destroying spawned vehicle! - Negrosoo - 24.06.2009

I'm also interested.....
No Replyes? ( Replyes or Replies.... I'm not english, sorry...)


Re: Help with Destroying spawned vehicle! - abhinavdabral - 24.06.2009

Dude.. I guess I can help you..........You can add a timer for 60 seconds that will check all the empty vehicles and clear them, also if you dont want then to respawn, you just have to ad some code under OnVehicleSpawn()

Thank You
Abhinav