CMD:editvehicle(playerid, params[])
{
new id, usage[16], amount;
if(sscanf(params, "ds[16]D(0)", id, usage, amount))
{
if(Player[playerid][AdminLevel] >= 4)
{
SendClientMessage(playerid, WHITE, "USAGE: /editvehicle [id] [usage] [(optional) amount]");
return SendClientMessage(playerid, GREY, "Usages: spawn, colour(1-2), group, delete");
}
}
else if(Player[playerid][AdminLevel] >= 4)
{
if(id < 0 || id > MAX_DYN_VEHICLES) return SendClientMessage(playerid, WHITE, "That is not a valid vehicle ID!");
Array[0] = 0;
if(strcmp(usage, "spawn", true) == 0)
{
new Float:Pos[4];
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
GetPlayerFacingAngle(playerid, Pos[3]);
Vehicle[id][VehiclePos][0] = Pos[0];
Vehicle[id][VehiclePos][1] = Pos[1];
Vehicle[id][VehiclePos][2] = Pos[2];
Vehicle[id][VehiclePos][3] = Pos[3];
Vehicle[id][VehicleVW] = GetPlayerVirtualWorld(playerid);
Vehicle[id][VehicleInt] = GetPlayerInterior(playerid);
format(Array, sizeof(Array), "You have moved the spawn of vehicle %d", id);
SendClientMessage(playerid, WHITE, Array);
format(Array, sizeof(Array), "[/EDITVEHICLE] %s has moved the spawn of vehicle %d to X: %f, Y: %f, Z: %f", GetName(playerid), id, Pos[0], Pos[1], Pos[2]);
}
else
{
SendClientMessage(playerid, WHITE, "USAGE: /editvehicle [id] [usage] [(optional) amount]");
return SendClientMessage(playerid, GREY, "Usages: spawn, colour(1-2), group, delete");
}
Log(4, Array);
SaveVehicle(Vehicle[id][VehID]);
RespawnVehicle(Vehicle[id][VehID]);
}
else SendClientMessage(playerid, WHITE, "You are not authorized to preform this command.");
return 1;
}
RespawnVehicle(id)
{
DestroyVehicle(id);
if(Vehicle[id][VehiclePos][0] != 0.00000 && Vehicle[id][VehiclePos][1] != 0.00000 && Vehicle[id][VehiclePos][2] != 0.00000)
{
Vehicle[id][VehID] = CreateVehicle(Vehicle[id][Model], Vehicle[id][VehiclePos][0], Vehicle[id][VehiclePos][1], Vehicle[id][VehiclePos][2], Vehicle[id][VehiclePos][3], Vehicle[id][VehicleColour][0], Vehicle[id][VehicleColour][1], -1, Vehicle[id][Siren]);
SetVehicleVirtualWorld(Vehicle[id][VehID], Vehicle[id][VehicleVW]);
LinkVehicleToInterior(Vehicle[id][VehID], Vehicle[id][VehicleInt]);
}
return 1;
}
SaveVehicle(id)
{
Array[0] = 0;
format(Array, sizeof Array, "UPDATE `vehicles` SET \
`Model` = '%d', `X` = '%f', `Y` = '%f', `Z` = '%f', `A` = %f, `VW` = '%d', `Int` = '%d', `Colour1` = '%d', `Colour2` = '%d', `Group` = '%d', `Siren` = '%d' WHERE `id` = '%d'",
Vehicle[id][Model], Vehicle[id][VehiclePos][0], Vehicle[id][VehiclePos][1], Vehicle[id][VehiclePos][2], Vehicle[id][VehiclePos][3], Vehicle[id][VehicleVW], Vehicle[id][VehicleInt],
Vehicle[id][VehicleColour][0], Vehicle[id][VehicleColour][1], Vehicle[id][VehicleGroup], Vehicle[id][Siren], Vehicle[id][VehicleDatabaseID]
);
mysql_tquery(SQL, Array, "", "");
return 1;
}
format(Array, sizeof Array, "UPDATE `vehicles` SET \
`Model` = '%d', `X` = '%f', `Y` = '%f', `Z` = '%f
PHP код:
? |
RespawnVehicle(id)
{
DestroyVehicle(id);
if(Vehicle[id][VehiclePos][0] != 0.00000 && Vehicle[id][VehiclePos][1] != 0.00000 && Vehicle[id][VehiclePos][2] != 0.00000)
{
Vehicle[id][VehID] = CreateVehicle(Vehicle[id][Model], Vehicle[id][VehiclePos][0], Vehicle[id][VehiclePos][1], Vehicle[id][VehiclePos][2], Vehicle[id][VehiclePos][3], Vehicle[id][VehicleColour][0], Vehicle[id][VehicleColour][1], -1, Vehicle[id][Siren]);
SetVehicleVirtualWorld(Vehicle[id][VehID], Vehicle[id][VehicleVW]);
LinkVehicleToInterior(Vehicle[id][VehID], Vehicle[id][VehicleInt]);
}
return 1;
}
Vehicle[Vehicle[id][VehID]][VehID] = CreateVehicle(Vehicle[id][Model], Vehicle[id][VehiclePos][0], Vehicle[id][VehiclePos][1], Vehicle[id][VehiclePos][2], Vehicle[id][VehiclePos][3], Vehicle[id][VehicleColour][0], Vehicle[id][VehicleColour][1], -1, Vehicle[id][Siren]);
RespawnVehicle(id)
{
DestroyVehicle(Vehicle[id][VehID]);
if(Vehicle[id][VehiclePos][0] != 0.00000 && Vehicle[id][VehiclePos][1] != 0.00000 && Vehicle[id][VehiclePos][2] != 0.00000)
{
Vehicle[id][VehID] = CreateVehicle(Vehicle[id][Model], Vehicle[id][VehiclePos][0], Vehicle[id][VehiclePos][1], Vehicle[id][VehiclePos][2], Vehicle[id][VehiclePos][3], Vehicle[id][VehicleColour][0], Vehicle[id][VehicleColour][1], -1, Vehicle[id][Siren]);
SetVehicleVirtualWorld(Vehicle[id][VehID], Vehicle[id][VehicleVW]);
LinkVehicleToInterior(Vehicle[id][VehID], Vehicle[id][VehicleInt]);
}
return 1;
}
RespawnVehicle(id);
PHP код:
PHP код:
Change like this PHP код:
PHP код:
|
new Array[4096]; // Much cleaner way of doing this, define it globally and use it when needed. Rather than defining strings locally. (Added 5/13/2016 - Do not remove, unless you want errors)
public OnVehicleSpawn(vehicleid)
{
SetVehiclePos(vehicleid, PlayerVehicle[vehicleid][vX], PlayerVehicle[vehicleid][vY], PlayerVehicle[vehicleid][vZ]);
SetVehicleZAngle(vehicleid, PlayerVehicle[vehicleid][vZr]);
SetVehicleHealth(vehicleid, PlayerVehicle[vehicleid][vHealth]);
return 1;
}
CMD:respawnall(playerid,params[])
{
if(PlayerInfo[playerid][pAdminlvl] >= 2)
{
for(new i = GetVehiclePoolSize(); i > 0; i--)
{
SetVehicleToRespawn(i);
}
SendClientMessageToAll(red, "[SYSTEM] "blancU"All vehicle respawned");
aAlert("/respawnall", playerid);
return 1;
}
else return SendClientMessage(playerid, red, "You are not allowed to use this command");
}