CMD:veh with a 3D Textdraw
#4

Add this below sa-mp include : native IsValidVehicle(vehicleid);
- Every admin can spawn 50 cars. If you want that all admins can only spawn 50 cars change the code by removing playerid;
variables :
CreatedCars[MAX_PLAYERS][50];
vehicle3Dtext[MAX_PLAYERS][50];

Код:
CMD:acar(playerid, params[]) {
	if(PlayerInfo[playerid][pAdmin] >= 3) {
		new
			iVehicle,
			iColors[2],
			Text3D:vehicle3Dtext[MAX_VEHICLES];

		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 {
			new Float: fVehPos[4];
                        for(new i; i<50;i++)
                        {
                             if(IsValidVehicle(CreatedCars[playerid][i]) continue; 
                              new fVW = GetPlayerVirtualWorld(playerid);
			GetPlayerPos(playerid, fVehPos[0], fVehPos[1], fVehPos[2]);
			GetPlayerFacingAngle(playerid, fVehPos[3]);
			CreatedCars[playerid][i] = CreateVehicle(iVehicle, fVehPos[0], fVehPos[1], fVehPos[2], fVehPos[3], iColors[0], iColors[1], -1);
		        vehicle3Dtext[playerid][i] = Create3DTextLabel( "ADMIN SPAWNED CAR", 0xFF0000AA, 0.0, 0.0, 0.0, 50.0, 0, 1 );
			Attach3DTextLabelToVehicle(vehicle3Dtext[playerid][i],CreatedCars[playerid][i], 0.0, 0.0, 2.0);
			VehicleFuel[CreatedCars[playerid][i]] = 100.0;
			Vehicle_ResetData(CreatedCars[playerid][i]);
			LinkVehicleToInterior(CreatedCars[playerid][i], GetPlayerInterior(playerid));
			SetVehicleVirtualWorld(CreatedCars[iIterator], fVW);
                        SendClientMessageEx(playerid, COLOR_GREY, "Vehicle spawned!");
                        break;
                        }
		}
	}
	else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
	return 1;
}
Reply


Messages In This Thread
CMD:acar with a 3D Textdraw - by kevannkw - 05.03.2015, 19:22
Re : CMD:veh with a 3D Textdraw - by Golimad - 05.03.2015, 19:28
Re: CMD:veh with a 3D Textdraw - by kevannkw - 05.03.2015, 20:03
Re : CMD:veh with a 3D Textdraw - by Golimad - 05.03.2015, 20:11
Re: CMD:veh with a 3D Textdraw - by kevannkw - 05.03.2015, 20:32

Forum Jump:


Users browsing this thread: 1 Guest(s)