Quote:
Originally Posted by Zach7
I have another question, how can I simply make a /car command to spawn one certain vehicle ID at my location. I can't find a function for that.
|
Alright if you want to spawn car and be saved in the server then use this.. [You can only delete it from the scriptfiles not IG]
http://www.mediafire.com/download/8s...6/vspawner.pwn
And if you want spawn one and /destroycar it then use those:
Код:
CMD:spawncar(playerid, params[]) {
if (PlayerInfo[playerid][pAdmin] >= 4) {
new
iVehicle,
iColors[2];
if(sscanf(params, "iii", iVehicle, iColors[0], iColors[1])) {
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /veh [model ID] [color 1] [color 2]");
}
else if(!(400 <= iVehicle <= 611)) {
SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid model specified (model IDs start at 400, and end at 611).");
}
else if(!(0 <= iColors[0] <= 255 && 0 <= iColors[1] <= 255)) {
SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid colour specified (IDs start at 0, and end at 255).");
}
else for(new iIterator; iIterator < sizeof(CreatedCars); iIterator++) if(CreatedCars[iIterator] == INVALID_VEHICLE_ID) {
new
Float: fVehPos[4];
GetPlayerPos(playerid, fVehPos[0], fVehPos[1], fVehPos[2]);
GetPlayerFacingAngle(playerid, fVehPos[3]);
CreatedCars[iIterator] = CreateVehicle(iVehicle, fVehPos[0], fVehPos[1], fVehPos[2], fVehPos[3], iColors[0], iColors[1], -1);
VehicleFuel[CreatedCars[iIterator]] = 100.0;
LinkVehicleToInterior(CreatedCars[iIterator], GetPlayerInterior(playerid));
return SendClientMessageEx(playerid, COLOR_GREY, "Vehicle spawned!");
}
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
return 1;
}
To destroy it:
Код:
CMD:destroycar(playerid, params[])
{
new string[128];
if(PlayerInfo[playerid][pAdmin] < 4)
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
return 1;
}
new bool:breakingloop = false, newid = INVALID_VEHICLE_ID;
if(IsPlayerInAnyVehicle(playerid))
{
for(new i=0;i<sizeof(CreatedCars);i++)
{
if(!breakingloop)
{
if(CreatedCars[i] == GetPlayerVehicleID(playerid)) // Checking for next available ID.
{
breakingloop = true;
newid = i;
}
}
}
if(newid != INVALID_VEHICLE_ID)
{
new carid = GetPlayerVehicleID(playerid);
DestroyVehicle(carid);
CreatedCars[newid] = INVALID_VEHICLE_ID;
format(string, sizeof(string), " Car %d destroyed.", carid);
SendClientMessageEx(playerid, COLOR_GREY, string);
}
}
return 1;
}