02.08.2011, 12:49
Anyone know a respawn car command to respawn cars in game
// Wherever you need this.
for(new i=1; i<MAX_VEHICLES; i++)
{
if(IsVehicleOccupied(i) == 0)
{
SetVehicleToRespawn(vehicleid);
}
}
// The stock
stock IsVehicleOccupied(vehicleid)
{
for (new i = 0; i < GetMaxPlayers(); i ++)
{
if (GetPlayerVehicleID(playerid) == vehicleid) return true;
}
return false;
}
for(new i=1; i<MAX_VEHICLES; i++)
{
SetVehicleToRespawn(i);
SendClientMessageToAll(-1, "All vehicle respawned by an admin.");
}
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;
}
This will respawn a certain vehicle ID you entered.
Requirements : ZCMD + sscanf 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);
}