01.05.2010, 13:29
My /veh (dcmd) admin command (spawning vehicles) is working and vehicles are destroying after 50 seconds, but, it's destroying when someone's is in the vehicle... I don't know what's the problem so I hope anyone can help me or correct the script. Btw, if I enter a Hydra and crash, it respawns at the spawned position, I don't want that... Anyway.
pawn Код:
forward DestroyVehicleEx(iVehicleID);
public DestroyVehicleEx(iVehicleID)
{
for(new i=0;i<=MAX_PLAYERS;i++)
{
if(GetPlayerVehicleID(i) != iVehicleID)
DestroyVehicle(iVehicleID);
}
}
dcmd_veh(playerid, params[])
{
new vehicleid, color[2], myString[128];
if(pInfo[playerid][pAdmin] < 4) return SystemMessage(playerid, "You are not an Administrator with the required level.");
if(sscanf(params,"ddd",vehicleid,color[0],color[1])) return SystemMessage(playerid, "USAGE: /veh [vehicleid] [color1] [color2]");
else
{
if(vehicleid < 400 || vehicleid > 611) return SystemMessage(playerid, "Please enter a valid vehicle ID (400 - 611).");
if((color[0] < 0 || color[0] > 128) || (color[1] < 0 || color[1] > 128)) return SystemMessage(playerid, "Please enter valid color IDs (0-128).");
new Float:PosX, Float:PosY, Float:PosZ, Float:Angle;
GetPlayerPos(playerid, PosX, PosY, PosZ);
GetPlayerFacingAngle(playerid, Angle);
new iID = AddStaticVehicle(vehicleid, PosX+1, PosY+1, PosZ, Angle, color[0], color[1]);
SetTimerEx("DestroyVehicleEx", 50000, 1, "d", iID);
format(myString, sizeof(myString), "You have spawned vehicle id %i.",vehicleid);
SystemMessage(playerid, myString);
}
return 1;
}