21.02.2018, 19:55
Hello, I have been trying to make a copy of my /veh command but then with the mselection this is the /veh cmd:
This is the list to spawn it with the MSelection as you can see I masked things with numbers to see how far it comes in the console, it doesn't go further then number 2
PHP код:
CMD:veh(playerid, params[]) {
if(PlayerInfo[playerid][pAdmin] >= 4) {
new
iVehicle,
iColors[2];
if(sscanf(params, "iii", iVehicle, iColors[0], iColors[1])) {
SendClientMessageEx(playerid, COLOR_GREY, "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(IsATrain(iVehicle)) {
SendClientMessageEx(playerid, COLOR_GREY, "Trains cannot be spawned during runtime.");
}
else if(!(0 <= iColors[0] <= 255 && 0 <= iColors[1] <= 255)) {
SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid color specified (IDs start at 0, and end at 255).");
}
else for(new iIterator; iIterator < sizeof(CreatedCars); iIterator++) if(iIterator >= 49) {
return SendClientMessageEx(playerid, COLOR_GRAD1, "The maximum limit of 50 spawned vehicles has been reached.");
}
else if(CreatedCars[iIterator] == INVALID_VEHICLE_ID) {
new
Float: fVehPos[4];
new fVW = GetPlayerVirtualWorld(playerid);
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;
Vehicle_ResetData(CreatedCars[iIterator]);
LinkVehicleToInterior(CreatedCars[iIterator], GetPlayerInterior(playerid));
SetVehicleVirtualWorld(CreatedCars[iIterator], fVW);
return SendClientMessageEx(playerid, COLOR_GREY, "Vehicle spawned!");
}
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
return 1;
}]
PHP код:
if(listid == AdminCarList)
{
new
iVehicle,
iColors[2];
if(IsATrain(iVehicle)) {
SendClientMessageEx(playerid, COLOR_GREY, "Trains cannot be spawned during runtime.");
}
else for(new iIterator; iIterator < sizeof(CreatedCars); iIterator++) if(iIterator >= 49) {
return SendClientMessageEx(playerid, COLOR_GRAD1, "The maximum limit of 50 spawned vehicles has been reached.");
}
else if(CreatedCars[iIterator] == INVALID_VEHICLE_ID) {
new
Float: fVehPos[4];
//new iVehicle[MAX_PLAYERS];
print("1");
new fVW = GetPlayerVirtualWorld(playerid);
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);
print("2");
VehicleFuel[CreatedCars[iIterator]] = 100.0;
Vehicle_ResetData(CreatedCars[iIterator]);
print("3");
LinkVehicleToInterior(CreatedCars[iIterator], GetPlayerInterior(playerid));
print("4");
SetVehicleVirtualWorld(CreatedCars[iIterator], fVW);
return SendClientMessage(playerid, 0xFF0000FF, "Admin vehicle spawned");
}
else SendClientMessage(playerid, 0xFF0000FF, "Canceled Admin vehicle selection");
return 1;
}