Respawn car command
#1

Anyone know a respawn car command to respawn cars in game
Reply
#2

Use SetVehicleToRespawn(vehicleid);
Reply
#3

Quote:
Originally Posted by Drebin
Посмотреть сообщение
Use SetVehicleToRespawn(vehicleid);
can you code it in please
Reply
#4

pawn Код:
// Wherever you need this.
for(new i=1; i<MAX_VEHICLES; i++)
{
if(IsVehicleOccupied(i) == 0)
{
    SetVehicleToRespawn(vehicleid);
}
}
pawn Код:
// The stock

stock IsVehicleOccupied(vehicleid)
{
    for (new i = 0; i < GetMaxPlayers(); i ++)
    {
        if (GetPlayerVehicleID(playerid) == vehicleid) return true;
    }
    return false;
}
Reply
#5

pawn Код:
for(new i=1; i<MAX_VEHICLES; i++)
{
       SetVehicleToRespawn(i);
       SendClientMessageToAll(-1, "All vehicle respawned by an admin.");
}
Now, you may want to respawn all unocupied vehicles.
Reply
#6

Quote:
Originally Posted by antonio112
Посмотреть сообщение
pawn Код:
for(new i=1; i<MAX_VEHICLES; i++)
{
       SetVehicleToRespawn(i);
       SendClientMessageToAll(-1, "All vehicle respawned by an admin.");
}
Now, you may want to respawn all unocupied vehicles.
i only want the part to resapwn cars that are blocking the road when u do /dl in game u get the id of the vehicle i only want to respawn a certain car
Reply
#7

This will respawn a certain vehicle ID you entered.

Requirements : ZCMD + sscanf
pawn Код:
CMD:respawnveh( playerid, params[ ] )
{
    if ( !IsPlayerAdmin( playerid  ) )
        return SendClientMessage( playerid, -1, "ERROR: You aren't a RCON admin." );

    static
        vehID
    ;

    if ( sscanf( params, "i",  vehID ) )
        return SendClientMessage( playerid, -1, "SYNTAX: /respawnveh < vehID >" );

    if ( vehID == INVALID_VEHICLE_ID )
        return SendClientMessage( playerid, -1, "ERROR: Invalid vehicle ID." );

    SetVehicleToRespawn( vehID );

    SendClientMessage( playerid, -1, "Vehicle has been respawned succesfully." );

    return 1;
}
Hope it helps you.
Reply
#8

Quote:
Originally Posted by Basicz
Посмотреть сообщение
This will respawn a certain vehicle ID you entered.

Requirements : ZCMD + sscanf
pawn Код:
CMD:respawnveh( playerid, params[ ] )
{
    if ( !IsPlayerAdmin( playerid  ) )
        return SendClientMessage( playerid, -1, "ERROR: You aren't a RCON admin." );

    static
        vehID
    ;

    if ( sscanf( params, "i",  vehID ) )
        return SendClientMessage( playerid, -1, "SYNTAX: /respawnveh < vehID >" );

    if ( vehID == INVALID_VEHICLE_ID )
        return SendClientMessage( playerid, -1, "ERROR: Invalid vehicle ID." );

    SetVehicleToRespawn( vehID );

    SendClientMessage( playerid, -1, "Vehicle has been respawned succesfully." );

    return 1;
}
Hope it helps you.
It is not a good idea to use a static here, now you can't make another command containing "new vehID;".
Reply
#9

i tried to make my own here is wat it is

pawn Код:
dcmd_respawnveh(playerid, params[])
{
    if(!CmdLevelCheck(playerid,"respawnveh")) return CmdLevelError(playerid,"respawnveh");
    new id, tmp[128];
    if(sscanf(params, "uz", id, tmp)) return SendClientMessage(playerid, RED, "USAGE: /RESPAWNVEH [ID]");
    format(tmp, sizeof tmp, "",Car(id), AdminName(playerid), (tmp[0]) ? ("") : ("."), tmp[0], (tmp[0]) ? (" ]") : (""));
    SendClientMessageToAll(YELLOW, tmp), print(tmp), SaveToLog("respawnvehs",tmp), SetInfo(id,"respawnvehs",GetInfo(id,"Respawnvehs")+1);
    SendCommandMsg(playerid,"respawnveh");
    format(tmp,sizeof(tmp),"",AdminName(playerid));
    SpecialLeaveReason[id]=1,PlayerLeaveReason[id]=tmp;
    return respawnveh(id);
}
Reply
#10

Instead of respawnveh id can some help me with getveh id please

Thanks
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)